bec-widgets 0.78.1__py3-none-any.whl → 0.79.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. CHANGELOG.md +26 -26
  2. PKG-INFO +1 -1
  3. bec_widgets/cli/client.py +90 -0
  4. bec_widgets/utils/bec_designer.py +14 -12
  5. bec_widgets/utils/widget_io.py +25 -2
  6. bec_widgets/widgets/figure/plots/axis_settings.py +61 -0
  7. bec_widgets/widgets/figure/plots/axis_settings.ui +249 -0
  8. bec_widgets/widgets/figure/plots/motor_map/motor_map.py +18 -5
  9. bec_widgets/widgets/motor_map/__init__.py +0 -0
  10. bec_widgets/widgets/motor_map/assets/connection.svg +4 -0
  11. bec_widgets/widgets/motor_map/assets/history.svg +4 -0
  12. bec_widgets/widgets/motor_map/assets/motor_map.png +0 -0
  13. bec_widgets/widgets/motor_map/assets/settings.svg +4 -0
  14. bec_widgets/widgets/motor_map/bec_motor_map_widget.pyproject +1 -0
  15. bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +55 -0
  16. bec_widgets/widgets/motor_map/motor_map_dialog/__init__.py +0 -0
  17. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +73 -0
  18. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.ui +108 -0
  19. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_toolbar.py +59 -0
  20. bec_widgets/widgets/motor_map/motor_map_widget.py +235 -0
  21. bec_widgets/widgets/motor_map/register_bec_motor_map_widget.py +15 -0
  22. bec_widgets/widgets/toolbar/toolbar.py +43 -103
  23. {bec_widgets-0.78.1.dist-info → bec_widgets-0.79.1.dist-info}/METADATA +1 -1
  24. {bec_widgets-0.78.1.dist-info → bec_widgets-0.79.1.dist-info}/RECORD +28 -13
  25. pyproject.toml +1 -1
  26. {bec_widgets-0.78.1.dist-info → bec_widgets-0.79.1.dist-info}/WHEEL +0 -0
  27. {bec_widgets-0.78.1.dist-info → bec_widgets-0.79.1.dist-info}/entry_points.txt +0 -0
  28. {bec_widgets-0.78.1.dist-info → bec_widgets-0.79.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="#FFFFFF">
2
+ <path d="M0 0h24v24H0V0z" fill="none"/>
3
+ <path d="M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/>
4
+ </svg>
@@ -0,0 +1 @@
1
+ {'files': ['motor_map_widget.py','motor_map_widget_plugin.py']}
@@ -0,0 +1,55 @@
1
+ import os
2
+
3
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
4
+ from qtpy.QtGui import QIcon
5
+
6
+ from bec_widgets.widgets.motor_map.motor_map_widget import BECMotorMapWidget
7
+
8
+ DOM_XML = """
9
+ <ui language='c++'>
10
+ <widget class='BECMotorMapWidget' name='bec_motor_map_widget'>
11
+ </widget>
12
+ </ui>
13
+ """
14
+
15
+
16
+ class BECMotorMapWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
17
+ def __init__(self):
18
+ super().__init__()
19
+ self._form_editor = None
20
+
21
+ def createWidget(self, parent):
22
+ t = BECMotorMapWidget(parent)
23
+ return t
24
+
25
+ def domXml(self):
26
+ return DOM_XML
27
+
28
+ def group(self):
29
+ return "BEC Visualization Widgets"
30
+
31
+ def icon(self):
32
+ current_path = os.path.dirname(__file__)
33
+ icon_path = os.path.join(current_path, "assets", "motor_map.png")
34
+ return QIcon(icon_path)
35
+
36
+ def includeFile(self):
37
+ return "bec_motor_map_widget"
38
+
39
+ def initialize(self, form_editor):
40
+ self._form_editor = form_editor
41
+
42
+ def isContainer(self):
43
+ return False
44
+
45
+ def isInitialized(self):
46
+ return self._form_editor is not None
47
+
48
+ def name(self):
49
+ return "BECMotorMapWidget"
50
+
51
+ def toolTip(self):
52
+ return "BECMotorMapWidget"
53
+
54
+ def whatsThis(self):
55
+ return self.toolTip()
@@ -0,0 +1,73 @@
1
+ import os
2
+
3
+ from qtpy.QtCore import Slot
4
+ from qtpy.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout, QWidget
5
+
6
+ from bec_widgets.utils import UILoader
7
+ from bec_widgets.utils.widget_io import WidgetIO
8
+
9
+
10
+ class MotorMapSettings(QWidget):
11
+ def __init__(self, parent=None, target_widget: QWidget = None, *args, **kwargs):
12
+ super().__init__(parent, *args, **kwargs)
13
+ current_path = os.path.dirname(__file__)
14
+
15
+ self.ui = UILoader(self).loader(os.path.join(current_path, "motor_map_settings.ui"))
16
+ self.target_widget = target_widget
17
+
18
+ self.layout = QVBoxLayout(self)
19
+ self.layout.addWidget(self.ui)
20
+
21
+ @Slot(dict)
22
+ def display_current_settings(self, config: dict):
23
+ WidgetIO.set_value(self.ui.max_points, config["max_points"])
24
+ WidgetIO.set_value(self.ui.trace_dim, config["num_dim_points"])
25
+ WidgetIO.set_value(self.ui.precision, config["precision"])
26
+ WidgetIO.set_value(self.ui.scatter_size, config["scatter_size"])
27
+ background_intensity = int((config["background_value"] / 255) * 100)
28
+ WidgetIO.set_value(self.ui.background_value, background_intensity)
29
+ color = config["color"]
30
+ self.ui.color.setColor(color)
31
+
32
+ @Slot()
33
+ def accept_changes(self):
34
+ max_points = WidgetIO.get_value(self.ui.max_points)
35
+ num_dim_points = WidgetIO.get_value(self.ui.trace_dim)
36
+ precision = WidgetIO.get_value(self.ui.precision)
37
+ scatter_size = WidgetIO.get_value(self.ui.scatter_size)
38
+ background_intensity = int(WidgetIO.get_value(self.ui.background_value) * 0.01 * 255)
39
+ color = self.ui.color.color().toTuple()
40
+
41
+ if self.target_widget is not None:
42
+ self.target_widget.set_max_points(max_points)
43
+ self.target_widget.set_num_dim_points(num_dim_points)
44
+ self.target_widget.set_precision(precision)
45
+ self.target_widget.set_scatter_size(scatter_size)
46
+ self.target_widget.set_background_value(background_intensity)
47
+ self.target_widget.set_color(color)
48
+
49
+
50
+ class MotorMapDialog(QDialog):
51
+ def __init__(self, parent=None, target_widget: QWidget = None, *args, **kwargs):
52
+ super().__init__(parent, *args, **kwargs)
53
+
54
+ self.setModal(False)
55
+
56
+ self.setWindowTitle("Motor Map Settings")
57
+
58
+ self.target_widget = target_widget
59
+ self.widget = MotorMapSettings(target_widget=self.target_widget)
60
+ self.widget.display_current_settings(self.target_widget._config_dict)
61
+ self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
62
+
63
+ self.button_box.accepted.connect(self.accept)
64
+ self.button_box.rejected.connect(self.reject)
65
+
66
+ self.layout = QVBoxLayout(self)
67
+ self.layout.addWidget(self.widget)
68
+ self.layout.addWidget(self.button_box)
69
+
70
+ @Slot()
71
+ def accept(self):
72
+ self.widget.accept_changes()
73
+ super().accept()
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ui version="4.0">
3
+ <class>Form</class>
4
+ <widget class="QWidget" name="Form">
5
+ <property name="geometry">
6
+ <rect>
7
+ <x>0</x>
8
+ <y>0</y>
9
+ <width>243</width>
10
+ <height>233</height>
11
+ </rect>
12
+ </property>
13
+ <property name="windowTitle">
14
+ <string>Form</string>
15
+ </property>
16
+ <layout class="QGridLayout" name="gridLayout">
17
+ <item row="3" column="1">
18
+ <widget class="QSpinBox" name="scatter_size">
19
+ <property name="maximum">
20
+ <number>20</number>
21
+ </property>
22
+ </widget>
23
+ </item>
24
+ <item row="1" column="0">
25
+ <widget class="QLabel" name="trace_label">
26
+ <property name="text">
27
+ <string>Trace Dim</string>
28
+ </property>
29
+ </widget>
30
+ </item>
31
+ <item row="2" column="0">
32
+ <widget class="QLabel" name="precision_label">
33
+ <property name="text">
34
+ <string>Precision</string>
35
+ </property>
36
+ </widget>
37
+ </item>
38
+ <item row="4" column="0">
39
+ <widget class="QLabel" name="background_label">
40
+ <property name="text">
41
+ <string>Background Intensity</string>
42
+ </property>
43
+ </widget>
44
+ </item>
45
+ <item row="2" column="1">
46
+ <widget class="QSpinBox" name="precision">
47
+ <property name="maximum">
48
+ <number>15</number>
49
+ </property>
50
+ </widget>
51
+ </item>
52
+ <item row="4" column="1">
53
+ <widget class="QSpinBox" name="background_value">
54
+ <property name="maximum">
55
+ <number>100</number>
56
+ </property>
57
+ </widget>
58
+ </item>
59
+ <item row="0" column="0">
60
+ <widget class="QLabel" name="max_point_label">
61
+ <property name="text">
62
+ <string>Max Points</string>
63
+ </property>
64
+ </widget>
65
+ </item>
66
+ <item row="3" column="0">
67
+ <widget class="QLabel" name="scatter_size_label">
68
+ <property name="text">
69
+ <string>Scatter Size</string>
70
+ </property>
71
+ </widget>
72
+ </item>
73
+ <item row="0" column="1">
74
+ <widget class="QSpinBox" name="max_points">
75
+ <property name="maximum">
76
+ <number>10000</number>
77
+ </property>
78
+ </widget>
79
+ </item>
80
+ <item row="1" column="1">
81
+ <widget class="QSpinBox" name="trace_dim">
82
+ <property name="maximum">
83
+ <number>1000</number>
84
+ </property>
85
+ </widget>
86
+ </item>
87
+ <item row="5" column="0">
88
+ <widget class="QLabel" name="color_label">
89
+ <property name="text">
90
+ <string>Color</string>
91
+ </property>
92
+ </widget>
93
+ </item>
94
+ <item row="5" column="1">
95
+ <widget class="ColorButton" name="color"/>
96
+ </item>
97
+ </layout>
98
+ </widget>
99
+ <customwidgets>
100
+ <customwidget>
101
+ <class>ColorButton</class>
102
+ <extends>QPushButton</extends>
103
+ <header>color_button</header>
104
+ </customwidget>
105
+ </customwidgets>
106
+ <resources/>
107
+ <connections/>
108
+ </ui>
@@ -0,0 +1,59 @@
1
+ import os
2
+
3
+ from qtpy.QtCore import QSize
4
+ from qtpy.QtGui import QAction, QIcon
5
+ from qtpy.QtWidgets import QHBoxLayout, QLabel, QWidget
6
+
7
+ from bec_widgets.widgets.device_inputs import DeviceComboBox
8
+ from bec_widgets.widgets.toolbar.toolbar import ToolBarAction
9
+
10
+
11
+ class DeviceSelectionAction(ToolBarAction):
12
+ def __init__(self, label: str):
13
+ self.label = label
14
+ self.device_combobox = DeviceComboBox(device_filter="Positioner")
15
+
16
+ self.device_combobox.currentIndexChanged.connect(lambda: self.set_combobox_style("#ffa700"))
17
+
18
+ def add_to_toolbar(self, toolbar, target):
19
+ widget = QWidget()
20
+ layout = QHBoxLayout(widget)
21
+
22
+ label = QLabel(f"{self.label}")
23
+
24
+ layout.addWidget(label)
25
+ layout.addWidget(self.device_combobox)
26
+ toolbar.addWidget(widget)
27
+
28
+ def set_combobox_style(self, color: str):
29
+ self.device_combobox.setStyleSheet(f"QComboBox {{ background-color: {color}; }}")
30
+
31
+
32
+ class ConnectAction(ToolBarAction):
33
+ def add_to_toolbar(self, toolbar, target):
34
+ current_path = os.path.dirname(__file__)
35
+ parent_path = os.path.dirname(current_path)
36
+ icon = QIcon()
37
+ icon.addFile(os.path.join(parent_path, "assets", "connection.svg"), size=QSize(20, 20))
38
+ self.action = QAction(icon, "Connect Motors", target)
39
+ toolbar.addAction(self.action)
40
+
41
+
42
+ class ResetHistoryAction(ToolBarAction):
43
+ def add_to_toolbar(self, toolbar, target):
44
+ current_path = os.path.dirname(__file__)
45
+ parent_path = os.path.dirname(current_path)
46
+ icon = QIcon()
47
+ icon.addFile(os.path.join(parent_path, "assets", "history.svg"), size=QSize(20, 20))
48
+ self.action = QAction(icon, "Reset Trace History", target)
49
+ toolbar.addAction(self.action)
50
+
51
+
52
+ class SettingsAction(ToolBarAction):
53
+ def add_to_toolbar(self, toolbar, target):
54
+ current_path = os.path.dirname(__file__)
55
+ parent_path = os.path.dirname(current_path)
56
+ icon = QIcon()
57
+ icon.addFile(os.path.join(parent_path, "assets", "settings.svg"), size=QSize(20, 20))
58
+ self.action = QAction(icon, "Open Configuration Dialog", target)
59
+ toolbar.addAction(self.action)
@@ -0,0 +1,235 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+
5
+ from qtpy import PYSIDE6
6
+ from qtpy.QtWidgets import QVBoxLayout, QWidget
7
+
8
+ from bec_widgets.utils import BECConnector
9
+ from bec_widgets.widgets.figure import BECFigure
10
+ from bec_widgets.widgets.figure.plots.motor_map.motor_map import MotorMapConfig
11
+ from bec_widgets.widgets.motor_map.motor_map_dialog.motor_map_settings import MotorMapDialog
12
+ from bec_widgets.widgets.motor_map.motor_map_dialog.motor_map_toolbar import (
13
+ ConnectAction,
14
+ DeviceSelectionAction,
15
+ ResetHistoryAction,
16
+ SettingsAction,
17
+ )
18
+ from bec_widgets.widgets.toolbar import ModularToolBar
19
+
20
+
21
+ class BECMotorMapWidget(BECConnector, QWidget):
22
+ USER_ACCESS = [
23
+ "change_motors",
24
+ "set_max_points",
25
+ "set_precision",
26
+ "set_num_dim_points",
27
+ "set_background_value",
28
+ "set_scatter_size",
29
+ "get_data",
30
+ "reset_history",
31
+ ]
32
+
33
+ def __init__(
34
+ self,
35
+ parent: QWidget | None = None,
36
+ config: MotorMapConfig | None = None,
37
+ client=None,
38
+ gui_id: str | None = None,
39
+ ) -> None:
40
+ if not PYSIDE6:
41
+ raise RuntimeError(
42
+ "PYSIDE6 is not available in the environment. This widget is compatible only with PySide6."
43
+ )
44
+ if config is None:
45
+ config = MotorMapConfig(widget_class=self.__class__.__name__)
46
+ else:
47
+ if isinstance(config, dict):
48
+ config = MotorMapConfig(**config)
49
+ super().__init__(client=client, gui_id=gui_id)
50
+ QWidget.__init__(self, parent)
51
+
52
+ self.layout = QVBoxLayout(self)
53
+ self.layout.setSpacing(0)
54
+ self.layout.setContentsMargins(0, 0, 0, 0)
55
+
56
+ self.fig = BECFigure()
57
+ self.toolbar = ModularToolBar(
58
+ actions={
59
+ "motor_x": DeviceSelectionAction("Motor X:"),
60
+ "motor_y": DeviceSelectionAction("Motor Y:"),
61
+ "connect": ConnectAction(),
62
+ "history": ResetHistoryAction(),
63
+ "config": SettingsAction(),
64
+ },
65
+ target_widget=self,
66
+ )
67
+
68
+ self.layout.addWidget(self.toolbar)
69
+ self.layout.addWidget(self.fig)
70
+
71
+ self.map = self.fig.motor_map()
72
+ self.map.apply_config(config)
73
+
74
+ self._hook_actions()
75
+
76
+ self.config = config
77
+
78
+ def _hook_actions(self):
79
+ self.toolbar.widgets["connect"].action.triggered.connect(self._action_motors)
80
+ self.toolbar.widgets["config"].action.triggered.connect(self.show_settings)
81
+ self.toolbar.widgets["history"].action.triggered.connect(self.reset_history)
82
+
83
+ if self.map.motor_x is None and self.map.motor_y is None:
84
+ self._enable_actions(False)
85
+
86
+ def _enable_actions(self, enable: bool):
87
+ self.toolbar.widgets["config"].action.setEnabled(enable)
88
+ self.toolbar.widgets["history"].action.setEnabled(enable)
89
+
90
+ def _action_motors(self):
91
+ toolbar_x = self.toolbar.widgets["motor_x"].device_combobox
92
+ toolbar_y = self.toolbar.widgets["motor_y"].device_combobox
93
+ motor_x = toolbar_x.currentText()
94
+ motor_y = toolbar_y.currentText()
95
+ self.change_motors(motor_x, motor_y, None, None, True)
96
+ toolbar_x.setStyleSheet("QComboBox {{ background-color: " "; }}")
97
+ toolbar_y.setStyleSheet("QComboBox {{ background-color: " "; }}")
98
+
99
+ def show_settings(self) -> None:
100
+ dialog = MotorMapDialog(self, target_widget=self)
101
+ dialog.exec()
102
+
103
+ ###################################
104
+ # User Access Methods from MotorMap
105
+ ###################################
106
+
107
+ def change_motors(
108
+ self,
109
+ motor_x: str,
110
+ motor_y: str,
111
+ motor_x_entry: str = None,
112
+ motor_y_entry: str = None,
113
+ validate_bec: bool = True,
114
+ ) -> None:
115
+ """
116
+ Change the active motors for the plot.
117
+
118
+ Args:
119
+ motor_x(str): Motor name for the X axis.
120
+ motor_y(str): Motor name for the Y axis.
121
+ motor_x_entry(str): Motor entry for the X axis.
122
+ motor_y_entry(str): Motor entry for the Y axis.
123
+ validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
124
+ """
125
+ self.map.change_motors(motor_x, motor_y, motor_x_entry, motor_y_entry, validate_bec)
126
+ if self.map.motor_x is not None and self.map.motor_y is not None:
127
+ self._enable_actions(True)
128
+ toolbar_x = self.toolbar.widgets["motor_x"].device_combobox
129
+ toolbar_y = self.toolbar.widgets["motor_y"].device_combobox
130
+
131
+ if toolbar_x.currentText() != motor_x:
132
+ toolbar_x.setCurrentText(motor_x)
133
+ toolbar_x.setStyleSheet("QComboBox {{ background-color: " "; }}")
134
+ if toolbar_y.currentText() != motor_y:
135
+ toolbar_y.setCurrentText(motor_y)
136
+ toolbar_y.setStyleSheet("QComboBox {{ background-color: " "; }}")
137
+
138
+ def get_data(self) -> dict:
139
+ """
140
+ Get the data of the motor map.
141
+
142
+ Returns:
143
+ dict: Data of the motor map.
144
+ """
145
+ return self.map.get_data()
146
+
147
+ def reset_history(self) -> None:
148
+ """
149
+ Reset the history of the motor map.
150
+ """
151
+ self.map.reset_history()
152
+
153
+ def set_color(self, color: str | tuple):
154
+ """
155
+ Set the color of the motor map.
156
+
157
+ Args:
158
+ color(str, tuple): Color to set.
159
+ """
160
+ self.map.set_color(color)
161
+
162
+ def set_max_points(self, max_points: int) -> None:
163
+ """
164
+ Set the maximum number of points to display on the motor map.
165
+
166
+ Args:
167
+ max_points(int): Maximum number of points to display.
168
+ """
169
+ self.map.set_max_points(max_points)
170
+
171
+ def set_precision(self, precision: int) -> None:
172
+ """
173
+ Set the precision of the motor map.
174
+
175
+ Args:
176
+ precision(int): Precision to set.
177
+ """
178
+ self.map.set_precision(precision)
179
+
180
+ def set_num_dim_points(self, num_dim_points: int) -> None:
181
+ """
182
+ Set the number of points to display on the motor map.
183
+
184
+ Args:
185
+ num_dim_points(int): Number of points to display.
186
+ """
187
+ self.map.set_num_dim_points(num_dim_points)
188
+
189
+ def set_background_value(self, background_value: int) -> None:
190
+ """
191
+ Set the background value of the motor map.
192
+
193
+ Args:
194
+ background_value(int): Background value of the motor map.
195
+ """
196
+ self.map.set_background_value(background_value)
197
+
198
+ def set_scatter_size(self, scatter_size: int) -> None:
199
+ """
200
+ Set the scatter size of the motor map.
201
+
202
+ Args:
203
+ scatter_size(int): Scatter size of the motor map.
204
+ """
205
+ self.map.set_scatter_size(scatter_size)
206
+
207
+ def cleanup(self):
208
+ self.fig.cleanup()
209
+ self.toolbar.widgets["motor_x"].device_combobox.cleanup()
210
+ self.toolbar.widgets["motor_y"].device_combobox.cleanup()
211
+ return super().cleanup()
212
+
213
+ def closeEvent(self, event):
214
+ self.cleanup()
215
+ QWidget().closeEvent(event)
216
+
217
+
218
+ def main(): # pragma: no cover
219
+
220
+ if not PYSIDE6:
221
+ print(
222
+ "PYSIDE6 is not available in the environment. UI files with BEC custom widgets are runnable only with PySide6."
223
+ )
224
+ return
225
+
226
+ from qtpy.QtWidgets import QApplication
227
+
228
+ app = QApplication(sys.argv)
229
+ widget = BECMotorMapWidget()
230
+ widget.show()
231
+ sys.exit(app.exec_())
232
+
233
+
234
+ if __name__ == "__main__": # pragma: no cover
235
+ main()
@@ -0,0 +1,15 @@
1
+ def main(): # pragma: no cover
2
+ from qtpy import PYSIDE6
3
+
4
+ if not PYSIDE6:
5
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
6
+ return
7
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
8
+
9
+ from bec_widgets.widgets.motor_map.bec_motor_map_widget_plugin import BECMotorMapWidgetPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(BECMotorMapWidgetPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()