{"action":"opened","issue":{"url":"https://api.github.com/repos/sci-bots/microdrop/issues/259","repository_url":"https://api.github.com/repos/sci-bots/microdrop","labels_url":"https://api.github.com/repos/sci-bots/microdrop/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/sci-bots/microdrop/issues/259/comments","events_url":"https://api.github.com/repos/sci-bots/microdrop/issues/259/events","html_url":"https://github.com/sci-bots/microdrop/issues/259","id":355228173,"node_id":"MDU6SXNzdWUzNTUyMjgxNzM=","number":259,"title":"fix(plugins): explicit human-readable step/app field names","user":{"login":"cfobel","id":823355,"node_id":"MDQ6VXNlcjgyMzM1NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/823355?v=4","gravatar_id":"","url":"https://api.github.com/users/cfobel","html_url":"https://github.com/cfobel","followers_url":"https://api.github.com/users/cfobel/followers","following_url":"https://api.github.com/users/cfobel/following{/other_user}","gists_url":"https://api.github.com/users/cfobel/gists{/gist_id}","starred_url":"https://api.github.com/users/cfobel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfobel/subscriptions","organizations_url":"https://api.github.com/users/cfobel/orgs","repos_url":"https://api.github.com/users/cfobel/repos","events_url":"https://api.github.com/users/cfobel/events{/privacy}","received_events_url":"https://api.github.com/users/cfobel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-29T15:59:06Z","updated_at":"2018-08-29T15:59:06Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Most step/app field names are in [**snake_case**](https://en.wikipedia.org/wiki/Snake_case), i.e., [\"lower_case_with_underscores\"](https://www.python.org/dev/peps/pep-0008/).  The [`pygtkhelpers.ui.objectlist.CombinedFields`][combined-fields] `__init__` method [assumes a snake case field name and infers a human-readable column title][combined-fields-title]:\r\n\r\n```python\r\n...\r\ndefault_title = re.sub(r'_', ' ', field_name.name).capitalize()\r\n# Use custom column heading/title, if available.\r\ntitle = field_name.properties.get('title', default_title)\r\n...\r\n```\r\n\r\nIn some cases, e.g., the `repeat_duration_s` step field in the `microdrop.droplet_planning_plugin`, this leads to a somewhat awkward \"human-readable\" translation of \"Repeat duration s\".\r\n\r\n[combined-fields]: https://github.com/sci-bots/pygtkhelpers/blob/3a6e6d6340221c686229cd1c951d7537dae81b07/pygtkhelpers/ui/objectlist/combined_fields.py#L52\r\n[combined-fields-title]: https://github.com/sci-bots/pygtkhelpers/blob/3a6e6d6340221c686229cd1c951d7537dae81b07/pygtkhelpers/ui/objectlist/combined_fields.py#L149-L151\r\n\r\nHowever, since these names are used as dictionary keys for the associated properties, any string format will work; i.e., snake case is not necessary.\r\n\r\n# Proposed solution\r\n\r\nTo maintain backwards compatibility, the following approach is recommended:\r\n\r\n - Modify `pygtkhelpers.ui.objectlist.CombinedFields` to stop inferring title (just use name _as is_ unless `title` property is specified)\r\n     * Perhaps the following can also be included in this `pygtkhelpers` release: https://trello.com/c/Pef1mBGw\r\n - Amend existing plugin fields with \"undesirable\" titles to add a `title` property to explicitly set the displayed title, while supporting existing protocols.\r\n - For new plugins/fields use the human-readable string as the field name itself\r\n\r\nSee https://github.com/sci-bots/microdrop.droplet-planning-plugin/commit/9aea79aa4ed6ea8416b34a174c6a914e5cb957f3\r\n\r\n"}}
{"actor":{"display_login":"cfobel"}}