Skip to content

Commit

Permalink
Adapted to latest mxcubecore develop, and changed GUI signal to funct…
Browse files Browse the repository at this point in the history
…ion call
  • Loading branch information
rhfogh committed Nov 21, 2023
1 parent 2de67b4 commit d280499
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
14 changes: 7 additions & 7 deletions mxcubecore/HardwareObjects/Beamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
17 changes: 3 additions & 14 deletions mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -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"] = {
Expand All @@ -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)",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -2274,15 +2265,13 @@ def process_centring_request(self, payload, correlation_id):
"title": "Workflow type",
"type": "string",
"default": "GphlWorkflow",
"readOnly": True,
}
fields["_info"] = {
"type": "textdisplay",
"default": info_text,
"readOnly": True,
}
ui_schema = {
"wf_type": {"ui:widget": "hidden"},
"ui:order": ["_info"],
"ui:widget": "vertical_box",
"ui:options": {
Expand Down

0 comments on commit d280499

Please sign in to comment.