Skip to content

Customizable Configuration

Some COI plugins profit from being configured in a more detailed manner than what the Configurable interface allows at the moment.

The configuration system is dependent on the runtime type of the value passed to Config.add(). It is not super clear in the code, but make_field_widget() effectively dispatches on the type of Config.Field.value and picks a widget based on the result.

Our ultimate goal is that fields with a custom configuration dialog are displayed as a triple:

  1. field label,
  2. text representation of the current value,
  3. button that opens a new dialog with which a new value can be picked.

We have furthermore the following constraints:

  • The value passed to Config.add() should be plain old data. It should be as immutable as possible and it should be valid to replace it with a new instance at any time. This helps keeping configurations transactional such that users can always cancel an uncommitted change that they don't want.
  • The value passed to Config.add() and its type should have no dependency on any specific GUI or GUI framework. This is necessary to keep plugins and GUI decoupled. This in turn helps other people write their own "host application".

Open questions

  • Do we need to add new interfaces to cernml.coi?
  • Can the Entrypoints API help?
  • How do we map from types to configuration handlers?
  • Is it convenient for plugin developers to decouple the logic in this way?
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information