Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rhfogh develop Adapt to newest paramsgui changes (from jbf) #819

Merged
merged 9 commits into from
Dec 13, 2023
33 changes: 32 additions & 1 deletion mxcubecore/HardwareObjects/Beamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals

from typing import Union
from typing import Union, Any
from mxcubecore.dispatcher import dispatcher

__copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """
__license__ = "LGPLv3+"
Expand Down Expand Up @@ -239,6 +240,36 @@ def _get_id_dict_rec(

return _path


# Signal handling functions:
def emit(self, signal: Union[str, object, Any], *args) -> None:
"""Emit signal. Accepts both multiple args and a single tuple of args.

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
We need to consider how we want this organised

Args:
signal (Union[str, object, Any]): In practice a string, or dispatcher.
*args (tuple): Arguments sent with signal.
"""

signal = str(signal)

if len(args) == 1:
if isinstance(args[0], tuple):
args = args[0]
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
def all_roles(self):
Expand Down
12 changes: 6 additions & 6 deletions mxcubecore/HardwareObjects/Gphl/GphlMessages.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ def _add_scan(self, scan):

def get_initial_settings(self):
"""Get dictionary of rotation and translation motor settings for start of sweep"""
result = dict(self.goniostatSweepSetting.axisSettings)
result = self.goniostatSweepSetting.get_motor_settings()
result[self.goniostatSweepSetting.scanAxis] = self.start
#
return result
Expand Down Expand Up @@ -1053,7 +1053,7 @@ class GeometricStrategy(IdentifiedElement, Payload):

def __init__(
self,
isInterleaved,
# isInterleaved,
isUserModifiable,
defaultDetectorSetting,
defaultBeamSetting,
Expand All @@ -1067,7 +1067,7 @@ def __init__(

super().__init__(id_=id_)

self._isInterleaved = isInterleaved
# self._isInterleaved = isInterleaved
self._isUserModifiable = isUserModifiable
self._defaultDetectorSetting = defaultDetectorSetting
self._defaultBeamSetting = defaultBeamSetting
Expand All @@ -1084,9 +1084,9 @@ def __init__(
self._sweepOffset = sweepOffset
self._sweepRepeat = sweepRepeat

@property
def isInterleaved(self):
return self._isInterleaved
# @property
# def isInterleaved(self):
# return self._isInterleaved

@property
def sweepRepeat(self):
Expand Down
Loading