bec-widgets 0.90.0__py3-none-any.whl → 0.92.0__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 (94) hide show
  1. CHANGELOG.md +34 -34
  2. PKG-INFO +1 -1
  3. bec_widgets/assets/app_icons/BEC-Dark.png +0 -0
  4. bec_widgets/assets/designer_icons/code.png +0 -0
  5. bec_widgets/assets/designer_icons/color_button.png +0 -0
  6. bec_widgets/assets/designer_icons/device_box.png +0 -0
  7. bec_widgets/assets/designer_icons/device_combo_box.png +0 -0
  8. bec_widgets/assets/designer_icons/device_line_edit.png +0 -0
  9. bec_widgets/assets/designer_icons/dock_area.png +0 -0
  10. bec_widgets/assets/designer_icons/games.png +0 -0
  11. bec_widgets/assets/designer_icons/position_indicator.png +0 -0
  12. bec_widgets/assets/designer_icons/queue.png +0 -0
  13. bec_widgets/assets/designer_icons/ring_progress.png +0 -0
  14. bec_widgets/assets/designer_icons/scan_control.png +0 -0
  15. bec_widgets/assets/designer_icons/spinner.png +0 -0
  16. bec_widgets/assets/designer_icons/status.png +0 -0
  17. bec_widgets/assets/designer_icons/stop.png +0 -0
  18. bec_widgets/assets/designer_icons/text.png +0 -0
  19. bec_widgets/assets/designer_icons/toggle.png +0 -0
  20. bec_widgets/assets/designer_icons/web.png +0 -0
  21. bec_widgets/assets/status_icons/error.svg +3 -0
  22. bec_widgets/assets/status_icons/not_connected.svg +3 -0
  23. bec_widgets/assets/status_icons/refresh.svg +3 -0
  24. bec_widgets/assets/status_icons/running.svg +3 -0
  25. bec_widgets/assets/status_icons/warning.svg +3 -0
  26. bec_widgets/assets/toolbar_icons/attach_all.svg +3 -0
  27. bec_widgets/assets/toolbar_icons/device_box.svg +3 -0
  28. bec_widgets/assets/toolbar_icons/image.svg +3 -0
  29. bec_widgets/assets/toolbar_icons/motor_map.svg +3 -0
  30. bec_widgets/assets/toolbar_icons/progress.svg +3 -0
  31. bec_widgets/assets/toolbar_icons/queue.svg +3 -0
  32. bec_widgets/assets/toolbar_icons/restore_state.svg +3 -0
  33. bec_widgets/assets/toolbar_icons/ring_progress.svg +3 -0
  34. bec_widgets/assets/toolbar_icons/save_state.svg +3 -0
  35. bec_widgets/assets/toolbar_icons/scan_control.svg +3 -0
  36. bec_widgets/assets/toolbar_icons/status.svg +3 -0
  37. bec_widgets/assets/toolbar_icons/terminal.svg +3 -0
  38. bec_widgets/assets/toolbar_icons/waveform.svg +3 -0
  39. bec_widgets/cli/client.py +1 -1
  40. bec_widgets/examples/general_app/__init__.py +0 -0
  41. bec_widgets/examples/general_app/general_app.py +92 -0
  42. bec_widgets/examples/general_app/general_app.ui +262 -0
  43. bec_widgets/examples/general_app/web_links.py +15 -0
  44. bec_widgets/examples/plugin_example_pyside/tictactoeplugin.py +8 -2
  45. bec_widgets/qt_utils/toolbar.py +52 -2
  46. bec_widgets/utils/generate_designer_plugin.py +1 -1
  47. bec_widgets/widgets/bec_queue/bec_queue_plugin.py +7 -2
  48. bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +7 -2
  49. bec_widgets/widgets/bec_status_box/status_item.py +14 -8
  50. bec_widgets/widgets/color_button/color_button_plugin.py +3 -2
  51. bec_widgets/widgets/device_box/device_box_plugin.py +6 -1
  52. bec_widgets/widgets/device_combobox/{device_combobox_plugin.py → device_combo_box_plugin.py} +5 -3
  53. bec_widgets/widgets/device_combobox/device_combobox.py +1 -2
  54. bec_widgets/widgets/device_combobox/{register_device_combobox.py → register_device_combo_box.py} +1 -1
  55. bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +5 -3
  56. bec_widgets/widgets/dock/dock.py +68 -4
  57. bec_widgets/widgets/dock/dock_area.py +139 -29
  58. bec_widgets/widgets/dock/dock_area.pyproject +1 -0
  59. bec_widgets/widgets/dock/dock_area_plugin.py +59 -0
  60. bec_widgets/widgets/dock/register_dock_area.py +15 -0
  61. bec_widgets/widgets/position_indicator/__init__.py +0 -0
  62. bec_widgets/widgets/position_indicator/position_indicator_plugin.py +7 -2
  63. bec_widgets/widgets/ring_progress_bar/register_ring_progress_bar.py +15 -0
  64. bec_widgets/widgets/ring_progress_bar/ring_progress_bar.pyproject +1 -0
  65. bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +58 -0
  66. bec_widgets/widgets/scan_control/register_scan_control.py +15 -0
  67. bec_widgets/widgets/scan_control/scan_control.pyproject +1 -0
  68. bec_widgets/widgets/scan_control/scan_control_plugin.py +58 -0
  69. bec_widgets/widgets/spinner/spinner_widget_plugin.py +7 -2
  70. bec_widgets/widgets/stop_button/stop_button_plugin.py +5 -3
  71. bec_widgets/widgets/text_box/register_text_box.py +15 -0
  72. bec_widgets/widgets/text_box/text_box.pyproject +1 -0
  73. bec_widgets/widgets/text_box/text_box_plugin.py +58 -0
  74. bec_widgets/widgets/toggle/toggle_switch_plugin.py +7 -2
  75. bec_widgets/widgets/vscode/register_vs_code_editor.py +15 -0
  76. bec_widgets/widgets/vscode/vs_code_editor.pyproject +1 -0
  77. bec_widgets/widgets/vscode/vs_code_editor_plugin.py +59 -0
  78. bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +1 -1
  79. bec_widgets/widgets/website/register_website_widget.py +15 -0
  80. bec_widgets/widgets/website/website_widget.pyproject +1 -0
  81. bec_widgets/widgets/website/website_widget_plugin.py +58 -0
  82. {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/METADATA +1 -1
  83. {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/RECORD +90 -35
  84. pyproject.toml +1 -1
  85. tests/unit_tests/test_bec_dock.py +70 -30
  86. bec_widgets/widgets/color_button/assets/color_button.png +0 -0
  87. bec_widgets/widgets/device_combobox/assets/device_combobox_icon.png +0 -0
  88. bec_widgets/widgets/device_line_edit/assets/line_edit_icon.png +0 -0
  89. bec_widgets/widgets/stop_button/assets/stop.png +0 -0
  90. /bec_widgets/assets/designer_icons/{BECWaveformWidget.png → waveform.png} +0 -0
  91. /bec_widgets/widgets/device_combobox/{device_combobox.pyproject → device_combo_box.pyproject} +0 -0
  92. {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/WHEEL +0 -0
  93. {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/entry_points.txt +0 -0
  94. {bec_widgets-0.90.0.dist-info → bec_widgets-0.92.0.dist-info}/licenses/LICENSE +0 -0
@@ -7,11 +7,18 @@ from pydantic import Field
7
7
  from pyqtgraph.dockarea.DockArea import DockArea
8
8
  from qtpy.QtCore import Qt
9
9
  from qtpy.QtGui import QPainter, QPaintEvent
10
- from qtpy.QtWidgets import QWidget
11
-
10
+ from qtpy.QtWidgets import QVBoxLayout, QWidget
11
+
12
+ from bec_widgets.qt_utils.toolbar import (
13
+ ExpandableMenuAction,
14
+ IconAction,
15
+ ModularToolBar,
16
+ SeparatorAction,
17
+ )
12
18
  from bec_widgets.utils import ConnectionConfig, WidgetContainerUtils
13
19
  from bec_widgets.utils.bec_widget import BECWidget
14
20
 
21
+ from ...qt_utils.error_popups import SafeSlot
15
22
  from .dock import BECDock, DockConfig
16
23
 
17
24
 
@@ -22,7 +29,7 @@ class DockAreaConfig(ConnectionConfig):
22
29
  )
23
30
 
24
31
 
25
- class BECDockArea(BECWidget, DockArea):
32
+ class BECDockArea(BECWidget, QWidget):
26
33
  USER_ACCESS = [
27
34
  "_config_dict",
28
35
  "panels",
@@ -51,15 +58,112 @@ class BECDockArea(BECWidget, DockArea):
51
58
  config = DockAreaConfig(**config)
52
59
  self.config = config
53
60
  super().__init__(client=client, config=config, gui_id=gui_id)
54
- DockArea.__init__(self, parent=parent)
61
+ QWidget.__init__(self, parent=parent)
62
+ self.layout = QVBoxLayout(self)
63
+ self.layout.setSpacing(5)
64
+ self.layout.setContentsMargins(0, 0, 0, 0)
55
65
 
56
66
  self._instructions_visible = True
57
67
 
58
- def paintEvent(self, event: QPaintEvent):
68
+ self.dock_area = DockArea()
69
+ self.toolbar = ModularToolBar(
70
+ actions={
71
+ "menu_plots": ExpandableMenuAction(
72
+ label="Add Plot ",
73
+ actions={
74
+ "waveform": IconAction(icon_path="waveform.svg", tooltip="Add Waveform"),
75
+ "image": IconAction(icon_path="image.svg", tooltip="Add Image"),
76
+ "motor_map": IconAction(icon_path="motor_map.svg", tooltip="Add Motor Map"),
77
+ },
78
+ ),
79
+ "separator_0": SeparatorAction(),
80
+ "menu_devices": ExpandableMenuAction(
81
+ label="Add Device Control ",
82
+ actions={
83
+ "scan_control": IconAction(
84
+ icon_path="scan_control.svg", tooltip="Add Scan Control"
85
+ ),
86
+ "device_box": IconAction(
87
+ icon_path="device_box.svg", tooltip="Add Device Box"
88
+ ),
89
+ },
90
+ ),
91
+ "separator_1": SeparatorAction(),
92
+ "menu_utils": ExpandableMenuAction(
93
+ label="Add Utils ",
94
+ actions={
95
+ "queue": IconAction(icon_path="queue.svg", tooltip="Add Scan Queue"),
96
+ "vs_code": IconAction(icon_path="terminal.svg", tooltip="Add VS Code"),
97
+ "status": IconAction(icon_path="status.svg", tooltip="Add BEC Status Box"),
98
+ "progress_bar": IconAction(
99
+ icon_path="ring_progress.svg", tooltip="Add Circular ProgressBar"
100
+ ),
101
+ },
102
+ ),
103
+ "separator_2": SeparatorAction(),
104
+ "attach_all": IconAction(
105
+ icon_path="attach_all.svg", tooltip="Attach all floating docks"
106
+ ),
107
+ "save_state": IconAction(icon_path="save_state.svg", tooltip="Save Dock State"),
108
+ "restore_state": IconAction(
109
+ icon_path="restore_state.svg", tooltip="Restore Dock State"
110
+ ),
111
+ },
112
+ target_widget=self,
113
+ )
114
+
115
+ self.layout.addWidget(self.toolbar)
116
+ self.layout.addWidget(self.dock_area)
117
+ self._hook_toolbar()
118
+
119
+ def _hook_toolbar(self):
120
+ # Menu Plot
121
+ self.toolbar.widgets["menu_plots"].widgets["waveform"].triggered.connect(
122
+ lambda: self.add_dock(widget="BECWaveformWidget", prefix="waveform")
123
+ )
124
+ self.toolbar.widgets["menu_plots"].widgets["image"].triggered.connect(
125
+ lambda: self.add_dock(widget="BECImageWidget", prefix="image")
126
+ )
127
+ self.toolbar.widgets["menu_plots"].widgets["motor_map"].triggered.connect(
128
+ lambda: self.add_dock(widget="BECMotorMapWidget", prefix="motor_map")
129
+ )
130
+
131
+ # Menu Devices
132
+ self.toolbar.widgets["menu_devices"].widgets["scan_control"].triggered.connect(
133
+ lambda: self.add_dock(widget="ScanControl", prefix="scan_control")
134
+ )
135
+ self.toolbar.widgets["menu_devices"].widgets["device_box"].triggered.connect(
136
+ lambda: self.add_dock(widget="DeviceBox", prefix="device_box")
137
+ )
138
+
139
+ # Menu Utils
140
+ self.toolbar.widgets["menu_utils"].widgets["queue"].triggered.connect(
141
+ lambda: self.add_dock(widget="BECQueue", prefix="queue")
142
+ )
143
+ self.toolbar.widgets["menu_utils"].widgets["status"].triggered.connect(
144
+ lambda: self.add_dock(widget="BECStatusBox", prefix="status")
145
+ )
146
+ self.toolbar.widgets["menu_utils"].widgets["vs_code"].triggered.connect(
147
+ lambda: self.add_dock(widget="VSCodeEditor", prefix="vs_code")
148
+ )
149
+ self.toolbar.widgets["menu_utils"].widgets["progress_bar"].triggered.connect(
150
+ lambda: self.add_dock(widget="RingProgressBar", prefix="progress_bar")
151
+ )
152
+
153
+ # Icons
154
+ self.toolbar.widgets["attach_all"].action.triggered.connect(self.attach_all)
155
+ self.toolbar.widgets["save_state"].action.triggered.connect(self.save_state)
156
+ self.toolbar.widgets["restore_state"].action.triggered.connect(self.restore_state)
157
+
158
+ def paintEvent(self, event: QPaintEvent): # TODO decide if we want any default instructions
59
159
  super().paintEvent(event)
60
160
  if self._instructions_visible:
61
161
  painter = QPainter(self)
62
- painter.drawText(self.rect(), Qt.AlignCenter, "Add docks using 'add_dock' method")
162
+ painter.drawText(
163
+ self.rect(),
164
+ Qt.AlignCenter,
165
+ "Add docks using 'add_dock' method from CLI\n or \n Add widget docks using the toolbar",
166
+ )
63
167
 
64
168
  @property
65
169
  def panels(self) -> dict[str, BECDock]:
@@ -68,11 +172,11 @@ class BECDockArea(BECWidget, DockArea):
68
172
  Returns:
69
173
  dock_dict(dict): The docks in the dock area.
70
174
  """
71
- return dict(self.docks)
175
+ return dict(self.dock_area.docks)
72
176
 
73
177
  @panels.setter
74
178
  def panels(self, value: dict[str, BECDock]):
75
- self.docks = WeakValueDictionary(value)
179
+ self.dock_area.docks = WeakValueDictionary(value)
76
180
 
77
181
  @property
78
182
  def temp_areas(self) -> list:
@@ -82,12 +186,13 @@ class BECDockArea(BECWidget, DockArea):
82
186
  Returns:
83
187
  list: The temporary areas in the dock area.
84
188
  """
85
- return list(map(str, self.tempAreas))
189
+ return list(map(str, self.dock_area.tempAreas))
86
190
 
87
191
  @temp_areas.setter
88
192
  def temp_areas(self, value: list):
89
- self.tempAreas = list(map(str, value))
193
+ self.dock_area.tempAreas = list(map(str, value))
90
194
 
195
+ @SafeSlot()
91
196
  def restore_state(
92
197
  self, state: dict = None, missing: Literal["ignore", "error"] = "ignore", extra="bottom"
93
198
  ):
@@ -101,8 +206,9 @@ class BECDockArea(BECWidget, DockArea):
101
206
  """
102
207
  if state is None:
103
208
  state = self.config.docks_state
104
- self.restoreState(state, missing=missing, extra=extra)
209
+ self.dock_area.restoreState(state, missing=missing, extra=extra)
105
210
 
211
+ @SafeSlot()
106
212
  def save_state(self) -> dict:
107
213
  """
108
214
  Save the state of the dock area.
@@ -110,7 +216,7 @@ class BECDockArea(BECWidget, DockArea):
110
216
  Returns:
111
217
  dict: The state of the dock area.
112
218
  """
113
- last_state = self.saveState()
219
+ last_state = self.dock_area.saveState()
114
220
  self.config.docks_state = last_state
115
221
  return last_state
116
222
 
@@ -121,23 +227,24 @@ class BECDockArea(BECWidget, DockArea):
121
227
  Args:
122
228
  name(str): The name of the dock to remove.
123
229
  """
124
- dock = self.docks.pop(name, None)
230
+ dock = self.dock_area.docks.pop(name, None)
125
231
  self.config.docks.pop(name, None)
126
232
  if dock:
127
233
  dock.close()
128
- if len(self.docks) <= 1:
129
- for dock in self.docks.values():
234
+ if len(self.dock_area.docks) <= 1:
235
+ for dock in self.dock_area.docks.values():
130
236
  dock.hide_title_bar()
131
237
 
132
238
  else:
133
239
  raise ValueError(f"Dock with name {name} does not exist.")
134
240
 
241
+ @SafeSlot(popup_error=True)
135
242
  def add_dock(
136
243
  self,
137
244
  name: str = None,
138
245
  position: Literal["bottom", "top", "left", "right", "above", "below"] = None,
139
246
  relative_to: BECDock | None = None,
140
- closable: bool = False,
247
+ closable: bool = True,
141
248
  floating: bool = False,
142
249
  prefix: str = "dock",
143
250
  widget: str | QWidget | None = None,
@@ -167,10 +274,10 @@ class BECDockArea(BECWidget, DockArea):
167
274
  """
168
275
  if name is None:
169
276
  name = WidgetContainerUtils.generate_unique_widget_id(
170
- container=self.docks, prefix=prefix
277
+ container=self.dock_area.docks, prefix=prefix
171
278
  )
172
279
 
173
- if name in set(self.docks.keys()):
280
+ if name in set(self.dock_area.docks.keys()):
174
281
  raise ValueError(f"Dock with name {name} already exists.")
175
282
 
176
283
  if position is None:
@@ -180,19 +287,21 @@ class BECDockArea(BECWidget, DockArea):
180
287
  dock.config.position = position
181
288
  self.config.docks[name] = dock.config
182
289
 
183
- self.addDock(dock=dock, position=position, relativeTo=relative_to)
290
+ self.dock_area.addDock(dock=dock, position=position, relativeTo=relative_to)
184
291
 
185
- if len(self.docks) <= 1:
292
+ if len(self.dock_area.docks) <= 1:
186
293
  dock.hide_title_bar()
187
- elif len(self.docks) > 1:
188
- for dock in self.docks.values():
294
+ elif len(self.dock_area.docks) > 1:
295
+ for dock in self.dock_area.docks.values():
189
296
  dock.show_title_bar()
190
297
 
191
298
  if widget is not None and isinstance(widget, str):
192
299
  dock.add_widget(widget=widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
193
300
  elif widget is not None and isinstance(widget, QWidget):
194
301
  dock.addWidget(widget, row=row, col=col, rowspan=rowspan, colspan=colspan)
195
- if self._instructions_visible:
302
+ if (
303
+ self._instructions_visible
304
+ ): # TODO still decide how initial instructions should be handled
196
305
  self._instructions_visible = False
197
306
  self.update()
198
307
  if floating:
@@ -209,26 +318,27 @@ class BECDockArea(BECWidget, DockArea):
209
318
  Returns:
210
319
  BECDock: The undocked dock.
211
320
  """
212
- dock = self.docks[dock_name]
321
+ dock = self.dock_area.docks[dock_name]
213
322
  dock.detach()
214
323
  return dock
215
324
 
325
+ @SafeSlot()
216
326
  def attach_all(self):
217
327
  """
218
328
  Return all floating docks to the dock area.
219
329
  """
220
- while self.tempAreas:
221
- for temp_area in self.tempAreas:
222
- self.removeTempArea(temp_area)
330
+ while self.dock_area.tempAreas:
331
+ for temp_area in self.dock_area.tempAreas:
332
+ self.dock_area.removeTempArea(temp_area)
223
333
 
224
334
  def clear_all(self):
225
335
  """
226
336
  Close all docks and remove all temp areas.
227
337
  """
228
338
  self.attach_all()
229
- for dock in dict(self.docks).values():
339
+ for dock in dict(self.dock_area.docks).values():
230
340
  dock.remove()
231
- self.docks.clear()
341
+ self.dock_area.docks.clear()
232
342
 
233
343
  def cleanup(self):
234
344
  """
@@ -0,0 +1 @@
1
+ {'files': ['dock_area.py','dock.py']}
@@ -0,0 +1,59 @@
1
+ # Copyright (C) 2022 The Qt Company Ltd.
2
+ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+ import os
4
+
5
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
6
+ from qtpy.QtGui import QIcon
7
+
8
+ import bec_widgets
9
+ from bec_widgets.widgets.dock import BECDockArea
10
+
11
+ DOM_XML = """
12
+ <ui language='c++'>
13
+ <widget class='BECDockArea' name='dock_area'>
14
+ </widget>
15
+ </ui>
16
+ """
17
+
18
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
19
+
20
+
21
+ class BECDockAreaPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
22
+ def __init__(self):
23
+ super().__init__()
24
+ self._form_editor = None
25
+
26
+ def createWidget(self, parent):
27
+ t = BECDockArea(parent)
28
+ return t
29
+
30
+ def domXml(self):
31
+ return DOM_XML
32
+
33
+ def group(self):
34
+ return "BEC Plots"
35
+
36
+ def icon(self):
37
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "dock_area.png")
38
+ return QIcon(icon_path)
39
+
40
+ def includeFile(self):
41
+ return "dock_area"
42
+
43
+ def initialize(self, form_editor):
44
+ self._form_editor = form_editor
45
+
46
+ def isContainer(self):
47
+ return False
48
+
49
+ def isInitialized(self):
50
+ return self._form_editor is not None
51
+
52
+ def name(self):
53
+ return "BECDockArea"
54
+
55
+ def toolTip(self):
56
+ return "BECDockArea"
57
+
58
+ def whatsThis(self):
59
+ return self.toolTip()
@@ -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.dock.dock_area_plugin import BECDockAreaPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(BECDockAreaPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
File without changes
@@ -1,9 +1,11 @@
1
1
  # Copyright (C) 2022 The Qt Company Ltd.
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+ import os
3
4
 
4
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
5
6
  from qtpy.QtGui import QIcon
6
7
 
8
+ import bec_widgets
7
9
  from bec_widgets.widgets.position_indicator.position_indicator import PositionIndicator
8
10
 
9
11
  DOM_XML = """
@@ -13,6 +15,8 @@ DOM_XML = """
13
15
  </ui>
14
16
  """
15
17
 
18
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
19
+
16
20
 
17
21
  class PositionIndicatorPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
18
22
  def __init__(self):
@@ -27,10 +31,11 @@ class PositionIndicatorPlugin(QDesignerCustomWidgetInterface): # pragma: no cov
27
31
  return DOM_XML
28
32
 
29
33
  def group(self):
30
- return ""
34
+ return "BEC Utils"
31
35
 
32
36
  def icon(self):
33
- return QIcon()
37
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "position_indicator.png")
38
+ return QIcon(icon_path)
34
39
 
35
40
  def includeFile(self):
36
41
  return "position_indicator"
@@ -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.ring_progress_bar.ring_progress_bar_plugin import RingProgressBarPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(RingProgressBarPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -0,0 +1 @@
1
+ {'files': ['ring_progress_bar.py']}
@@ -0,0 +1,58 @@
1
+ # Copyright (C) 2022 The Qt Company Ltd.
2
+ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+ import os
4
+
5
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
6
+ from qtpy.QtGui import QIcon
7
+
8
+ import bec_widgets
9
+ from bec_widgets.widgets.ring_progress_bar.ring_progress_bar import RingProgressBar
10
+
11
+ DOM_XML = """
12
+ <ui language='c++'>
13
+ <widget class='RingProgressBar' name='ring_progress_bar'>
14
+ </widget>
15
+ </ui>
16
+ """
17
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
18
+
19
+
20
+ class RingProgressBarPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
21
+ def __init__(self):
22
+ super().__init__()
23
+ self._form_editor = None
24
+
25
+ def createWidget(self, parent):
26
+ t = RingProgressBar(parent)
27
+ return t
28
+
29
+ def domXml(self):
30
+ return DOM_XML
31
+
32
+ def group(self):
33
+ return "BEC Utils"
34
+
35
+ def icon(self):
36
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "ring_progress.png")
37
+ return QIcon(icon_path)
38
+
39
+ def includeFile(self):
40
+ return "ring_progress_bar"
41
+
42
+ def initialize(self, form_editor):
43
+ self._form_editor = form_editor
44
+
45
+ def isContainer(self):
46
+ return False
47
+
48
+ def isInitialized(self):
49
+ return self._form_editor is not None
50
+
51
+ def name(self):
52
+ return "RingProgressBar"
53
+
54
+ def toolTip(self):
55
+ return "RingProgressBar"
56
+
57
+ def whatsThis(self):
58
+ return self.toolTip()
@@ -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.scan_control.scan_control_plugin import ScanControlPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(ScanControlPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -0,0 +1 @@
1
+ {'files': ['scan_control.py']}
@@ -0,0 +1,58 @@
1
+ # Copyright (C) 2022 The Qt Company Ltd.
2
+ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+ import os
4
+
5
+ from qtpy.QtDesigner import QDesignerCustomWidgetInterface
6
+ from qtpy.QtGui import QIcon
7
+
8
+ import bec_widgets
9
+ from bec_widgets.widgets.scan_control.scan_control import ScanControl
10
+
11
+ DOM_XML = """
12
+ <ui language='c++'>
13
+ <widget class='ScanControl' name='scan_control'>
14
+ </widget>
15
+ </ui>
16
+ """
17
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
18
+
19
+
20
+ class ScanControlPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
21
+ def __init__(self):
22
+ super().__init__()
23
+ self._form_editor = None
24
+
25
+ def createWidget(self, parent):
26
+ t = ScanControl(parent)
27
+ return t
28
+
29
+ def domXml(self):
30
+ return DOM_XML
31
+
32
+ def group(self):
33
+ return "Device Control"
34
+
35
+ def icon(self):
36
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "scan_control.png")
37
+ return QIcon(icon_path)
38
+
39
+ def includeFile(self):
40
+ return "scan_control"
41
+
42
+ def initialize(self, form_editor):
43
+ self._form_editor = form_editor
44
+
45
+ def isContainer(self):
46
+ return False
47
+
48
+ def isInitialized(self):
49
+ return self._form_editor is not None
50
+
51
+ def name(self):
52
+ return "ScanControl"
53
+
54
+ def toolTip(self):
55
+ return "ScanControl"
56
+
57
+ def whatsThis(self):
58
+ return self.toolTip()
@@ -1,9 +1,11 @@
1
1
  # Copyright (C) 2022 The Qt Company Ltd.
2
2
  # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
+ import os
3
4
 
4
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
5
6
  from qtpy.QtGui import QIcon
6
7
 
8
+ import bec_widgets
7
9
  from bec_widgets.widgets.spinner.spinner import SpinnerWidget
8
10
 
9
11
  DOM_XML = """
@@ -13,6 +15,8 @@ DOM_XML = """
13
15
  </ui>
14
16
  """
15
17
 
18
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
19
+
16
20
 
17
21
  class SpinnerWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
18
22
  def __init__(self):
@@ -27,10 +31,11 @@ class SpinnerWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
27
31
  return DOM_XML
28
32
 
29
33
  def group(self):
30
- return ""
34
+ return "BEC Utils"
31
35
 
32
36
  def icon(self):
33
- return QIcon()
37
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "spinner.png")
38
+ return QIcon(icon_path)
34
39
 
35
40
  def includeFile(self):
36
41
  return "spinner_widget"
@@ -5,6 +5,7 @@ import os
5
5
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
6
6
  from qtpy.QtGui import QIcon
7
7
 
8
+ import bec_widgets
8
9
  from bec_widgets.widgets.stop_button.stop_button import StopButton
9
10
 
10
11
  DOM_XML = """
@@ -14,6 +15,8 @@ DOM_XML = """
14
15
  </ui>
15
16
  """
16
17
 
18
+ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
19
+
17
20
 
18
21
  class StopButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
19
22
  def __init__(self):
@@ -28,11 +31,10 @@ class StopButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
28
31
  return DOM_XML
29
32
 
30
33
  def group(self):
31
- return "BEC Buttons"
34
+ return "BEC Utils"
32
35
 
33
36
  def icon(self):
34
- current_path = os.path.dirname(__file__)
35
- icon_path = os.path.join(current_path, "assets", "stop.png")
37
+ icon_path = os.path.join(MODULE_PATH, "assets", "designer_icons", "stop.png")
36
38
  return QIcon(icon_path)
37
39
 
38
40
  def includeFile(self):
@@ -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.text_box.text_box_plugin import TextBoxPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(TextBoxPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -0,0 +1 @@
1
+ {'files': ['text_box.py']}