UI Classes

Setting

The setting.py module has a hierarchy of Settings.

Setting Class Diagram

Base Settings just have a default value, whereas Simple Settings have a name, a label, a documentation string and a units string.

All forms, toolbars and toolpanes use groups of Settings appropriate to the objects they are managing.

Most Settings have a get_tool() method that returns a tool object more focused on rendering the setting.

Ultimately, the jinja2 macros in toolpane_macros.html are responsible for rendering the setting in an appropriate way for the user interface i.e. html.

Camera Settings

Camera Settings Class Diagram

Camera Settings are organised in a hierarchy for extensibility. This is similar to the camera hierarchy, however, cameras are spread over multiple modules i.e. cameras.py, lincameras.py and wincameras.py so only the relevant classes are imported.

Morphable

The Morphable class is responsible for converting objects into different formats e.g. xml, json. All the classes in the forms folder inherit from Morphable, and each represents a facet of the configuration. If we want to edit an element in the xml configuration we first have to identify the class that mirrors that element, and instantiate it. Then we can use Morphable to populate and render it as a form. When we save, the client Javascript assembles a Json dictionary which is sent to the server via a url that identifies the target element. Again the matching class is instantiated, which can emit an updated xml node.