From b140d3c9a8f6a4f82a691859dcab3c134b949bd9 Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Wed, 29 May 2024 10:53:16 +0200 Subject: [PATCH] fix(crosshair): wip plugin for motor selections widget --- .../motor_control/motor_combobox/__init__.py | 0 .../motor_combobox/motorcombobox.py | 0 .../selection/registerselection.py | 13 +++++ .../selection/selection.pyproject | 4 ++ .../selection/selectionplugin.py | 58 +++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 bec_widgets/widgets/motor_control/motor_combobox/__init__.py create mode 100644 bec_widgets/widgets/motor_control/motor_combobox/motorcombobox.py create mode 100644 bec_widgets/widgets/motor_control/selection/registerselection.py create mode 100644 bec_widgets/widgets/motor_control/selection/selection.pyproject create mode 100644 bec_widgets/widgets/motor_control/selection/selectionplugin.py diff --git a/bec_widgets/widgets/motor_control/motor_combobox/__init__.py b/bec_widgets/widgets/motor_control/motor_combobox/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bec_widgets/widgets/motor_control/motor_combobox/motorcombobox.py b/bec_widgets/widgets/motor_control/motor_combobox/motorcombobox.py new file mode 100644 index 00000000..e69de29b diff --git a/bec_widgets/widgets/motor_control/selection/registerselection.py b/bec_widgets/widgets/motor_control/selection/registerselection.py new file mode 100644 index 00000000..522e0847 --- /dev/null +++ b/bec_widgets/widgets/motor_control/selection/registerselection.py @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +from selection import MotorControlSelection +from selectionplugin import MotorControlSelectionPlugin + +from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection + +# Set PYSIDE_DESIGNER_PLUGINS to point to this directory and load the plugin + + +if __name__ == "__main__": + QPyDesignerCustomWidgetCollection.addCustomWidget(MotorControlSelectionPlugin()) diff --git a/bec_widgets/widgets/motor_control/selection/selection.pyproject b/bec_widgets/widgets/motor_control/selection/selection.pyproject new file mode 100644 index 00000000..308b46e1 --- /dev/null +++ b/bec_widgets/widgets/motor_control/selection/selection.pyproject @@ -0,0 +1,4 @@ +{ + "files": ["selection.py", "motor_selection_launch.py", "registertictactoe.py", "tictactoeplugin.py", + "tictactoetaskmenu.py"] +} diff --git a/bec_widgets/widgets/motor_control/selection/selectionplugin.py b/bec_widgets/widgets/motor_control/selection/selectionplugin.py new file mode 100644 index 00000000..eb85c3af --- /dev/null +++ b/bec_widgets/widgets/motor_control/selection/selectionplugin.py @@ -0,0 +1,58 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +from selection import MotorControlSelection + +from PySide6.QtGui import QIcon +from PySide6.QtDesigner import QDesignerCustomWidgetInterface + + +DOM_XML = """ + + + + +""" + + +class MotorControlSelectionPlugin(QDesignerCustomWidgetInterface): + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + t = MotorControlSelection(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "" + + def icon(self): + return QIcon() + + def includeFile(self): + return "selection" + + def initialize(self, form_editor): + self._form_editor = form_editor + # manager = form_editor.extensionManager() + # iid = TicTacToeTaskMenuFactory.task_menu_iid() + # manager.registerExtensions(TicTacToeTaskMenuFactory(manager), iid) + + def isContainer(self): + return False + + def isInitialized(self): + return self._form_editor is not None + + def name(self): + return "MotorControlSelection" + + def toolTip(self): + return "MotorControl Selection Example for BEC Widgets" + + def whatsThis(self): + return self.toolTip()