diff --git a/pxii_bec/bec_widgets/widgets/client.py b/pxii_bec/bec_widgets/widgets/client.py index db67679..ec1bfbc 100644 --- a/pxii_bec/bec_widgets/widgets/client.py +++ b/pxii_bec/bec_widgets/widgets/client.py @@ -14,6 +14,7 @@ logger = bec_logger.logger _Widgets = { "PxIIActorConfigWiget": "PxIIActorConfigWiget", + "PxIISampleQueueWidget": "PxIISampleQueueWidget", "PxIISpreadsheetDisplay": "PxIISpreadsheetDisplay", "PxIITaskPanel": "PxIITaskPanel", "PxIITaskQueueWidget": "PxIITaskQueueWidget", @@ -31,6 +32,22 @@ class PxIIActorConfigWiget(RPCBase): """ +class PxIISampleQueueWidget(RPCBase): + _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported" + + @rpc_call + def refresh(self): + """ + Reload the queued samples from Redis. + """ + + @rpc_call + def clear_queue(self): + """ + Delete the queue contents + """ + + class PxIISpreadsheetDisplay(RPCBase): _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported" @@ -72,6 +89,12 @@ class PxIITaskQueueWidget(RPCBase): Reload the queued tasks from Redis. """ + @rpc_call + def clear_queue(self): + """ + Delete the queue contents + """ + class ScanHistory(RPCBase): _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.scan_history.scan_history" diff --git a/pxii_bec/bec_widgets/widgets/designer_plugins.py b/pxii_bec/bec_widgets/widgets/designer_plugins.py index 7b4a3e1..c19874e 100644 --- a/pxii_bec/bec_widgets/widgets/designer_plugins.py +++ b/pxii_bec/bec_widgets/widgets/designer_plugins.py @@ -6,6 +6,7 @@ from __future__ import annotations designer_plugins = { "PxIIActorConfigWiget": ("pxii_bec.bec_widgets.widgets.imported", "PxIIActorConfigWiget"), + "PxIISampleQueueWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIISampleQueueWidget"), "PxIISpreadsheetDisplay": ("pxii_bec.bec_widgets.widgets.imported", "PxIISpreadsheetDisplay"), "PxIITaskPanel": ("pxii_bec.bec_widgets.widgets.imported", "PxIITaskPanel"), "PxIITaskQueueWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIITaskQueueWidget"), @@ -14,6 +15,7 @@ designer_plugins = { widget_icons = { "PxIIActorConfigWiget": "format_list_bulleted", + "PxIISampleQueueWidget": "pending_actions", "PxIISpreadsheetDisplay": "format_list_bulleted", "PxIITaskPanel": "play_arrow", "PxIITaskQueueWidget": "pending_actions", diff --git a/pxii_bec/bec_widgets/widgets/imported.py b/pxii_bec/bec_widgets/widgets/imported.py index 6b7b3cb..59cb071 100644 --- a/pxii_bec/bec_widgets/widgets/imported.py +++ b/pxii_bec/bec_widgets/widgets/imported.py @@ -1,7 +1,10 @@ -from mx_bec.bec_widgets.widgets.aare_bec.actors_config import MxActorConfigWidget -from mx_bec.bec_widgets.widgets.aare_bec.sample_spreadsheet_display import SampleSpreadsheetDisplay -from mx_bec.bec_widgets.widgets.aare_bec.task_panel import MxTaskPanel -from mx_bec.bec_widgets.widgets.aare_bec.task_queue import MxTaskQueueWidget +from mx_bec.bec_widgets.widgets.aare_bec import ( + MxActorConfigWidget, + MxTaskPanel, + MxTaskQueueWidget, + SampleQueueWidget, + SampleSpreadsheetDisplay, +) class PxIIActorConfigWiget(MxActorConfigWidget): ... @@ -10,6 +13,9 @@ class PxIIActorConfigWiget(MxActorConfigWidget): ... class PxIITaskQueueWidget(MxTaskQueueWidget): ... +class PxIISampleQueueWidget(SampleQueueWidget): ... + + class PxIITaskPanel(MxTaskPanel): ... diff --git a/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py new file mode 100644 index 0000000..8868fa0 --- /dev/null +++ b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py @@ -0,0 +1,57 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +from qtpy.QtDesigner import QDesignerCustomWidgetInterface +from qtpy.QtWidgets import QWidget + +from bec_widgets.utils.bec_designer import designer_material_icon +from pxii_bec.bec_widgets.widgets.imported import PxIISampleQueueWidget + +DOM_XML = """ + + + + +""" + + +class PxIISampleQueueWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxIISampleQueueWidget(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxIISampleQueueWidget.ICON_NAME) + + def includeFile(self): + return "px_ii_sample_queue_widget" + + def initialize(self, form_editor): + self._form_editor = form_editor + + def isContainer(self): + return False + + def isInitialized(self): + return self._form_editor is not None + + def name(self): + return "PxIISampleQueueWidget" + + def toolTip(self): + return "PxIISampleQueueWidget" + + def whatsThis(self): + return self.toolTip() diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py b/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py new file mode 100644 index 0000000..effa8d7 --- /dev/null +++ b/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py @@ -0,0 +1,15 @@ +def main(): # pragma: no cover + from qtpy import PYSIDE6 + + if not PYSIDE6: + print("PYSIDE6 is not available in the environment. Cannot patch designer.") + return + from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection + + from pxii_bec.bec_widgets.widgets.px_ii_sample_queue_widget_plugin import PxIISampleQueueWidgetPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxIISampleQueueWidgetPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxii_bec/messages.py b/pxii_bec/messages.py index faaeee5..5cefdde 100644 --- a/pxii_bec/messages.py +++ b/pxii_bec/messages.py @@ -3,14 +3,16 @@ find them through the `bec.messages` entry point registered by this package.""" from mx_bec.messages import ( MXMeasurementSequenceMessage, + MXQueueChangedMessage, + MXSampleExecutionMessage, MXTaskExecutionMessage, - MXTaskQueueChangedMessage, OpticalPredictionMessage, ) __all__ = [ "MXMeasurementSequenceMessage", "MXTaskExecutionMessage", - "MXTaskQueueChangedMessage", + "MXSampleExecutionMessage", + "MXQueueChangedMessage", "OpticalPredictionMessage", ]