Skip to content

Exposing type hinted attributes for UI

Marcus Oskarsson requested to merge mo-type-hint-attr into develop

Created by: marcus-oscarsson

Adds a feature that allows any type hinted member of a HardwareObject to be exported to the UI.

A function written with type hints for instance;

def my_fancy_function(self, speed: float, num_images:int, exp_time:float, phase:PhaseEnum) -> bool: return True

can now be exported so that a default UI can be displayed to the user, once validated the data entered are passed to member in question.

Example of UI for the example below, illustrating the feature. md_th

This feature is currently used in two places, it replaces the current beamline actions in MXCuBE 3 sot that they can be expressed as objects with type hinted members. It further makes it possible to create simple maintenance UIs like the example above.

The type annotated beamline actions currently handles return data and errors like the previous beamline actions. Error handling and return data for the the pure HardwareObject version still needs to be implemented.

The feature itself is UI agnostic, its up the the UI-Application to display the exported information and ultimately call execute_exported_command once the input is validated.

Merge request reports