Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugins): explicit human-readable step/app field names #259

Open
cfobel opened this issue Aug 29, 2018 · 0 comments
Open

fix(plugins): explicit human-readable step/app field names #259

cfobel opened this issue Aug 29, 2018 · 0 comments

Comments

@cfobel
Copy link
Contributor

cfobel commented Aug 29, 2018

Most step/app field names are in snake_case, i.e., "lower_case_with_underscores". The pygtkhelpers.ui.objectlist.CombinedFields __init__ method assumes a snake case field name and infers a human-readable column title:

...
default_title = re.sub(r'_', ' ', field_name.name).capitalize()
# Use custom column heading/title, if available.
title = field_name.properties.get('title', default_title)
...

In 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".

However, since these names are used as dictionary keys for the associated properties, any string format will work; i.e., snake case is not necessary.

Proposed solution

To maintain backwards compatibility, the following approach is recommended:

  • Modify pygtkhelpers.ui.objectlist.CombinedFields to stop inferring title (just use name as is unless title property is specified)
  • Amend existing plugin fields with "undesirable" titles to add a title property to explicitly set the displayed title, while supporting existing protocols.
  • For new plugins/fields use the human-readable string as the field name itself

See also

cfobel added a commit that referenced this issue Aug 30, 2018
Prior to this commit, the case of some column titles corresponding to
electrode controller plugin step fields were mangled in the protocol grid.
For example, `'Frequency (Hz)'` became `'Frequency (hz)'` (note that `Hz`
became `hz`).

In this commit, explicitly set the field title (using the [`'title'`
property][1]) to prevent case mangling.

See also: #259

[1]: https://github.com/sci-bots/pygtkhelpers/blob/3a6e6d6340221c686229cd1c951d7537dae81b07/pygtkhelpers/ui/objectlist/combined_fields.py#L150-L151
cfobel added a commit to sci-bots/microdrop-exe that referenced this issue Aug 30, 2018
Prior to this commit, if an error occurred during an electrode controller
actuation, an error dialog was displayed.  However, in some cases a user
may want to continue even if an error occurs, e.g., if a DropBot is not
connected.

In this commit, update MicroDrop to 2.28.2, which displays a warning
dialog if an error occurs during an electrode controller actuation, where
the user has the option of ignoring the error.  Also, update plugins to
fix human-readable column titles in the protocol grid (see
sci-bots/microdrop#259).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant