Skip to content

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

@cfobel

Description

@cfobel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions