Skip to content
Snippets Groups Projects
Commit cd39e039 authored by David Hammer's avatar David Hammer
Browse files

Karabo 2.10 does not allow slotName for KARABO_SLOT

parent 8b5870a9
No related branches found
No related tags found
2 merge requests!12Snapshot: field test deployed version as of end of run 202201,!3Base correction device, CalCat interaction, DSSC and AGIPD devices
...@@ -32,6 +32,8 @@ from karabo.bound import ( ...@@ -32,6 +32,8 @@ from karabo.bound import (
) )
from karabo.common.api import KARABO_SCHEMA_DISPLAY_TYPE_SCENES as DT_SCENES from karabo.common.api import KARABO_SCHEMA_DISPLAY_TYPE_SCENES as DT_SCENES
from karabo.common.states import State from karabo.common.states import State
from karabo import version as karaboVersion
from pkg_resources import parse_version
from . import scenes, shmem_utils, utils from . import scenes, shmem_utils, utils
from ._version import version as deviceVersion from ._version import version as deviceVersion
...@@ -460,31 +462,32 @@ class BaseCorrection(PythonDevice): ...@@ -460,31 +462,32 @@ class BaseCorrection(PythonDevice):
) )
self._last_processing_started = 0 # not input handler should put timestamp self._last_processing_started = 0 # not input handler should put timestamp
self._rate_update_timer = utils.RepeatingTimer( self._rate_update_timer = utils.RepeatingTimer(
interval=0.5, interval=1,
callback=self._update_rate_and_state, callback=self._update_rate_and_state,
) )
self._buffer_lock = threading.Lock() self._buffer_lock = threading.Lock()
self.KARABO_SLOT(self.loadMostRecentConstants) self.KARABO_SLOT(self.loadMostRecentConstants)
self.KARABO_SLOT(self.requestScene) self.KARABO_SLOT(self.requestScene)
# TODO: the CalCatFriend could add these for us if parse_version(karaboVersion) >= parse_version("2.11"):
# note: overly complicated slot function creation necessary for closure to work # TODO: the CalCatFriend could add these for us
def make_wrapper_capturing_constant(constant): # note: overly complicated slot function creation necessary for closure to work
def aux(): def make_wrapper_capturing_constant(constant):
self.calcat_friend.get_specific_constant_version_and_call_me_back( def aux():
constant, self._load_constant_to_gpu self.calcat_friend.get_specific_constant_version_and_call_me_back(
constant, self._load_constant_to_gpu
)
return aux
for constant in self._constant_enum_class:
slot_name = f"foundConstants.{constant.name}.overrideConstantVersion"
meth_name = slot_name.replace(".", "_")
self.KARABO_SLOT(
make_wrapper_capturing_constant(constant),
slotName=meth_name,
) )
return aux
for constant in self._constant_enum_class:
slot_name = f"foundConstants.{constant.name}.overrideConstantVersion"
meth_name = slot_name.replace(".", "_")
self.KARABO_SLOT(
make_wrapper_capturing_constant(constant),
slotName=meth_name,
)
def preReconfigure(self, config): def preReconfigure(self, config):
for ts_path in ( for ts_path in (
"constantParameters.deviceMappingSnapshotAt", "constantParameters.deviceMappingSnapshotAt",
......
...@@ -25,6 +25,8 @@ from karabo.bound import ( ...@@ -25,6 +25,8 @@ from karabo.bound import (
STRING_ELEMENT, STRING_ELEMENT,
UINT32_ELEMENT, UINT32_ELEMENT,
) )
from karabo import version as karaboVersion
from pkg_resources import parse_version
from . import utils from . import utils
...@@ -91,11 +93,14 @@ def _add_status_schema_from_enum(schema, prefix, enum_class): ...@@ -91,11 +93,14 @@ def _add_status_schema_from_enum(schema, prefix, enum_class):
.defaultValue("") .defaultValue("")
.reconfigurable() .reconfigurable()
.commit(), .commit(),
SLOT_ELEMENT(schema)
.key(f"{constant_node}.overrideConstantVersion")
.displayedName("Override constant version")
.commit(),
) )
if parse_version(karaboVersion) >= parse_version("2.11"):
(
SLOT_ELEMENT(schema)
.key(f"{constant_node}.overrideConstantVersion")
.displayedName("Override constant version")
.commit(),
)
class DetectorStandin(typing.NamedTuple): class DetectorStandin(typing.NamedTuple):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment