From d2804995ec2ba696fc2f75c90e3a9a10e43a0dc8 Mon Sep 17 00:00:00 2001 From: rhfogh Date: Mon, 20 Nov 2023 18:12:27 +0000 Subject: [PATCH] Adapted to latest mxcubecore develop, and changed GUI signal to function call --- mxcubecore/HardwareObjects/Beamline.py | 14 +++++++------- mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py | 17 +++-------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/mxcubecore/HardwareObjects/Beamline.py b/mxcubecore/HardwareObjects/Beamline.py index f82b21113e..bbffba94f1 100644 --- a/mxcubecore/HardwareObjects/Beamline.py +++ b/mxcubecore/HardwareObjects/Beamline.py @@ -237,17 +237,13 @@ def emit(self, signal: Union[str, object, Any], *args) -> None: This is needed for communication from the GUI to the core (jsonparamsgui in mxcubeqt) + NBNB TODO HACK This is a duplicate of the same function in HardwareObjectMixin. Since the Beamline is not a CommandContainer or a normal HardwareObject - It may not be appropriate to make it a subclass of HardwareObjectYaml + it may not be appropriate to make it a subclass of HardwareObjectYaml We need to consider how we want this organised - TODO: This function would be unnecessary if all callers used - ```python - dispatcher.send(signal, self, *argtuple) - ``` - Args: signal (Union[str, object, Any]): In practice a string, or dispatcher. *args (tuple): Arguments sent with signal. @@ -258,7 +254,11 @@ def emit(self, signal: Union[str, object, Any], *args) -> None: if len(args) == 1: if isinstance(args[0], tuple): args = args[0] - dispatcher.send(signal, self, *args) + responses: list = dispatcher.send(signal, self, *args) + if not responses: + raise RuntimeError( + "Signal %s is not connected" % signal + ) # NB this function must be re-implemented in nested subclasses @property diff --git a/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py b/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py index 79ab0b3ef7..b0cc6a10cd 100644 --- a/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py +++ b/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py @@ -400,7 +400,6 @@ def query_pre_strategy_params(self, choose_lattice=None): "type": "string", "default": point_group, "enum": point_groups, - "hidden": not choose_lattice, } sglist = [""] + crystal_symmetry.space_groups_from_params( point_groups=point_groups @@ -452,7 +451,6 @@ def query_pre_strategy_params(self, choose_lattice=None): "title": "Workflow type", "type": "string", "default": "GphlWorkflow", - "readOnly": True, } # ) # Handle strategy fields @@ -513,7 +511,6 @@ def query_pre_strategy_params(self, choose_lattice=None): # NB update_on_change supports None, "always", and "selected" # It controls whether an update signal is sent when a parameter changes ui_schema = { - "wf_type": {"ui:widget": "hidden"}, "ui:order": ["crystal_data", "parameters"], "ui:widget": "vertical_box", "ui:options": { @@ -603,7 +600,7 @@ def query_pre_strategy_params(self, choose_lattice=None): fields[tag]["readOnly"] = False ui_schema["parameters"]["column1"]["ui:order"].remove("point_groups") - elif choose_lattice is None: + elif not choose_lattice: # Characterisation ui_schema["parameters"]["column1"]["ui:order"].remove("point_groups") pass @@ -1006,13 +1003,9 @@ def query_collection_strategy(self, geometric_strategy): # Set up image width pulldown allowed_widths = geometric_strategy.allowedWidths - if allowed_widths: - default_width_index = geometric_strategy.defaultWidthIdx or 0 - else: + if not allowed_widths: allowed_widths = list(self.settings.get("default_image_widths")) - val = allowed_widths[0] allowed_widths.sort() - default_width_index = allowed_widths.index(val) logging.getLogger("HWR").info( "No allowed image widths returned by strategy - use defaults" ) @@ -1073,7 +1066,6 @@ def query_collection_strategy(self, geometric_strategy): "title": "Workflow type", "type": "string", "default": "GphlWorkflow", - "readOnly": True, } # # From here on visible fields fields["_info"] = { @@ -1086,7 +1078,7 @@ def query_collection_strategy(self, geometric_strategy): "title": "Oscillation range", "type": "string", "default": str(default_image_width), - "enum": allowed_widths + "enum": list(str(val) for val in allowed_widths) } fields["exposure"] = { "title": "Exposure Time (s)", @@ -1206,7 +1198,6 @@ def query_collection_strategy(self, geometric_strategy): } ui_schema = { - "wf_type": {"ui:widget": "hidden"}, "ui:order": ["_info", "parameters"], "ui:widget": "vertical_box", "ui:options": { @@ -2274,7 +2265,6 @@ def process_centring_request(self, payload, correlation_id): "title": "Workflow type", "type": "string", "default": "GphlWorkflow", - "readOnly": True, } fields["_info"] = { "type": "textdisplay", @@ -2282,7 +2272,6 @@ def process_centring_request(self, payload, correlation_id): "readOnly": True, } ui_schema = { - "wf_type": {"ui:widget": "hidden"}, "ui:order": ["_info"], "ui:widget": "vertical_box", "ui:options": {