bec-widgets 0.80.0__py3-none-any.whl → 0.82.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 (75) hide show
  1. CHANGELOG.md +40 -46
  2. PKG-INFO +1 -1
  3. bec_widgets/cli/client.py +1 -0
  4. bec_widgets/examples/__init__.py +0 -9
  5. bec_widgets/utils/entry_validator.py +1 -1
  6. bec_widgets/widgets/{device_inputs → base_classes}/device_input_base.py +2 -0
  7. bec_widgets/widgets/color_button/color_button.py +36 -0
  8. bec_widgets/widgets/{buttons/color_button → color_button}/color_button_plugin.py +1 -1
  9. bec_widgets/widgets/{buttons/color_button → color_button}/register_color_button.py +1 -1
  10. bec_widgets/widgets/device_combobox/assets/device_combobox_icon.png +0 -0
  11. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/device_combobox.py +2 -2
  12. bec_widgets/widgets/device_combobox/device_combobox.pyproject +3 -0
  13. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/device_combobox_plugin.py +6 -3
  14. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/register_device_combobox.py +1 -3
  15. bec_widgets/widgets/device_line_edit/assets/line_edit_icon.png +0 -0
  16. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/device_line_edit.py +2 -2
  17. bec_widgets/widgets/device_line_edit/device_line_edit.pyproject +3 -0
  18. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/device_line_edit_plugin.py +6 -3
  19. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/register_device_line_edit.py +1 -3
  20. bec_widgets/widgets/figure/plots/waveform/waveform.py +8 -2
  21. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +1 -1
  22. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_toolbar.py +1 -1
  23. bec_widgets/widgets/motor_map/motor_map_widget.py +0 -12
  24. bec_widgets/widgets/scan_control/scan_control.py +1 -1
  25. bec_widgets/widgets/scan_control/scan_group_box.py +1 -1
  26. bec_widgets/widgets/stop_button/assets/stop.png +0 -0
  27. bec_widgets/widgets/stop_button/register_stop_button.py +15 -0
  28. bec_widgets/widgets/{buttons/stop_button → stop_button}/stop_button.py +5 -12
  29. bec_widgets/widgets/stop_button/stop_button.pyproject +1 -0
  30. bec_widgets/widgets/stop_button/stop_button_plugin.py +57 -0
  31. bec_widgets/widgets/toggle/register_toggle_switch.py +15 -0
  32. bec_widgets/widgets/toggle/toggle.py +149 -0
  33. bec_widgets/widgets/toggle/toggle_switch.pyproject +1 -0
  34. bec_widgets/widgets/toggle/toggle_switch_plugin.py +54 -0
  35. {bec_widgets-0.80.0.dist-info → bec_widgets-0.82.0.dist-info}/METADATA +1 -1
  36. {bec_widgets-0.80.0.dist-info → bec_widgets-0.82.0.dist-info}/RECORD +52 -61
  37. pyproject.toml +1 -1
  38. tests/unit_tests/test_device_input_base.py +1 -1
  39. tests/unit_tests/test_device_input_widgets.py +2 -2
  40. tests/unit_tests/test_stop_button.py +5 -2
  41. tests/unit_tests/test_toggle.py +38 -0
  42. bec_widgets/examples/motor_movement/__init__.py +0 -9
  43. bec_widgets/examples/motor_movement/motor_control_compilations.py +0 -250
  44. bec_widgets/examples/motor_movement/motor_controller.ui +0 -926
  45. bec_widgets/widgets/buttons/__init__.py +0 -1
  46. bec_widgets/widgets/buttons/color_button/color_button.py +0 -17
  47. bec_widgets/widgets/device_inputs/__init__.py +0 -2
  48. bec_widgets/widgets/device_inputs/device_combobox/device_combobox.pyproject +0 -4
  49. bec_widgets/widgets/device_inputs/device_combobox/launch_device_combobox.py +0 -11
  50. bec_widgets/widgets/device_inputs/device_line_edit/device_line_edit.pyproject +0 -4
  51. bec_widgets/widgets/device_inputs/device_line_edit/launch_device_line_edit.py +0 -11
  52. bec_widgets/widgets/motor_control/motor_control.py +0 -252
  53. bec_widgets/widgets/motor_control/motor_table/motor_table.py +0 -484
  54. bec_widgets/widgets/motor_control/motor_table/motor_table.ui +0 -113
  55. bec_widgets/widgets/motor_control/movement_absolute/__init__.py +0 -0
  56. bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.py +0 -159
  57. bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.ui +0 -149
  58. bec_widgets/widgets/motor_control/movement_relative/__init__.py +0 -0
  59. bec_widgets/widgets/motor_control/movement_relative/movement_relative.py +0 -230
  60. bec_widgets/widgets/motor_control/movement_relative/movement_relative.ui +0 -298
  61. bec_widgets/widgets/motor_control/selection/__init__.py +0 -0
  62. bec_widgets/widgets/motor_control/selection/selection.py +0 -110
  63. bec_widgets/widgets/motor_control/selection/selection.ui +0 -69
  64. tests/unit_tests/test_motor_control.py +0 -588
  65. /bec_widgets/widgets/{buttons/color_button → base_classes}/__init__.py +0 -0
  66. /bec_widgets/widgets/{buttons/stop_button → color_button}/__init__.py +0 -0
  67. /bec_widgets/widgets/{buttons/color_button → color_button}/assets/color_button.png +0 -0
  68. /bec_widgets/widgets/{buttons/color_button → color_button}/color_button.pyproject +0 -0
  69. /bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/__init__.py +0 -0
  70. /bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/__init__.py +0 -0
  71. /bec_widgets/widgets/{motor_control → stop_button}/__init__.py +0 -0
  72. /bec_widgets/widgets/{motor_control/motor_table → toggle}/__init__.py +0 -0
  73. {bec_widgets-0.80.0.dist-info → bec_widgets-0.82.0.dist-info}/WHEEL +0 -0
  74. {bec_widgets-0.80.0.dist-info → bec_widgets-0.82.0.dist-info}/entry_points.txt +0 -0
  75. {bec_widgets-0.80.0.dist-info → bec_widgets-0.82.0.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.82.0 (2024-07-07)
4
+
5
+ ### Feature
6
+
7
+ * feat(toggle): added angular component-like toggle ([`b9bff38`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b9bff38b64b86f06b3bc047922ef9df0c7d32e71))
8
+
9
+ ### Refactor
10
+
11
+ * refactor(device_input): DeviceComboBox and DeviceLineEdit moved to top layer of widgets ([`f048629`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f04862933f049030554086adef3ec9e1aebd3eda))
12
+
13
+ * refactor(stop_button): moved to top layer, plugin added ([`f5b8375`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f5b8375fd36e3bb681de571da86a6c0bdb3cb6f0))
14
+
15
+ * refactor(motor_map_widget): removed restriction of only PySide6 for widget ([`db1cdf4`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/db1cdf42806fef6d7c6d2db83528f32df3f9751d))
16
+
17
+ * refactor(color_button): ColorButton moved to top level of widgets ([`fa1e86f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/fa1e86ff07b25d2c47c73117b00765b8e2f25da4))
18
+
19
+ ## v0.81.2 (2024-07-07)
20
+
21
+ ### Fix
22
+
23
+ * fix(waveform): scan_history error check for IndexError ([`dd1875e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/dd1875ea5cc18bcef9aad743347a8accf144c08d))
24
+
25
+ ## v0.81.1 (2024-07-07)
26
+
27
+ ### Fix
28
+
29
+ * fix(motor_control): temporary remove of motor control widgets ([`99114f1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/99114f14f62202e1fd8bf145616fa8c69937ada4))
30
+
31
+ ## v0.81.0 (2024-07-06)
32
+
33
+ ### Feature
34
+
35
+ * feat(color_button): can get colors in RGBA or HEX ([`9594be2`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9594be260680d11c8550ff74ffb8d679e5a5b8f6))
36
+
37
+ ## v0.80.1 (2024-07-06)
38
+
39
+ ### Fix
40
+
41
+ * fix(entry_validator): check for entry == "" ([`61de7e9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/61de7e9e221c766b9fb3ec23246da6a11c96a986))
42
+
3
43
  ## v0.80.0 (2024-07-06)
4
44
 
5
45
  ### Feature
@@ -97,49 +137,3 @@
97
137
  * fix(image): image can be fully reconstructed from config ([`797f73c`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/797f73c39aa73e07d6311f3de4baea53f6c380e0))
98
138
 
99
139
  * fix(image_item): vrange added int for pydantic model check ([`b8f796f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b8f796fd3fcc15641e8fc6a3ca75c344ce90fc45))
100
-
101
- * fix(bec_figure): waveforms can be initialised from the config; widgets are deleteLater after removal ([`78673ea`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/78673ea11a47aad878128197ae6213925228ed59))
102
-
103
- ### Unknown
104
-
105
- * Resolve "add VT100 console executing BEC as a widget" ([`c6a14c0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c6a14c0768a90695567a83a7895247ed0c64f3ce))
106
-
107
- ## v0.76.1 (2024-06-29)
108
-
109
- ### Fix
110
-
111
- * fix(plugins): fixes and tests for auto-gen plugins ([`c42511d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c42511dd44cc13577e108a6cef3166376e594f54))
112
-
113
- ## v0.76.0 (2024-06-28)
114
-
115
- ### Feature
116
-
117
- * feat(designer): added support for creating designer plugins automatically ([`c1dd0ee`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c1dd0ee1906dba1f2e2ae9ce40a84d55c26a1cce))
118
-
119
- ### Fix
120
-
121
- * fix: fixed qwidget inheritance for ring progress bar ([`0610d2f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0610d2f9f027f8659e7149f2dfbb316ff30e337d))
122
-
123
- ### Unknown
124
-
125
- * fix:parent set as first kwarg TextBox and WebsiteWidget ([`a45c407`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a45c4075684b93bfdcee03e5a416b84f61d3bc6f))
126
-
127
- ## v0.75.0 (2024-06-26)
128
-
129
- ### Feature
130
-
131
- * feat(widgets): added simple bec queue widget ([`3faee98`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3faee98ec80041a27e4c1f1156178de6f9dcdc63))
132
-
133
- ### Refactor
134
-
135
- * refactor(dispatcher): cleanup ([`ca02132`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ca02132c8d18535b37e9192e00459d2aca6ba5cf))
136
-
137
- ## v0.74.1 (2024-06-26)
138
-
139
- ### Fix
140
-
141
- * fix(rings): rings properties updated right after setting ([`c8b7367`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c8b7367815b095f8e4aa8b819481efb701f2e542))
142
-
143
- ### Test
144
-
145
- * test(bec_figure): tests for removing widgets with rpc e2e ([`a268caa`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a268caaa30711fcc7ece542d24578d74cbf65c77))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.80.0
3
+ Version: 0.82.0
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
bec_widgets/cli/client.py CHANGED
@@ -21,6 +21,7 @@ class Widgets(str, enum.Enum):
21
21
  BECStatusBox = "BECStatusBox"
22
22
  RingProgressBar = "RingProgressBar"
23
23
  ScanControl = "ScanControl"
24
+ StopButton = "StopButton"
24
25
  TextBox = "TextBox"
25
26
  VSCodeEditor = "VSCodeEditor"
26
27
  WebsiteWidget = "WebsiteWidget"
@@ -1,9 +0,0 @@
1
- from .motor_movement import (
2
- MotorControlApp,
3
- MotorControlMap,
4
- MotorControlPanel,
5
- MotorControlPanelAbsolute,
6
- MotorControlPanelRelative,
7
- MotorCoordinateTable,
8
- MotorThread,
9
- )
@@ -19,7 +19,7 @@ class EntryValidator:
19
19
  device = self.devices[name]
20
20
  description = device.describe()
21
21
 
22
- if entry is None:
22
+ if entry is None or entry == "":
23
23
  entry = next(iter(device._hints), name) if hasattr(device, "_hints") else name
24
24
  if entry not in description:
25
25
  raise ValueError(f"Entry '{entry}' not found in device '{name}' signals")
@@ -25,6 +25,7 @@ class DeviceInputBase(BECConnector):
25
25
  super().__init__(client=client, config=config, gui_id=gui_id)
26
26
 
27
27
  self.get_bec_shortcuts()
28
+ self._device_filter = None
28
29
  self._devices = []
29
30
 
30
31
  @property
@@ -56,6 +57,7 @@ class DeviceInputBase(BECConnector):
56
57
  """
57
58
  self.validate_device_filter(device_filter)
58
59
  self.config.device_filter = device_filter
60
+ self._device_filter = device_filter
59
61
 
60
62
  def set_default_device(self, default_device: str):
61
63
  """
@@ -0,0 +1,36 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Literal
4
+
5
+ import pyqtgraph as pg
6
+
7
+
8
+ class ColorButton(pg.ColorButton):
9
+ """
10
+ A ColorButton that opens a dialog to select a color. Inherits from pyqtgraph.ColorButton.
11
+ Patches event loop of the ColorDialog, if opened in another QDialog.
12
+ """
13
+
14
+ def __init__(self, *args, **kwargs):
15
+ super().__init__(*args, **kwargs)
16
+
17
+ def selectColor(self):
18
+ self.origColor = self.color()
19
+ self.colorDialog.setCurrentColor(self.color())
20
+ self.colorDialog.open()
21
+ self.colorDialog.exec()
22
+
23
+ def get_color(self, format: Literal["RGBA", "HEX"] = "RGBA") -> tuple | str:
24
+ """
25
+ Get the color of the button in the specified format.
26
+
27
+ Args:
28
+ format(Literal["RGBA", "HEX"]): The format of the returned color.
29
+
30
+ Returns:
31
+ tuple|str: The color in the specified format.
32
+ """
33
+ if format == "RGBA":
34
+ return self.color().getRgb()
35
+ if format == "HEX":
36
+ return self.color().name()
@@ -3,7 +3,7 @@ import os
3
3
  from qtpy.QtDesigner import QDesignerCustomWidgetInterface
4
4
  from qtpy.QtGui import QIcon
5
5
 
6
- from bec_widgets.widgets.buttons.color_button.color_button import ColorButton
6
+ from bec_widgets.widgets.color_button.color_button import ColorButton
7
7
 
8
8
  DOM_XML = """
9
9
  <ui language='c++'>
@@ -6,7 +6,7 @@ def main(): # pragma: no cover
6
6
  return
7
7
  from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
8
8
 
9
- from bec_widgets.widgets.buttons.color_button.color_button_plugin import ColorButtonPlugin
9
+ from bec_widgets.widgets.color_button.color_button_plugin import ColorButtonPlugin
10
10
 
11
11
  QPyDesignerCustomWidgetCollection.addCustomWidget(ColorButtonPlugin())
12
12
 
@@ -2,10 +2,10 @@ from typing import TYPE_CHECKING
2
2
 
3
3
  from qtpy.QtWidgets import QComboBox
4
4
 
5
- from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputBase, DeviceInputConfig
5
+ from bec_widgets.widgets.base_classes.device_input_base import DeviceInputBase, DeviceInputConfig
6
6
 
7
7
  if TYPE_CHECKING:
8
- from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputConfig
8
+ from bec_widgets.widgets.base_classes.device_input_base import DeviceInputConfig
9
9
 
10
10
 
11
11
  class DeviceComboBox(DeviceInputBase, QComboBox):
@@ -0,0 +1,3 @@
1
+ {
2
+ "files": ["device_combobox.py"]
3
+ }
@@ -1,10 +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
 
7
- from bec_widgets.widgets.device_inputs import DeviceComboBox
8
+ from bec_widgets.widgets.device_combobox.device_combobox import DeviceComboBox
8
9
 
9
10
  DOM_XML = """
10
11
  <ui language='c++'>
@@ -27,10 +28,12 @@ class DeviceComboBoxPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
27
28
  return DOM_XML
28
29
 
29
30
  def group(self):
30
- return ""
31
+ return "BEC Device Inputs"
31
32
 
32
33
  def icon(self):
33
- return QIcon()
34
+ current_path = os.path.dirname(__file__)
35
+ icon_path = os.path.join(current_path, "assets", "device_combobox_icon.png")
36
+ return QIcon(icon_path)
34
37
 
35
38
  def includeFile(self):
36
39
  return "device_combobox"
@@ -6,9 +6,7 @@ def main(): # pragma: no cover
6
6
  return
7
7
  from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
8
8
 
9
- from bec_widgets.widgets.device_inputs.device_combobox.device_combobox_plugin import (
10
- DeviceComboBoxPlugin,
11
- )
9
+ from bec_widgets.widgets.device_combobox.device_combobox_plugin import DeviceComboBoxPlugin
12
10
 
13
11
  QPyDesignerCustomWidgetCollection.addCustomWidget(DeviceComboBoxPlugin())
14
12
 
@@ -3,10 +3,10 @@ from typing import TYPE_CHECKING
3
3
  from qtpy.QtCore import QSize
4
4
  from qtpy.QtWidgets import QCompleter, QLineEdit, QSizePolicy
5
5
 
6
- from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputBase, DeviceInputConfig
6
+ from bec_widgets.widgets.base_classes.device_input_base import DeviceInputBase, DeviceInputConfig
7
7
 
8
8
  if TYPE_CHECKING:
9
- from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputConfig
9
+ from bec_widgets.widgets.base_classes.device_input_base import DeviceInputConfig
10
10
 
11
11
 
12
12
  class DeviceLineEdit(DeviceInputBase, QLineEdit):
@@ -0,0 +1,3 @@
1
+ {
2
+ "files": ["device_line_edit.py"]
3
+ }
@@ -1,10 +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
 
7
- from bec_widgets.widgets.device_inputs import DeviceLineEdit
8
+ from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
8
9
 
9
10
  DOM_XML = """
10
11
  <ui language='c++'>
@@ -27,10 +28,12 @@ class DeviceLineEditPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
27
28
  return DOM_XML
28
29
 
29
30
  def group(self):
30
- return ""
31
+ return "BEC Device Inputs"
31
32
 
32
33
  def icon(self):
33
- return QIcon()
34
+ current_path = os.path.dirname(__file__)
35
+ icon_path = os.path.join(current_path, "assets", "line_edit_icon.png")
36
+ return QIcon(icon_path)
34
37
 
35
38
  def includeFile(self):
36
39
  return "device_line_edit"
@@ -6,9 +6,7 @@ def main(): # pragma: no cover
6
6
  return
7
7
  from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
8
8
 
9
- from bec_widgets.widgets.device_inputs.device_line_edit.device_line_edit_plugin import (
10
- DeviceLineEditPlugin,
11
- )
9
+ from bec_widgets.widgets.device_line_edit.device_line_edit_plugin import DeviceLineEditPlugin
12
10
 
13
11
  QPyDesignerCustomWidgetCollection.addCustomWidget(DeviceLineEditPlugin())
14
12
 
@@ -221,6 +221,7 @@ class BECWaveform(BECPlotBase):
221
221
  label: str | None = None,
222
222
  validate: bool = True,
223
223
  dap: str | None = None, # TODO add dap custom curve wrapper
224
+ **kwargs,
224
225
  ) -> BECCurve:
225
226
  """
226
227
  Plot a curve to the plot widget.
@@ -244,7 +245,7 @@ class BECWaveform(BECPlotBase):
244
245
  """
245
246
 
246
247
  if x is not None and y is not None:
247
- return self.add_curve_custom(x=x, y=y, label=label, color=color)
248
+ return self.add_curve_custom(x=x, y=y, label=label, color=color, **kwargs)
248
249
  else:
249
250
  if dap:
250
251
  self.add_dap(x_name=x_name, y_name=y_name, dap=dap)
@@ -259,6 +260,7 @@ class BECWaveform(BECPlotBase):
259
260
  color_map_z=color_map_z,
260
261
  label=label,
261
262
  validate_bec=validate,
263
+ **kwargs,
262
264
  )
263
265
 
264
266
  def add_curve_custom(
@@ -754,7 +756,11 @@ class BECWaveform(BECPlotBase):
754
756
  self.update_dap, MessageEndpoints.dap_response(self.scan_id)
755
757
  )
756
758
  if scan_index is not None:
757
- self.scan_id = self.queue.scan_storage.storage[scan_index].scan_id
759
+ try:
760
+ self.scan_id = self.queue.scan_storage.storage[scan_index].scan_id
761
+ except IndexError:
762
+ print(f"Scan index {scan_index} out of range.")
763
+ return
758
764
  elif scan_id is not None:
759
765
  self.scan_id = scan_id
760
766
 
@@ -36,7 +36,7 @@ class MotorMapSettings(QWidget):
36
36
  precision = WidgetIO.get_value(self.ui.precision)
37
37
  scatter_size = WidgetIO.get_value(self.ui.scatter_size)
38
38
  background_intensity = int(WidgetIO.get_value(self.ui.background_value) * 0.01 * 255)
39
- color = self.ui.color.color().toTuple()
39
+ color = self.ui.color.get_color("RGBA")
40
40
 
41
41
  if self.target_widget is not None:
42
42
  self.target_widget.set_max_points(max_points)
@@ -4,7 +4,7 @@ from qtpy.QtCore import QSize
4
4
  from qtpy.QtGui import QAction, QIcon
5
5
  from qtpy.QtWidgets import QHBoxLayout, QLabel, QWidget
6
6
 
7
- from bec_widgets.widgets.device_inputs import DeviceComboBox
7
+ from bec_widgets.widgets.device_combobox.device_combobox import DeviceComboBox
8
8
  from bec_widgets.widgets.toolbar.toolbar import ToolBarAction
9
9
 
10
10
 
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  import sys
4
4
 
5
- from qtpy import PYSIDE6
6
5
  from qtpy.QtWidgets import QVBoxLayout, QWidget
7
6
 
8
7
  from bec_widgets.utils import BECConnector
@@ -37,10 +36,6 @@ class BECMotorMapWidget(BECConnector, QWidget):
37
36
  client=None,
38
37
  gui_id: str | None = None,
39
38
  ) -> 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
39
  if config is None:
45
40
  config = MotorMapConfig(widget_class=self.__class__.__name__)
46
41
  else:
@@ -216,13 +211,6 @@ class BECMotorMapWidget(BECConnector, QWidget):
216
211
 
217
212
 
218
213
  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
214
  from qtpy.QtWidgets import QApplication
227
215
 
228
216
  app = QApplication(sys.argv)
@@ -12,8 +12,8 @@ from qtpy.QtWidgets import (
12
12
  )
13
13
 
14
14
  from bec_widgets.utils import BECConnector
15
- from bec_widgets.widgets.buttons.stop_button.stop_button import StopButton
16
15
  from bec_widgets.widgets.scan_control.scan_group_box import ScanGroupBox
16
+ from bec_widgets.widgets.stop_button.stop_button import StopButton
17
17
 
18
18
 
19
19
  class ScanControl(BECConnector, QWidget):
@@ -12,7 +12,7 @@ from qtpy.QtWidgets import (
12
12
  )
13
13
 
14
14
  from bec_widgets.utils.widget_io import WidgetIO
15
- from bec_widgets.widgets.device_inputs import DeviceLineEdit
15
+ from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
16
16
 
17
17
 
18
18
  class ScanArgType:
@@ -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.stop_button.stop_button_plugin import StopButtonPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(StopButtonPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()
@@ -1,3 +1,4 @@
1
+ from qtpy.QtCore import Slot
1
2
  from qtpy.QtWidgets import QPushButton
2
3
 
3
4
  from bec_widgets.utils import BECConnector
@@ -12,21 +13,13 @@ class StopButton(BECConnector, QPushButton):
12
13
 
13
14
  self.get_bec_shortcuts()
14
15
  self.setText("Stop")
15
- self.setStyleSheet("background-color: #cc181e; color: white")
16
+ self.setStyleSheet(
17
+ "background-color: #cc181e; color: white; font-weight: bold; font-size: 12px;"
18
+ )
16
19
  self.clicked.connect(self.stop_scan)
17
20
 
21
+ @Slot()
18
22
  def stop_scan(self):
19
23
  """Stop the scan."""
20
24
  self.queue.request_scan_abortion()
21
25
  self.queue.request_queue_reset()
22
-
23
-
24
- if __name__ == "__main__": # pragma: no cover
25
- import sys
26
-
27
- from qtpy.QtWidgets import QApplication
28
-
29
- app = QApplication(sys.argv)
30
- widget = StopButton()
31
- widget.show()
32
- sys.exit(app.exec_())
@@ -0,0 +1 @@
1
+ {'files': ['stop_button.py']}
@@ -0,0 +1,57 @@
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
+ from bec_widgets.widgets.stop_button.stop_button import StopButton
9
+
10
+ DOM_XML = """
11
+ <ui language='c++'>
12
+ <widget class='StopButton' name='stop_button'>
13
+ </widget>
14
+ </ui>
15
+ """
16
+
17
+
18
+ class StopButtonPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
19
+ def __init__(self):
20
+ super().__init__()
21
+ self._form_editor = None
22
+
23
+ def createWidget(self, parent):
24
+ t = StopButton(parent)
25
+ return t
26
+
27
+ def domXml(self):
28
+ return DOM_XML
29
+
30
+ def group(self):
31
+ return "BEC Buttons"
32
+
33
+ def icon(self):
34
+ current_path = os.path.dirname(__file__)
35
+ icon_path = os.path.join(current_path, "assets", "stop.png")
36
+ return QIcon(icon_path)
37
+
38
+ def includeFile(self):
39
+ return "stop_button"
40
+
41
+ def initialize(self, form_editor):
42
+ self._form_editor = form_editor
43
+
44
+ def isContainer(self):
45
+ return False
46
+
47
+ def isInitialized(self):
48
+ return self._form_editor is not None
49
+
50
+ def name(self):
51
+ return "StopButton"
52
+
53
+ def toolTip(self):
54
+ return "A button that stops the current scan."
55
+
56
+ def whatsThis(self):
57
+ 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.toggle.toggle_switch_plugin import ToggleSwitchPlugin
10
+
11
+ QPyDesignerCustomWidgetCollection.addCustomWidget(ToggleSwitchPlugin())
12
+
13
+
14
+ if __name__ == "__main__": # pragma: no cover
15
+ main()