diff --git a/bec_widgets/widgets/motor_map/assets/motor_map.png b/bec_widgets/widgets/motor_map/assets/motor_map.png new file mode 100644 index 00000000..8446cfe0 Binary files /dev/null and b/bec_widgets/widgets/motor_map/assets/motor_map.png differ diff --git a/bec_widgets/widgets/motor_map/bec_motor_map_widget.pyproject b/bec_widgets/widgets/motor_map/bec_motor_map_widget.pyproject new file mode 100644 index 00000000..ceca50a1 --- /dev/null +++ b/bec_widgets/widgets/motor_map/bec_motor_map_widget.pyproject @@ -0,0 +1 @@ +{'files': ['motor_map_widget.py','motor_map_widget_plugin.py']} \ No newline at end of file diff --git a/bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py b/bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py new file mode 100644 index 00000000..f4c0aa85 --- /dev/null +++ b/bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py @@ -0,0 +1,55 @@ +import os + +from qtpy.QtDesigner import QDesignerCustomWidgetInterface +from qtpy.QtGui import QIcon + +from bec_widgets.widgets.motor_map.motor_map_widget import BECMotorMapWidget + +DOM_XML = """ + + + + +""" + + +class BECMotorMapWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover + def __init__(self): + super().__init__() + self._form_editor = None + + def createWidget(self, parent): + t = BECMotorMapWidget(parent) + return t + + def domXml(self): + return DOM_XML + + def group(self): + return "BEC Visualization Widgets" + + def icon(self): + current_path = os.path.dirname(__file__) + icon_path = os.path.join(current_path, "assets", "motor_map.png") + return QIcon(icon_path) + + def includeFile(self): + return "bec_motor_map_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 "BECMotorMapWidget" + + def toolTip(self): + return "BECMotorMapWidget" + + def whatsThis(self): + return self.toolTip() diff --git a/bec_widgets/widgets/motor_map/register_bec_motor_map_widget.py b/bec_widgets/widgets/motor_map/register_bec_motor_map_widget.py new file mode 100644 index 00000000..adc4dd9c --- /dev/null +++ b/bec_widgets/widgets/motor_map/register_bec_motor_map_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 bec_widgets.widgets.motor_map.bec_motor_map_widget_plugin import BECMotorMapWidgetPlugin + + QPyDesignerCustomWidgetCollection.addCustomWidget(BECMotorMapWidgetPlugin()) + + +if __name__ == "__main__": # pragma: no cover + main()