bec-widgets 0.70.0__py3-none-any.whl → 0.71.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.
CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.71.0 (2024-06-23)
4
+
5
+ ### Feature
6
+
7
+ * feat(scan_group_box): scan box for args and kwargs separated from ScanControlGUI code ([`d8cf441`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d8cf44134c30063e586771f9068947fef7a306d1))
8
+
9
+ ### Fix
10
+
11
+ * fix(cleanup): cleanup added to device_input widgets and scan_control ([`8badb6a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8badb6adc1d003dbf0b2b1a800c34821f3fc9aa3))
12
+
13
+ * fix(scan_group_box): added row counter based on widgets ([`37682e7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/37682e7b8a6ede38308880d285e41a948d6fe831))
14
+
15
+ * fix(scan_control): added default min limit for args bundle if specified ([`ec4574e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ec4574ed5c2c85ea6fbbe2b98f162a8e1220653b))
16
+
17
+ * fix(scan_control): argbox delete later added to prevent overlapping gui if scan changed ([`7ce3a83`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7ce3a83c58cb69c2bf7cb7f4eaba7e6a2ca6c546))
18
+
19
+ * fix(scan_control): only scans with defined gui_config are allowed ([`6dff187`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6dff1879c4178df0f8ebfd35101acdebb028d572))
20
+
21
+ * fix(WidgetIO): find handlers within base classes ([`ca85638`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ca856384f380dabf28d43f1cd48511af784c035b))
22
+
23
+ * fix(scan_control): adapted widget to scan BEC gui config ([`8b822e0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8b822e0fa8e28f080b9a4bf81948a7280a4c07bf))
24
+
25
+ * fix(scan_control): scan_control.py combatible with the newest BEC versions, test disabled ([`67d398c`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/67d398caf74e08ab25a70cc5d85a5f0c2de8212d))
26
+
27
+ ### Refactor
28
+
29
+ * refactor(device_line_edit): renamed default_device to default ([`4e2c9df`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4e2c9df6a4979d935285fd7eba17fd7fd455a35c))
30
+
31
+ ### Test
32
+
33
+ * test(scan_control): tests added ([`56e74a0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/56e74a0e7da72d18e89bc30d1896dbf9ef97cd6b))
34
+
35
+ ### Unknown
36
+
37
+ * test(scan_control):e2e tests added ([`83001a0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/83001a0d8267e1320549b07032857dcf46ecd293))
38
+
39
+ * doc(scan_control): docs added ([`1b7921a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/1b7921a7f2e3bcc846219a2a7aa0de0fd27bb8fe))
40
+
41
+ * fix(device_line_edit):SizePolicy fixed for 100 horizontal ([`21d20e0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/21d20e0fc78e9a3853abe802733388cce119ce20))
42
+
43
+ * tests WIP ([`c09644b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c09644b29ddb291c91dc58bcd6ebf02ff45cab36))
44
+
3
45
  ## v0.70.0 (2024-06-21)
4
46
 
5
47
  ### Documentation
@@ -104,8 +146,6 @@ in their parent process ([`ce37416`](https://gitlab.psi.ch/bec/bec_widgets/-/com
104
146
 
105
147
  * feat(device_input): DeviceLineEdit with QCompleter added ([`50e41ff`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/50e41ff26160ec26d77feb6d519e4dad902a9b9b))
106
148
 
107
- * feat(device_combobox): DeviceInputBase and DeviceComboBox added ([`430b282`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/430b282039806e3fbc6cf98e958861a065760620))
108
-
109
149
  ### Fix
110
150
 
111
151
  * fix(device_input_base): bug with setting config and overwriting default device and filter ([`d79f7e9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d79f7e9ccde03dc77819ca556c79736d30f7821a))
