diff --git a/pxi_bec/bec_widgets/widgets/client.py b/pxi_bec/bec_widgets/widgets/client.py new file mode 100644 index 0000000..a5d5231 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/client.py @@ -0,0 +1,101 @@ +# This file was automatically generated by generate_cli.py +# type: ignore + +from __future__ import annotations + +from bec_lib.logger import bec_logger + +from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call, rpc_timeout + +logger = bec_logger.logger + +# pylint: skip-file + + +_Widgets = { + "PxIActorConfigWidget": "PxIActorConfigWidget", + "PxISampleQueueWidget": "PxISampleQueueWidget", + "PxISpreadsheetDisplay": "PxISpreadsheetDisplay", + "PxITaskPanel": "PxITaskPanel", + "PxITaskQueueWidget": "PxITaskQueueWidget", +} + + +class PxIActorConfigWidget(RPCBase): + _IMPORT_MODULE = "pxi_bec.bec_widgets.widgets.imported" + + @rpc_call + def refresh(self): + """ + Reset the layout for currently loaded actors + """ + + +class PxISampleQueueWidget(RPCBase): + _IMPORT_MODULE = "pxi_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 PxISpreadsheetDisplay(RPCBase): + _IMPORT_MODULE = "pxi_bec.bec_widgets.widgets.imported" + + @rpc_call + def remove(self): + """ + Cleanup the BECConnector + """ + + @rpc_call + def attach(self): + """ + None + """ + + @rpc_call + def detach(self): + """ + Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget. + """ + + +class PxITaskPanel(RPCBase): + _IMPORT_MODULE = "pxi_bec.bec_widgets.widgets.imported" + + @rpc_call + def request_task(self, name: "str", *args, **kwargs): + """ + Submit a task request to the AareBec service. + """ + + +class PxITaskQueueWidget(RPCBase): + _IMPORT_MODULE = "pxi_bec.bec_widgets.widgets.imported" + + @rpc_call + def refresh(self): + """ + Reload the queued tasks from Redis. + """ + + @rpc_call + def clear_queue(self): + """ + Delete the queue contents + """ + + @rpc_call + def start_queue(self): + """ + Try to start the queue + """ diff --git a/pxi_bec/bec_widgets/widgets/designer_plugins.py b/pxi_bec/bec_widgets/widgets/designer_plugins.py new file mode 100644 index 0000000..f4051f0 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/designer_plugins.py @@ -0,0 +1,21 @@ +# This file was automatically generated by generate_cli.py +# type: ignore +from __future__ import annotations + +# pylint: skip-file + +designer_plugins = { + "PxIActorConfigWidget": ("pxi_bec.bec_widgets.widgets.imported", "PxIActorConfigWidget"), + "PxISampleQueueWidget": ("pxi_bec.bec_widgets.widgets.imported", "PxISampleQueueWidget"), + "PxISpreadsheetDisplay": ("pxi_bec.bec_widgets.widgets.imported", "PxISpreadsheetDisplay"), + "PxITaskPanel": ("pxi_bec.bec_widgets.widgets.imported", "PxITaskPanel"), + "PxITaskQueueWidget": ("pxi_bec.bec_widgets.widgets.imported", "PxITaskQueueWidget"), +} + +widget_icons = { + "PxIActorConfigWidget": "format_list_bulleted", + "PxISampleQueueWidget": "pending_actions", + "PxISpreadsheetDisplay": "format_list_bulleted", + "PxITaskPanel": "play_arrow", + "PxITaskQueueWidget": "pending_actions", +} diff --git a/pxi_bec/bec_widgets/widgets/imported.py b/pxi_bec/bec_widgets/widgets/imported.py new file mode 100644 index 0000000..256f324 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/imported.py @@ -0,0 +1,22 @@ +from mx_bec.bec_widgets.widgets.aare_bec import ( + MxActorConfigWidget, + MxTaskPanel, + MxTaskQueueWidget, + SampleQueueWidget, + SampleSpreadsheetDisplay, +) + + +class PxIActorConfigWidget(MxActorConfigWidget): ... + + +class PxITaskQueueWidget(MxTaskQueueWidget): ... + + +class PxISampleQueueWidget(SampleQueueWidget): ... + + +class PxITaskPanel(MxTaskPanel): ... + + +class PxISpreadsheetDisplay(SampleSpreadsheetDisplay): ... diff --git a/pxi_bec/bec_widgets/widgets/px_i_actor_config_widget.pyproject b/pxi_bec/bec_widgets/widgets/px_i_actor_config_widget.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_actor_config_widget.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxi_bec/bec_widgets/widgets/px_i_actor_config_widget_plugin.py b/pxi_bec/bec_widgets/widgets/px_i_actor_config_widget_plugin.py new file mode 100644 index 0000000..61f1093 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_actor_config_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 pxi_bec.bec_widgets.widgets.imported import PxIActorConfigWidget + +DOM_XML = """ + + + + +""" + + +class PxIActorConfigWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxIActorConfigWidget(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxIActorConfigWidget.ICON_NAME) + + def includeFile(self): + return "px_i_actor_config_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 "PxIActorConfigWidget" + + def toolTip(self): + return "PxIActorConfigWidget" + + def whatsThis(self): + return self.toolTip() diff --git a/pxi_bec/bec_widgets/widgets/px_i_sample_queue_widget.pyproject b/pxi_bec/bec_widgets/widgets/px_i_sample_queue_widget.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_sample_queue_widget.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxi_bec/bec_widgets/widgets/px_i_sample_queue_widget_plugin.py b/pxi_bec/bec_widgets/widgets/px_i_sample_queue_widget_plugin.py new file mode 100644 index 0000000..5215164 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_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 pxi_bec.bec_widgets.widgets.imported import PxISampleQueueWidget + +DOM_XML = """ + + + + +""" + + +class PxISampleQueueWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxISampleQueueWidget(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxISampleQueueWidget.ICON_NAME) + + def includeFile(self): + return "px_i_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 "PxISampleQueueWidget" + + def toolTip(self): + return "PxISampleQueueWidget" + + def whatsThis(self): + return self.toolTip() diff --git a/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display.pyproject b/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display_plugin.py b/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display_plugin.py new file mode 100644 index 0000000..bde03d0 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_spreadsheet_display_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 pxi_bec.bec_widgets.widgets.imported import PxISpreadsheetDisplay + +DOM_XML = """ + + + + +""" + + +class PxISpreadsheetDisplayPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxISpreadsheetDisplay(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxISpreadsheetDisplay.ICON_NAME) + + def includeFile(self): + return "px_i_spreadsheet_display" + + 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 "PxISpreadsheetDisplay" + + def toolTip(self): + return "PxISpreadsheetDisplay" + + def whatsThis(self): + return self.toolTip() diff --git a/pxi_bec/bec_widgets/widgets/px_i_task_panel.pyproject b/pxi_bec/bec_widgets/widgets/px_i_task_panel.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_task_panel.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxi_bec/bec_widgets/widgets/px_i_task_panel_plugin.py b/pxi_bec/bec_widgets/widgets/px_i_task_panel_plugin.py new file mode 100644 index 0000000..4467f9f --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_task_panel_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 pxi_bec.bec_widgets.widgets.imported import PxITaskPanel + +DOM_XML = """ + + + + +""" + + +class PxITaskPanelPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxITaskPanel(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxITaskPanel.ICON_NAME) + + def includeFile(self): + return "px_i_task_panel" + + 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 "PxITaskPanel" + + def toolTip(self): + return "PxITaskPanel" + + def whatsThis(self): + return self.toolTip() diff --git a/pxi_bec/bec_widgets/widgets/px_i_task_queue_widget.pyproject b/pxi_bec/bec_widgets/widgets/px_i_task_queue_widget.pyproject new file mode 100644 index 0000000..4cbb48d --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_task_queue_widget.pyproject @@ -0,0 +1 @@ +{'files': ['imported.py']} \ No newline at end of file diff --git a/pxi_bec/bec_widgets/widgets/px_i_task_queue_widget_plugin.py b/pxi_bec/bec_widgets/widgets/px_i_task_queue_widget_plugin.py new file mode 100644 index 0000000..0f25f07 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/px_i_task_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 pxi_bec.bec_widgets.widgets.imported import PxITaskQueueWidget + +DOM_XML = """ + + + + +""" + + +class PxITaskQueueWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + if parent is None: + return QWidget() + t = PxITaskQueueWidget(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return designer_material_icon(PxITaskQueueWidget.ICON_NAME) + + def includeFile(self): + return "px_i_task_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 "PxITaskQueueWidget" + + def toolTip(self): + return "PxITaskQueueWidget" + + def whatsThis(self): + return self.toolTip() diff --git a/pxi_bec/bec_widgets/widgets/register_px_i_actor_config_widget.py b/pxi_bec/bec_widgets/widgets/register_px_i_actor_config_widget.py new file mode 100644 index 0000000..8b0a014 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/register_px_i_actor_config_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 pxi_bec.bec_widgets.widgets.px_i_actor_config_widget_plugin import PxIActorConfigWidgetPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxIActorConfigWidgetPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxi_bec/bec_widgets/widgets/register_px_i_sample_queue_widget.py b/pxi_bec/bec_widgets/widgets/register_px_i_sample_queue_widget.py new file mode 100644 index 0000000..62e2956 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/register_px_i_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 pxi_bec.bec_widgets.widgets.px_i_sample_queue_widget_plugin import PxISampleQueueWidgetPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxISampleQueueWidgetPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxi_bec/bec_widgets/widgets/register_px_i_spreadsheet_display.py b/pxi_bec/bec_widgets/widgets/register_px_i_spreadsheet_display.py new file mode 100644 index 0000000..0aa145c --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/register_px_i_spreadsheet_display.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 pxi_bec.bec_widgets.widgets.px_i_spreadsheet_display_plugin import PxISpreadsheetDisplayPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxISpreadsheetDisplayPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxi_bec/bec_widgets/widgets/register_px_i_task_panel.py b/pxi_bec/bec_widgets/widgets/register_px_i_task_panel.py new file mode 100644 index 0000000..05bbf34 --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/register_px_i_task_panel.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 pxi_bec.bec_widgets.widgets.px_i_task_panel_plugin import PxITaskPanelPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxITaskPanelPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxi_bec/bec_widgets/widgets/register_px_i_task_queue_widget.py b/pxi_bec/bec_widgets/widgets/register_px_i_task_queue_widget.py new file mode 100644 index 0000000..9f1713c --- /dev/null +++ b/pxi_bec/bec_widgets/widgets/register_px_i_task_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 pxi_bec.bec_widgets.widgets.px_i_task_queue_widget_plugin import PxITaskQueueWidgetPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(PxITaskQueueWidgetPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main() diff --git a/pxi_bec/messages.py b/pxi_bec/messages.py new file mode 100644 index 0000000..5cefdde --- /dev/null +++ b/pxi_bec/messages.py @@ -0,0 +1,18 @@ +"""Message types of the MX plugins, re-exported from mx_bec so that BEC's message decoder can +find them through the `bec.messages` entry point registered by this package.""" + +from mx_bec.messages import ( + MXMeasurementSequenceMessage, + MXQueueChangedMessage, + MXSampleExecutionMessage, + MXTaskExecutionMessage, + OpticalPredictionMessage, +) + +__all__ = [ + "MXMeasurementSequenceMessage", + "MXTaskExecutionMessage", + "MXSampleExecutionMessage", + "MXQueueChangedMessage", + "OpticalPredictionMessage", +]