@@ -113,55 +153,3 @@ in their parent process ([`ce37416`](https://gitlab.psi.ch/bec/bec_widgets/-/com
113
153
  ### Test
114
154
 
115
155
  * test(device_input): tests added ([`1a0a98a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/1a0a98a45367db414bed813bbd346b3e1ae8d550))
116
-
117
- ## v0.64.2 (2024-06-19)
118
-
119
- ### Fix
120
-
121
- * fix(client_utils): added close rpc command to shutdown of gui from bec_ipython_client ([`e5a7d47`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e5a7d47b21cbf066f740f1d11d7c9ea7c70f3080))
122
-
123
- ## v0.64.1 (2024-06-19)
124
-
125
- ### Fix
126
-
127
- * fix(widgets): removed widget module import of sub widgets ([`216511b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/216511b951ff0e15b6d7c70133095f3ac45c23f4))
128
-
129
- ### Refactor
130
-
131
- * refactor(utils): moved get_rpc_widgets to plugin_utils ([`6dabbf8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6dabbf874fbbdde89c34a7885bf95aa9c895a28b))
132
-
133
- ### Test
134
-
135
- * test: moved rpc_classes test ([`b3575eb`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b3575eb06852b456cde915dfda281a3e778e3aeb))
136
-
137
- ## v0.64.0 (2024-06-19)
138
-
139
- ### Ci
140
-
141
- * ci: add job optional dependency check ([`27426ce`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/27426ce7a52b4cbad7f3bef114d6efe6ad73bd7f))
142
-
143
- ### Documentation
144
-
145
- * docs: fix links in developer section ([`9e16f2f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9e16f2faf9c59a5d36ae878512c5a910cca31e69))
146
-
147
- * docs: refactor developer section, add widget tutorial ([`2a36d93`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2a36d9364f242bf42e4cda4b50e6f46aa3833bbd))
148
-
149
- ### Feature
150
-
151
- * feat: add option to change size of the fonts ([`ea805d1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ea805d1362fc084d3b703b6f81b0180072f0825d))
152
-
153
- ### Fix
154
-
155
- * fix(plot_base): font size is set with setScale which is scaling the whole legend window ([`5d66720`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/5d6672069ea1cbceb62104f66c127e4e3c23e4a4))
156
-
157
- ### Test
158
-
159
- * test: add tests ([`140ad83`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/140ad83380808928edf7953e23c762ab72a0a1e9))
160
-
161
- ## v0.63.2 (2024-06-14)
162
-
163
- ### Fix
164
-
165
- * fix: do not import "server" in client, prevents from having trouble with QApplication creation order
166
-
167
- Like with QtWebEngine ([`6f96498`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6f96498de66358b89f3a2035627eed2e02dde5a1))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.70.0
3
+ Version: 0.71.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
@@ -17,6 +17,7 @@ class Widgets(str, enum.Enum):
17
17
  BECDock = "BECDock"
18
18
  BECDockArea = "BECDockArea"
19
19
  BECFigure = "BECFigure"
20
+ ScanControl = "ScanControl"
20
21
  SpiralProgressBar = "SpiralProgressBar"
21
22
  TextBox = "TextBox"
22
23
  VSCodeEditor = "VSCodeEditor"
@@ -1823,6 +1824,24 @@ class Ring(RPCBase):
1823
1824
  """
1824
1825
 
1825
1826
 
1827
+ class ScanControl(RPCBase):
1828
+ @property
1829
+ @rpc_call
1830
+ def config_dict(self) -> "dict":
1831
+ """
1832
+ Get the configuration of the widget.
1833
+
1834
+ Returns:
1835
+ dict: The configuration of the widget.
1836
+ """
1837
+
1838
+ @rpc_call
1839
+ def get_all_rpc(self) -> "dict":
1840
+ """
1841
+ Get all registered RPC objects.
1842
+ """
1843
+
1844
+
1826
1845
  class SpiralProgressBar(RPCBase):
1827
1846
  @rpc_call
1828
1847
  def get_all_rpc(self) -> "dict":
@@ -119,7 +119,7 @@ class WidgetIO:
119
119
  widget: Widget instance.
120
120
  ignore_errors(bool, optional): Whether to ignore if no handler is found.
121
121
  """
122
- handler_class = WidgetIO._handlers.get(type(widget))
122
+ handler_class = WidgetIO._find_handler(widget)
123
123
  if handler_class:
124
124
  return handler_class().get_value(widget) # Instantiate the handler
125
125
  if not ignore_errors:
@@ -136,12 +136,28 @@ class WidgetIO:
136
136
  value: Value to set.
137
137
  ignore_errors(bool, optional): Whether to ignore if no handler is found.
138
138
  """
139
- handler_class = WidgetIO._handlers.get(type(widget))
139
+ handler_class = WidgetIO._find_handler(widget)
140
140
  if handler_class:
141
141
  handler_class().set_value(widget, value) # Instantiate the handler
142
142
  elif not ignore_errors:
143
143
  raise ValueError(f"No handler for widget type: {type(widget)}")
144
144
 
145
+ @staticmethod
146
+ def _find_handler(widget):
147
+ """
148
+ Find the appropriate handler for the widget by checking its base classes.
149
+
150
+ Args:
151
+ widget: Widget instance.
152
+
153
+ Returns:
154
+ handler_class: The handler class if found, otherwise None.
155
+ """
156
+ for base in type(widget).__mro__:
157
+ if base in WidgetIO._handlers:
158
+ return WidgetIO._handlers[base]
159
+ return None
160
+
145
161
 
146
162
  ################## for exporting and importing widget hierarchies ##################
147
163
 
@@ -18,7 +18,7 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
18
18
  config: Device input configuration.
19
19
  gui_id: GUI ID.
20
20
  device_filter: Device filter, name of the device class.
21
- default_device: Default device name.
21
+ default: Default device name.
22
22
  arg_name: Argument name, can be used for the other widgets which has to call some other function in bec using correct argument names.
23
23
  """
24
24
 
@@ -29,7 +29,7 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
29
29
  config: DeviceInputConfig = None,
30
30
  gui_id: str | None = None,
31
31
  device_filter: str | None = None,
32
- default_device: str | None = None,
32
+ default: str | None = None,
33
33
  arg_name: str | None = None,
34
34
  ):
35
35
  super().__init__(client=client, config=config, gui_id=gui_id)
@@ -41,8 +41,8 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
41
41
  self.config.arg_name = arg_name
42
42
  if device_filter is not None:
43
43
  self.set_device_filter(device_filter)
44
- if default_device is not None:
45
- self.set_default_device(default_device)
44
+ if default is not None:
45
+ self.set_default_device(default)
46
46
 
47
47
  def set_device_filter(self, device_filter: str):
48
48
  """
@@ -82,3 +82,11 @@ class DeviceComboBox(DeviceInputBase, QComboBox):
82
82
  if device_obj is None:
83
83
  raise ValueError(f"Device {device_name} is not found.")
84
84
  return device_obj
85
+
86
+ def cleanup(self):
87
+ """Cleanup the widget."""
88
+ super().cleanup()
89
+
90
+ def closeEvent(self, event):
91
+ super().cleanup()
92
+ QComboBox().closeEvent(event)
@@ -5,7 +5,7 @@ from bec_widgets.utils import BECConnector, ConnectionConfig
5
5
 
6
6
  class DeviceInputConfig(ConnectionConfig):
7
7
  device_filter: str | list[str] | None = None
8
- default_device: str | None = None
8
+ default: str | None = None
9
9
  arg_name: str | None = None
10
10
 
11
11
 
@@ -65,7 +65,7 @@ class DeviceInputBase(BECConnector):
65
65
  default_device(str): Default device name.
66
66
  """
67
67
  self.validate_device(default_device)
68
- self.config.default_device = default_device
68
+ self.config.default = default_device
69
69
 
70
70
  def get_device_list(self, filter: str | list[str] | None = None) -> list[str]:
71
71
  """
@@ -118,3 +118,6 @@ class DeviceInputBase(BECConnector):
118
118
  """
119
119
  if device not in self.get_device_list(self.config.device_filter):
120
120
  raise ValueError(f"Device {device} is not valid.")
121
+
122
+ def cleanup(self):
123
+ super().cleanup()
@@ -1,6 +1,7 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
- from qtpy.QtWidgets import QCompleter, QLineEdit
3
+ from qtpy.QtCore import QSize
4
+ from qtpy.QtWidgets import QCompleter, QLineEdit, QSizePolicy
4
5
 
5
6
  from bec_widgets.widgets.device_inputs.device_input_base import DeviceInputBase, DeviceInputConfig
6
7
 
@@ -18,7 +19,7 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
18
19
  config: Device input configuration.
19
20
  gui_id: GUI ID.
20
21
  device_filter: Device filter, name of the device class.
21
- default_device: Default device name.
22
+ default: Default device name.
22
23
  arg_name: Argument name, can be used for the other widgets which has to call some other function in bec using correct argument names.
23
24
  """
24
25
 
@@ -29,7 +30,7 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
29
30
  config: DeviceInputConfig = None,
30
31
  gui_id: str | None = None,
31
32
  device_filter: str | list[str] | None = None,
32
- default_device: str | None = None,
33
+ default: str | None = None,
33
34
  arg_name: str | None = None,
34
35
  ):
35
36
  QLineEdit.__init__(self, parent=parent)
@@ -41,10 +42,14 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
41
42
 
42
43
  if arg_name is not None:
43
44
  self.config.arg_name = arg_name
45
+ self.arg_name = arg_name
44
46
  if device_filter is not None:
45
47
  self.set_device_filter(device_filter)
46
- if default_device is not None:
47
- self.set_default_device(default_device)
48
+ if default is not None:
49
+ self.set_default_device(default)
50
+
51
+ self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
52
+ self.setMinimumSize(QSize(100, 0))
48
53
 
49
54
  def set_device_filter(self, device_filter: str | list[str]):
50
55
  """
@@ -89,3 +94,11 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit):
89
94
  if device_obj is None:
90
95
  raise ValueError(f"Device {device_name} is not found.")
91
96
  return device_obj
97
+
98
+ def cleanup(self):
99
+ """Cleanup the widget."""
100
+ super().cleanup()
101
+
102
+ def closeEvent(self, event):
103
+ super().cleanup()
104
+ QLineEdit().closeEvent(event)