bec-widgets 0.57.1__py3-none-any.whl → 0.57.3__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 +42 -56
- PKG-INFO +2 -1
- bec_widgets/cli/client.py +17 -3
- bec_widgets/cli/client_utils.py +48 -49
- bec_widgets/widgets/dock/dock_area.py +17 -2
- bec_widgets/widgets/figure/plots/motor_map/motor_map.py +2 -2
- bec_widgets/widgets/figure/plots/waveform/waveform.py +0 -1
- bec_widgets/widgets/spiral_progress_bar/ring.py +26 -4
- bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py +38 -9
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/METADATA +2 -1
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/RECORD +22 -21
- docs/user/getting_started/auto_updates.md +82 -0
- docs/user/getting_started/getting_started.md +2 -1
- docs/user/getting_started/{command_line_introduction.md → quick_start.md} +37 -18
- docs/user/widgets/spiral_progress_bar.md +37 -4
- pyproject.toml +2 -1
- tests/end-2-end/conftest.py +41 -26
- tests/end-2-end/test_bec_dock_rpc_e2e.py +68 -90
- tests/end-2-end/test_bec_figure_rpc_e2e.py +18 -30
- tests/end-2-end/test_rpc_register_e2e.py +16 -26
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/WHEEL +0 -0
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
@@ -2,6 +2,48 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## v0.57.3 (2024-06-06)
|
6
|
+
|
7
|
+
### Documentation
|
8
|
+
|
9
|
+
* docs(bar): docs updated ([`4be0d14`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4be0d14b7445c2322c2aef86257db168a841265c))
|
10
|
+
|
11
|
+
* docs: fixed syntax of add_widget ([`a951ebf`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a951ebf1be6c086d094aa8abef5e0dfd1b3b8558))
|
12
|
+
|
13
|
+
* docs: added auto update; closes #206 ([`32da803`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/32da803df9f7259842c43e85ba9a0ce29a266d06))
|
14
|
+
|
15
|
+
* docs: cleanup ([`07d60cf`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/07d60cf7355d2edadb3c5ef8b86607d74b360455))
|
16
|
+
|
17
|
+
### Fix
|
18
|
+
|
19
|
+
* fix(ring): automatic updates are disabled uf user specify updates manually with .set_update; 'scan_progres' do not reset number of rings ([`e883dba`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e883dbad814dbcc0a19c341041c6d836e58a5918))
|
20
|
+
|
21
|
+
* fix(ring): enable_auto_updates(True) do not reset properties of already setup bars ([`a2abad3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a2abad344f4c0039516eb60a825afb6822c5b19a))
|
22
|
+
|
23
|
+
* fix(ring): set_min_max accepts floats ([`d44b1cf`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d44b1cf8b107cf02deedd9154b77d01c7f9ed05d))
|
24
|
+
|
25
|
+
* fix(ring): set_update changed to Literals, no need to specify endpoint manually ([`c5b6499`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c5b6499e41eb1495bf260436ca3e1b036182c360))
|
26
|
+
|
27
|
+
|
28
|
+
## v0.57.2 (2024-06-06)
|
29
|
+
|
30
|
+
### Fix
|
31
|
+
|
32
|
+
* fix(test/e2e): autoupdate e2e rewritten ([`e1af5ca`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e1af5ca60f0616835f9f41d84412f29dc298c644))
|
33
|
+
|
34
|
+
* fix(test/e2e): spiral_progress_bar e2e tests rewritten to use config_dict ([`7fb31fc`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7fb31fc4d762ff4ca839971b3092a084186f81b8))
|
35
|
+
|
36
|
+
* fix(test/e2e): dockarea and dock e2e tests changed to check asserts against config_dict ([`5c6ba65`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/5c6ba65469863ea1e6fc5abdc742650e20eba9b9))
|
37
|
+
|
38
|
+
* fix: rpc_server_dock fixture now spawns the server process ([`cd9fc46`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/cd9fc46ff8a947242c8c28adcd73d7de60b11c44))
|
39
|
+
|
40
|
+
* fix: accept scalars or numpy arrays of 1 element ([`2a88e17`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2a88e17b23436c55d25b7d3449e4af3a7689661c))
|
41
|
+
|
42
|
+
### Refactor
|
43
|
+
|
44
|
+
* refactor: move _get_output and _start_plot_process at the module level ([`69f4371`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/69f4371007c66aee6b7521a6803054025adf8c92))
|
45
|
+
|
46
|
+
|
5
47
|
## v0.57.1 (2024-06-06)
|
6
48
|
|
7
49
|
### Documentation
|
@@ -117,59 +159,3 @@
|
|
117
159
|
### Fix
|
118
160
|
|
119
161
|
* fix: removed apparently unnecessary sleep while waiting for an rpc response ([`7d64cac`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7d64cac6610b39d3553ff650354f78ead8ee6b55))
|
120
|
-
|
121
|
-
|
122
|
-
## v0.53.2 (2024-05-15)
|
123
|
-
|
124
|
-
### Ci
|
125
|
-
|
126
|
-
* ci: added echo to highlight the current branch ([`0490e80`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0490e80c48563e4fb486bce903b3ce1f08863e83))
|
127
|
-
|
128
|
-
### Fix
|
129
|
-
|
130
|
-
* fix: check device class without importing to speed up initial import time ([`9f8fbdd`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9f8fbdd5fc13cf2be10eacb41e10cf742864cd92))
|
131
|
-
|
132
|
-
* fix: speed up initial import times using lazy import (from bec_lib) ([`d1e6cd3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d1e6cd388c6c9f345f52d6096d8a75a1fa7e6934))
|
133
|
-
|
134
|
-
* fix: adapt to bec_lib changes (no more submodules in `__init__.py`) ([`5d09a13`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/5d09a13d8820a8bdb900733c97593b723a2fce1d))
|
135
|
-
|
136
|
-
|
137
|
-
## v0.53.1 (2024-05-09)
|
138
|
-
|
139
|
-
### Ci
|
140
|
-
|
141
|
-
* ci: fixed rtd pages url ([`8ff3610`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8ff36105d1e637c429915b4bfc2852d54a3c6f19))
|
142
|
-
|
143
|
-
### Fix
|
144
|
-
|
145
|
-
* fix: docs config ([`0f6a5e5`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0f6a5e5fa9530969c98a9266c9ca7b89a378ff70))
|
146
|
-
|
147
|
-
|
148
|
-
## v0.53.0 (2024-05-09)
|
149
|
-
|
150
|
-
### Ci
|
151
|
-
|
152
|
-
* ci: use formatter config of toml file ([`5cc816d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/5cc816d0af73e20c648e044a027c589704ab1625))
|
153
|
-
|
154
|
-
### Documentation
|
155
|
-
|
156
|
-
* docs: update install instructions ([`57ee735`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/57ee735e5c2436d45a285507cdc939daa20e8e8f))
|
157
|
-
|
158
|
-
### Feature
|
159
|
-
|
160
|
-
* feat: moved to pyproject.toml; closes #162 ([`c86ce30`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c86ce302a964d71ee631f0817609ab5aa0e3ab0f))
|
161
|
-
|
162
|
-
### Fix
|
163
|
-
|
164
|
-
* fix: fixed semver job and upgraded to v9 ([`32e1a9d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/32e1a9d8472eb1c25d30697d407a8ffecd04e75d))
|
165
|
-
|
166
|
-
### Refactor
|
167
|
-
|
168
|
-
* refactor: applied formatter ([`4117fd7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4117fd7b5b2090ff4fb7ad9e0d92cc87cd13ed5f))
|
169
|
-
|
170
|
-
|
171
|
-
## v0.52.1 (2024-05-08)
|
172
|
-
|
173
|
-
### Fix
|
174
|
-
|
175
|
-
* fix(docstrings): docstrings formating fixed for sphinx to properly format readdocs ([`7f2f7cd`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7f2f7cd07a14876617cd83cedde8c281fdc52c3a))
|
PKG-INFO
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: bec_widgets
|
3
|
-
Version: 0.57.
|
3
|
+
Version: 0.57.3
|
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
|
@@ -27,6 +27,7 @@ Requires-Dist: pytest; extra == 'dev'
|
|
27
27
|
Requires-Dist: pytest-qt; extra == 'dev'
|
28
28
|
Requires-Dist: pytest-random-order; extra == 'dev'
|
29
29
|
Requires-Dist: pytest-timeout; extra == 'dev'
|
30
|
+
Requires-Dist: pytest-xvfb; extra == 'dev'
|
30
31
|
Provides-Extra: pyqt5
|
31
32
|
Requires-Dist: pyqt5>=5.9; extra == 'pyqt5'
|
32
33
|
Provides-Extra: pyqt6
|
bec_widgets/cli/client.py
CHANGED
@@ -1651,6 +1651,16 @@ class BECDockArea(RPCBase, BECGuiClientMixin):
|
|
1651
1651
|
Get all registered RPC objects.
|
1652
1652
|
"""
|
1653
1653
|
|
1654
|
+
@property
|
1655
|
+
@rpc_call
|
1656
|
+
def temp_areas(self) -> "list":
|
1657
|
+
"""
|
1658
|
+
Get the temporary areas in the dock area.
|
1659
|
+
|
1660
|
+
Returns:
|
1661
|
+
list: The temporary areas in the dock area.
|
1662
|
+
"""
|
1663
|
+
|
1654
1664
|
|
1655
1665
|
class SpiralProgressBar(RPCBase):
|
1656
1666
|
@rpc_call
|
@@ -1880,7 +1890,7 @@ class Ring(RPCBase):
|
|
1880
1890
|
"""
|
1881
1891
|
|
1882
1892
|
@rpc_call
|
1883
|
-
def set_min_max_values(self, min_value: "int", max_value: "int"):
|
1893
|
+
def set_min_max_values(self, min_value: "int | float", max_value: "int | float"):
|
1884
1894
|
"""
|
1885
1895
|
None
|
1886
1896
|
"""
|
@@ -1892,9 +1902,13 @@ class Ring(RPCBase):
|
|
1892
1902
|
"""
|
1893
1903
|
|
1894
1904
|
@rpc_call
|
1895
|
-
def
|
1905
|
+
def set_update(self, mode: "Literal['manual', 'scan', 'device']", device: "str" = None):
|
1896
1906
|
"""
|
1897
|
-
|
1907
|
+
Set the update mode for the ring widget
|
1908
|
+
|
1909
|
+
Args:
|
1910
|
+
mode(str): Update mode for the ring widget. Can be "manual", "scan" or "device"
|
1911
|
+
device(str): Device name for the device readback mode, only used when mode is "device"
|
1898
1912
|
"""
|
1899
1913
|
|
1900
1914
|
@rpc_call
|
bec_widgets/cli/client_utils.py
CHANGED
@@ -61,10 +61,54 @@ def rpc_call(func):
|
|
61
61
|
return wrapper
|
62
62
|
|
63
63
|
|
64
|
+
def _get_output(process) -> None:
|
65
|
+
try:
|
66
|
+
os.set_blocking(process.stdout.fileno(), False)
|
67
|
+
os.set_blocking(process.stderr.fileno(), False)
|
68
|
+
while process.poll() is None:
|
69
|
+
readylist, _, _ = select.select([process.stdout, process.stderr], [], [], 1)
|
70
|
+
if process.stdout in readylist:
|
71
|
+
output = process.stdout.read(1024)
|
72
|
+
if output:
|
73
|
+
print(output, end="")
|
74
|
+
if process.stderr in readylist:
|
75
|
+
error_output = process.stderr.read(1024)
|
76
|
+
if error_output:
|
77
|
+
print(error_output, end="", file=sys.stderr)
|
78
|
+
except Exception as e:
|
79
|
+
print(f"Error reading process output: {str(e)}")
|
80
|
+
|
81
|
+
|
82
|
+
def _start_plot_process(gui_id, gui_class, config) -> None:
|
83
|
+
"""
|
84
|
+
Start the plot in a new process.
|
85
|
+
"""
|
86
|
+
# pylint: disable=subprocess-run-check
|
87
|
+
monitor_module = importlib.import_module("bec_widgets.cli.server")
|
88
|
+
monitor_path = monitor_module.__file__
|
89
|
+
|
90
|
+
command = [
|
91
|
+
sys.executable,
|
92
|
+
"-u",
|
93
|
+
monitor_path,
|
94
|
+
"--id",
|
95
|
+
gui_id,
|
96
|
+
"--config",
|
97
|
+
config,
|
98
|
+
"--gui_class",
|
99
|
+
gui_class.__name__,
|
100
|
+
]
|
101
|
+
process = subprocess.Popen(command, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
102
|
+
process_output_processing_thread = threading.Thread(target=_get_output, args=(process,))
|
103
|
+
process_output_processing_thread.start()
|
104
|
+
return process, process_output_processing_thread
|
105
|
+
|
106
|
+
|
64
107
|
class BECGuiClientMixin:
|
65
108
|
def __init__(self, **kwargs) -> None:
|
66
109
|
super().__init__(**kwargs)
|
67
110
|
self._process = None
|
111
|
+
self._process_output_processing_thread = None
|
68
112
|
self.auto_updates = self._get_update_script()
|
69
113
|
self._target_endpoint = MessageEndpoints.scan_status()
|
70
114
|
self._selected_device = None
|
@@ -118,7 +162,10 @@ class BECGuiClientMixin:
|
|
118
162
|
Show the figure.
|
119
163
|
"""
|
120
164
|
if self._process is None or self._process.poll() is not None:
|
121
|
-
self.
|
165
|
+
self._start_update_script()
|
166
|
+
self._process, self._process_output_processing_thread = _start_plot_process(
|
167
|
+
self._gui_id, self.__class__, self._client._service_config.redis
|
168
|
+
)
|
122
169
|
while not self.gui_is_alive():
|
123
170
|
print("Waiting for GUI to start...")
|
124
171
|
time.sleep(1)
|
@@ -138,34 +185,6 @@ class BECGuiClientMixin:
|
|
138
185
|
self._process = None
|
139
186
|
self._client.shutdown()
|
140
187
|
|
141
|
-
def _start_plot_process(self) -> None:
|
142
|
-
"""
|
143
|
-
Start the plot in a new process.
|
144
|
-
"""
|
145
|
-
self._start_update_script()
|
146
|
-
# pylint: disable=subprocess-run-check
|
147
|
-
config = self._client._service_config.redis
|
148
|
-
monitor_module = importlib.import_module("bec_widgets.cli.server")
|
149
|
-
monitor_path = monitor_module.__file__
|
150
|
-
gui_class = self.__class__.__name__
|
151
|
-
|
152
|
-
command = [
|
153
|
-
sys.executable,
|
154
|
-
"-u",
|
155
|
-
monitor_path,
|
156
|
-
"--id",
|
157
|
-
self._gui_id,
|
158
|
-
"--config",
|
159
|
-
config,
|
160
|
-
"--gui_class",
|
161
|
-
gui_class,
|
162
|
-
]
|
163
|
-
self._process = subprocess.Popen(
|
164
|
-
command, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
165
|
-
)
|
166
|
-
self._process_output_processing_thread = threading.Thread(target=self._get_output)
|
167
|
-
self._process_output_processing_thread.start()
|
168
|
-
|
169
188
|
def print_log(self) -> None:
|
170
189
|
"""
|
171
190
|
Print the log of the plot process.
|
@@ -176,26 +195,6 @@ class BECGuiClientMixin:
|
|
176
195
|
# Flush list
|
177
196
|
self.stderr_output.clear()
|
178
197
|
|
179
|
-
def _get_output(self) -> str:
|
180
|
-
try:
|
181
|
-
os.set_blocking(self._process.stdout.fileno(), False)
|
182
|
-
os.set_blocking(self._process.stderr.fileno(), False)
|
183
|
-
while self._process.poll() is None:
|
184
|
-
readylist, _, _ = select.select(
|
185
|
-
[self._process.stdout, self._process.stderr], [], [], 1
|
186
|
-
)
|
187
|
-
if self._process.stdout in readylist:
|
188
|
-
output = self._process.stdout.read(1024)
|
189
|
-
if output:
|
190
|
-
print(output, end="")
|
191
|
-
if self._process.stderr in readylist:
|
192
|
-
error_output = self._process.stderr.read(1024)
|
193
|
-
if error_output:
|
194
|
-
print(error_output, end="", file=sys.stderr)
|
195
|
-
self.stderr_output.append(error_output)
|
196
|
-
except Exception as e:
|
197
|
-
print(f"Error reading process output: {str(e)}")
|
198
|
-
|
199
198
|
|
200
199
|
class RPCResponseTimeoutError(Exception):
|
201
200
|
"""Exception raised when an RPC response is not received within the expected time."""
|
@@ -33,6 +33,7 @@ class BECDockArea(BECConnector, DockArea):
|
|
33
33
|
"detach_dock",
|
34
34
|
"attach_all",
|
35
35
|
"get_all_rpc",
|
36
|
+
"temp_areas",
|
36
37
|
]
|
37
38
|
|
38
39
|
def __init__(
|
@@ -70,9 +71,22 @@ class BECDockArea(BECConnector, DockArea):
|
|
70
71
|
|
71
72
|
@panels.setter
|
72
73
|
def panels(self, value: dict):
|
73
|
-
|
74
74
|
self.docks = WeakValueDictionary(value)
|
75
75
|
|
76
|
+
@property
|
77
|
+
def temp_areas(self) -> list:
|
78
|
+
"""
|
79
|
+
Get the temporary areas in the dock area.
|
80
|
+
|
81
|
+
Returns:
|
82
|
+
list: The temporary areas in the dock area.
|
83
|
+
"""
|
84
|
+
return list(map(str, self.tempAreas))
|
85
|
+
|
86
|
+
@temp_areas.setter
|
87
|
+
def temp_areas(self, value: list):
|
88
|
+
self.tempAreas = list(map(str, value))
|
89
|
+
|
76
90
|
def restore_state(
|
77
91
|
self, state: dict = None, missing: Literal["ignore", "error"] = "ignore", extra="bottom"
|
78
92
|
):
|
@@ -107,6 +121,7 @@ class BECDockArea(BECConnector, DockArea):
|
|
107
121
|
name(str): The name of the dock to remove.
|
108
122
|
"""
|
109
123
|
dock = self.docks.pop(name, None)
|
124
|
+
self.config.docks.pop(name, None)
|
110
125
|
if dock:
|
111
126
|
dock.close()
|
112
127
|
if len(self.docks) <= 1:
|
@@ -190,7 +205,7 @@ class BECDockArea(BECConnector, DockArea):
|
|
190
205
|
BECDock: The undocked dock.
|
191
206
|
"""
|
192
207
|
dock = self.docks[dock_name]
|
193
|
-
|
208
|
+
dock.detach()
|
194
209
|
return dock
|
195
210
|
|
196
211
|
def attach_all(self):
|
@@ -317,7 +317,7 @@ class BECMotorMap(BECPlotBase):
|
|
317
317
|
Returns:
|
318
318
|
float: Motor initial position.
|
319
319
|
"""
|
320
|
-
init_position = round(self.dev[name].read()[entry]["value"], precision)
|
320
|
+
init_position = round(float(self.dev[name].read()[entry]["value"]), precision)
|
321
321
|
return init_position
|
322
322
|
|
323
323
|
def _validate_signal_entries(
|
@@ -403,7 +403,7 @@ class BECMotorMap(BECPlotBase):
|
|
403
403
|
# Update plot title
|
404
404
|
precision = self.config.precision
|
405
405
|
self.set_title(
|
406
|
-
f"Motor position: ({round(current_x,precision)}, {round(current_y,precision)})"
|
406
|
+
f"Motor position: ({round(float(current_x),precision)}, {round(float(current_y),precision)})"
|
407
407
|
)
|
408
408
|
|
409
409
|
@pyqtSlot(dict)
|
@@ -49,7 +49,7 @@ class RingConfig(ConnectionConfig):
|
|
49
49
|
description="Background color for the progress bars. Can be tuple (R, G, B, A) or string HEX Code.",
|
50
50
|
)
|
51
51
|
index: int | None = Field(0, description="Index of the progress bar. 0 is outer ring.")
|
52
|
-
line_width: int | None = Field(
|
52
|
+
line_width: int | None = Field(10, description="Line widths for the progress bars.")
|
53
53
|
start_position: int | None = Field(
|
54
54
|
90,
|
55
55
|
description="Start position for the progress bars in degrees. Default is 90 degrees - corespons to "
|
@@ -77,7 +77,7 @@ class Ring(BECConnector):
|
|
77
77
|
"set_line_width",
|
78
78
|
"set_min_max_values",
|
79
79
|
"set_start_angle",
|
80
|
-
"
|
80
|
+
"set_update",
|
81
81
|
"reset_connection",
|
82
82
|
]
|
83
83
|
|
@@ -115,7 +115,8 @@ class Ring(BECConnector):
|
|
115
115
|
|
116
116
|
def set_value(self, value: int | float):
|
117
117
|
self.config.value = round(
|
118
|
-
max(self.config.min_value, min(self.config.max_value, value)),
|
118
|
+
float(max(self.config.min_value, min(self.config.max_value, value))),
|
119
|
+
self.config.precision,
|
119
120
|
)
|
120
121
|
|
121
122
|
def set_color(self, color: str | tuple):
|
@@ -129,7 +130,7 @@ class Ring(BECConnector):
|
|
129
130
|
def set_line_width(self, width: int):
|
130
131
|
self.config.line_width = width
|
131
132
|
|
132
|
-
def set_min_max_values(self, min_value: int, max_value: int):
|
133
|
+
def set_min_max_values(self, min_value: int | float, max_value: int | float):
|
133
134
|
self.config.min_value = min_value
|
134
135
|
self.config.max_value = max_value
|
135
136
|
|
@@ -146,6 +147,27 @@ class Ring(BECConnector):
|
|
146
147
|
converted_color = QtGui.QColor(*color)
|
147
148
|
return converted_color
|
148
149
|
|
150
|
+
def set_update(self, mode: Literal["manual", "scan", "device"], device: str = None):
|
151
|
+
"""
|
152
|
+
Set the update mode for the ring widget
|
153
|
+
|
154
|
+
Args:
|
155
|
+
mode(str): Update mode for the ring widget. Can be "manual", "scan" or "device"
|
156
|
+
device(str): Device name for the device readback mode, only used when mode is "device"
|
157
|
+
"""
|
158
|
+
if mode == "manual":
|
159
|
+
self.bec_dispatcher.disconnect_slot(
|
160
|
+
getattr(self, self.config.connections.slot), self.config.connections.endpoint
|
161
|
+
)
|
162
|
+
self.config.connections.slot = None
|
163
|
+
self.config.connections.endpoint = None
|
164
|
+
elif mode == "scan":
|
165
|
+
self.set_connections("on_scan_progress", "scans/scan_progress")
|
166
|
+
elif mode == "device":
|
167
|
+
self.set_connections("on_device_readback", f"internal/devices/readback/{device}")
|
168
|
+
|
169
|
+
self.parent_progress_widget.enable_auto_updates(False)
|
170
|
+
|
149
171
|
def set_connections(self, slot: str, endpoint: str | EndpointInfo):
|
150
172
|
if self.config.connections.endpoint == endpoint and self.config.connections.slot == slot:
|
151
173
|
return
|
@@ -23,7 +23,7 @@ class SpiralProgressBarConfig(ConnectionConfig):
|
|
23
23
|
10, description="Maximum number of progress bars to display."
|
24
24
|
)
|
25
25
|
num_bars: int | None = Field(1, description="Number of progress bars to display.")
|
26
|
-
gap: int | None = Field(
|
26
|
+
gap: int | None = Field(20, description="Gap between progress bars.")
|
27
27
|
auto_updates: bool | None = Field(
|
28
28
|
True, description="Enable or disable updates based on scan queue status."
|
29
29
|
)
|
@@ -118,7 +118,7 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
118
118
|
|
119
119
|
# For updating bar behaviour
|
120
120
|
self._auto_updates = True
|
121
|
-
self._rings =
|
121
|
+
self._rings = None
|
122
122
|
|
123
123
|
if num_bars is not None:
|
124
124
|
self.config.num_bars = max(
|
@@ -186,13 +186,22 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
186
186
|
Ring: Ring object.
|
187
187
|
"""
|
188
188
|
if self.config.num_bars < self.config.max_number_of_bars:
|
189
|
-
|
190
|
-
|
189
|
+
ring_index = self.config.num_bars
|
190
|
+
ring_config = RingConfig(
|
191
|
+
widget_class="Ring",
|
192
|
+
index=ring_index,
|
193
|
+
start_positions=90 * 16,
|
194
|
+
directions=-1,
|
195
|
+
**kwargs,
|
196
|
+
)
|
197
|
+
ring = Ring(parent_progress_widget=self, config=ring_config)
|
191
198
|
self.config.num_bars += 1
|
192
199
|
self._rings.append(ring)
|
193
200
|
self.config.rings.append(ring.config)
|
194
201
|
if self.config.color_map:
|
195
202
|
self.set_colors_from_map(self.config.color_map)
|
203
|
+
base_line_width = self._rings[ring.config.index].config.line_width
|
204
|
+
self.set_line_widths(base_line_width, ring.config.index)
|
196
205
|
self.update()
|
197
206
|
return ring
|
198
207
|
|
@@ -211,6 +220,7 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
211
220
|
self._reindex_rings()
|
212
221
|
if self.config.color_map:
|
213
222
|
self.set_colors_from_map(self.config.color_map)
|
223
|
+
del ring
|
214
224
|
self.update()
|
215
225
|
|
216
226
|
def _reindex_rings(self):
|
@@ -269,9 +279,30 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
269
279
|
num_bars = max(
|
270
280
|
self.config.min_number_of_bars, min(num_bars, self.config.max_number_of_bars)
|
271
281
|
)
|
272
|
-
|
273
|
-
|
274
|
-
|
282
|
+
current_num_bars = self.config.num_bars
|
283
|
+
|
284
|
+
if num_bars > current_num_bars:
|
285
|
+
for i in range(current_num_bars, num_bars):
|
286
|
+
new_ring_config = RingConfig(
|
287
|
+
widget_class="Ring", index=i, start_positions=90 * 16, directions=-1
|
288
|
+
)
|
289
|
+
self.config.rings.append(new_ring_config)
|
290
|
+
new_ring = Ring(parent_progress_widget=self, config=new_ring_config)
|
291
|
+
self._rings.append(new_ring)
|
292
|
+
|
293
|
+
elif num_bars < current_num_bars:
|
294
|
+
for i in range(current_num_bars - 1, num_bars - 1, -1):
|
295
|
+
self.remove_ring(i)
|
296
|
+
|
297
|
+
self.config.num_bars = num_bars
|
298
|
+
|
299
|
+
if self.config.color_map:
|
300
|
+
self.set_colors_from_map(self.config.color_map)
|
301
|
+
|
302
|
+
base_line_width = self._rings[0].config.line_width
|
303
|
+
self.set_line_widths(base_line_width)
|
304
|
+
|
305
|
+
self.update()
|
275
306
|
|
276
307
|
def set_value(self, values: int | list, ring_index: int = None):
|
277
308
|
"""
|
@@ -443,8 +474,6 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
443
474
|
if report_instructions:
|
444
475
|
instruction_type = list(report_instructions[0].keys())[0]
|
445
476
|
if instruction_type == "scan_progress":
|
446
|
-
if self.config.num_bars != 1:
|
447
|
-
self.set_number_of_bars(1)
|
448
477
|
self._hook_scan_progress(ring_index=0)
|
449
478
|
elif instruction_type == "readback":
|
450
479
|
devices = report_instructions[0].get("readback").get("devices")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: bec_widgets
|
3
|
-
Version: 0.57.
|
3
|
+
Version: 0.57.3
|
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
|
@@ -27,6 +27,7 @@ Requires-Dist: pytest; extra == 'dev'
|
|
27
27
|
Requires-Dist: pytest-qt; extra == 'dev'
|
28
28
|
Requires-Dist: pytest-random-order; extra == 'dev'
|
29
29
|
Requires-Dist: pytest-timeout; extra == 'dev'
|
30
|
+
Requires-Dist: pytest-xvfb; extra == 'dev'
|
30
31
|
Provides-Extra: pyqt5
|
31
32
|
Requires-Dist: pyqt5>=5.9; extra == 'pyqt5'
|
32
33
|
Provides-Extra: pyqt6
|
@@ -2,11 +2,11 @@
|
|
2
2
|
.gitlab-ci.yml,sha256=RF2JeGh8tG09DyAOwEu991IZy3C8Vm6lI8O_4Dr9B9Q,12239
|
3
3
|
.pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
|
4
4
|
.readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
|
5
|
-
CHANGELOG.md,sha256=
|
5
|
+
CHANGELOG.md,sha256=5H1fQ0fZSKvNRSrVkZJ00ZkSff7DzKmFjg35jPc8vTg,7199
|
6
6
|
LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
7
|
-
PKG-INFO,sha256=
|
7
|
+
PKG-INFO,sha256=NUwnybNOdIQRdfaJCymSOUpaYxAZhsEK9CIhk0hPz2I,1178
|
8
8
|
README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
|
9
|
-
pyproject.toml,sha256
|
9
|
+
pyproject.toml,sha256=ZLJ-JsjWQsfDxZAyCiSNk5Io50lUBDI-SlY562nGgEw,1822
|
10
10
|
.git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
|
11
11
|
.gitlab/issue_templates/bug_report_template.md,sha256=gAuyEwl7XlnebBrkiJ9AqffSNOywmr8vygUFWKTuQeI,386
|
12
12
|
.gitlab/issue_templates/documentation_update_template.md,sha256=FHLdb3TS_D9aL4CYZCjyXSulbaW5mrN2CmwTaeLPbNw,860
|
@@ -17,8 +17,8 @@ bec_widgets/assets/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqgdX7a00nM3i
|
|
17
17
|
bec_widgets/assets/terminal_icon.png,sha256=bJl7Tft4Fi2uxvuXI8o14uMHnI9eAWKSU2uftXCH9ws,3889
|
18
18
|
bec_widgets/cli/__init__.py,sha256=tLD8HWgyURhMjYlKZ43pBu-qvGD1LI5o3n3rEieg-70,43
|
19
19
|
bec_widgets/cli/auto_updates.py,sha256=8x4_SrD8Hh1RbrUWXLfisw6X5v8Mij2DiTfjvn9dkUw,4692
|
20
|
-
bec_widgets/cli/client.py,sha256=
|
21
|
-
bec_widgets/cli/client_utils.py,sha256=
|
20
|
+
bec_widgets/cli/client.py,sha256=E6t7gZzM3-YogkKdFz53PIXdHnkWhKyfSwRr2lu2hz0,53363
|
21
|
+
bec_widgets/cli/client_utils.py,sha256=7u8P9EYgLPJuAcHxnFiZi-gCZohO3vAn0W7dqsSrs4M,10660
|
22
22
|
bec_widgets/cli/generate_cli.py,sha256=tBt-F4Xccg9Pj2zuDEGHd0Ho1fKLfCf3PuSa8KmelQk,4431
|
23
23
|
bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
|
24
24
|
bec_widgets/cli/rpc_wigdet_handler.py,sha256=OXHoiDFJPzbQ5RO0bzIX5aUXeMMlJTwAiTmB0_7Chj4,913
|
@@ -49,7 +49,7 @@ bec_widgets/utils/yaml_dialog.py,sha256=cMVif-39SB9WjwGH5FWBJcFs4tnfFJFs5cacydRy
|
|
49
49
|
bec_widgets/widgets/__init__.py,sha256=LKgIuY3CI-NHCa_bY9pThYhxLH0MHDo8iNEJDDVIVmw,172
|
50
50
|
bec_widgets/widgets/dock/__init__.py,sha256=B7foHt02gnhM7mFksa7GJVwT7n0j_JvYDCt6wc6XR5g,61
|
51
51
|
bec_widgets/widgets/dock/dock.py,sha256=kdX0ZbuUdx6XETZ1NUgzBWlee_Q7JcN3fXpARDAlre8,8955
|
52
|
-
bec_widgets/widgets/dock/dock_area.py,sha256=
|
52
|
+
bec_widgets/widgets/dock/dock_area.py,sha256=Yj01iI5Lzh-Rf6D9Z4m48JItVHC-1954MJHfjYimEE8,7731
|
53
53
|
bec_widgets/widgets/figure/__init__.py,sha256=3hGx_KOV7QHCYAV06aNuUgKq4QIYCjUTad-DrwkUaBM,44
|
54
54
|
bec_widgets/widgets/figure/figure.py,sha256=OzeKZme89JnzMcKT1sACnyw951EtRoSUALl58upY6b4,29762
|
55
55
|
bec_widgets/widgets/figure/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -59,9 +59,9 @@ bec_widgets/widgets/figure/plots/image/image.py,sha256=fdANm_lMzmKeddwCq3Arc1p48
|
|
59
59
|
bec_widgets/widgets/figure/plots/image/image_item.py,sha256=1oytCY2IIgRbtS3GRrp9JV02KOif78O2-iaK0qYuHFU,9058
|
60
60
|
bec_widgets/widgets/figure/plots/image/image_processor.py,sha256=59JwHMEBjLo72fmrAB7W1PFBT2oBe16heBaZfYM6MAk,4368
|
61
61
|
bec_widgets/widgets/figure/plots/motor_map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
|
-
bec_widgets/widgets/figure/plots/motor_map/motor_map.py,sha256=
|
62
|
+
bec_widgets/widgets/figure/plots/motor_map/motor_map.py,sha256=Ff2WoNHxO_A3ggsbSd_AVUP1JeOWMuJs-0GLskxn-94,15267
|
63
63
|
bec_widgets/widgets/figure/plots/waveform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
|
-
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=
|
64
|
+
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=U0d4Qdsej9AlHrAf7krgE4AFWEkK_Y-IAGjH-Tv9bT0,21663
|
65
65
|
bec_widgets/widgets/figure/plots/waveform/waveform_curve.py,sha256=9q7nJfyH8y9rWw_AIOd6tk7cbckoAGNLHv2oHEKCCyo,7229
|
66
66
|
bec_widgets/widgets/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
bec_widgets/widgets/jupyter_console/jupyter_console.py,sha256=ioLYJL31RdBoAOGFSS8PVSnUhkWPWmLC3tiKp7CouO8,2251
|
@@ -82,8 +82,8 @@ bec_widgets/widgets/motor_control/selection/selection.ui,sha256=vXXpvNWuL6xyHhW7
|
|
82
82
|
bec_widgets/widgets/scan_control/__init__.py,sha256=IOfHl15vxb_uC6KN62-PeUzbBha_vQyqkkXbJ2HU674,38
|
83
83
|
bec_widgets/widgets/scan_control/scan_control.py,sha256=B5n2U2iVtTCY3Tx93JyBqzGCDCmWhWwAOhbPelLI-bs,17168
|
84
84
|
bec_widgets/widgets/spiral_progress_bar/__init__.py,sha256=4efbtcqCToMIw5bkQrTzy2TzuBCXvlhuUPh1bYC_Yzg,51
|
85
|
-
bec_widgets/widgets/spiral_progress_bar/ring.py,sha256=
|
86
|
-
bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py,sha256=
|
85
|
+
bec_widgets/widgets/spiral_progress_bar/ring.py,sha256=zYz_wq5f-mfI32_melkxyzMbx4RStUU1bpwMp0jm9d4,8057
|
86
|
+
bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py,sha256=BWhkuVrHUhLWDlpNNhhFfH2cU_tIhB-nhJMH-SLiPyE,23599
|
87
87
|
bec_widgets/widgets/toolbar/__init__.py,sha256=d-TP4_cr_VbpwreMM4ePnfZ5YXsEPQ45ibEf75nuGoE,36
|
88
88
|
bec_widgets/widgets/toolbar/toolbar.py,sha256=e0zCD_0q7K4NVhrzD8001Qvfxt-VhqHTgofchS9NgCM,5125
|
89
89
|
docs/Makefile,sha256=i2WHuFlgfyAPEW4ssEP8NY4cOibDJrVjvzSEU8_Ggwc,634
|
@@ -108,24 +108,25 @@ docs/user/customisation.md,sha256=Og0NuUsTs8HdwKtpHnycGmH8wCqOeYgj2ozlYRJ-Drk,24
|
|
108
108
|
docs/user/user.md,sha256=uCTcjclIi6rdjYRQebko6bWFEVsjyfshsVU3BDYrC-Y,1403
|
109
109
|
docs/user/api_reference/api_reference.md,sha256=q2Imc48Rq6GcAP0R4bS3KuW5ptZZdsV4wxGJb3JJQHg,174
|
110
110
|
docs/user/applications/applications.md,sha256=yOECfaYRUEDIxF-O0duOwSJlG4f93RylrpMjbw1-8Dg,100
|
111
|
-
docs/user/getting_started/
|
112
|
-
docs/user/getting_started/getting_started.md,sha256=
|
111
|
+
docs/user/getting_started/auto_updates.md,sha256=Gicx3lplI6JRBlnPj_VL6IhqOIcsWjYF4_EdZSCje2A,3754
|
112
|
+
docs/user/getting_started/getting_started.md,sha256=lxZXCr6HAkM61oo5Bu-YjINSKo4wihWhAPJdotEAAVQ,358
|
113
113
|
docs/user/getting_started/gui_complex_gui.gif,sha256=ovv9u371BGG5GqhzyBMl4mvqMHLfJS0ylr-dR0Ydwtw,6550393
|
114
114
|
docs/user/getting_started/installation.md,sha256=nBl2Hfvo6ua3-tVZn1B-UG0hCTlrFY6_ibXHWnXeegs,1135
|
115
|
+
docs/user/getting_started/quick_start.md,sha256=MNXEaww5hiQY7N7AQhrmbxdYQHimFk_iKQW8tS-72cU,9337
|
115
116
|
docs/user/widgets/bec_figure.md,sha256=Ph8ajmESk71Y9nBJsLKLiN-YvGJwN4FdN_Rs3jcObwE,5068
|
116
117
|
docs/user/widgets/image_plot.gif,sha256=_mVFhMTXGqwDOcEtrBHMZj5Thn2sLhDAHEeL2XyHN-s,14098977
|
117
118
|
docs/user/widgets/motor.gif,sha256=FtaWdRHx4UZaGJPpq8LNhMMgX4PFcAB6IZ93JCMEh_w,2280719
|
118
119
|
docs/user/widgets/progress_bar.gif,sha256=5jh0Zw2BBGPuNxszV1DBLJCb4_6glIRX-U2ABjnsK2k,5263592
|
119
120
|
docs/user/widgets/scatter_2D.gif,sha256=yHpsuAUseMafJjI_J5BcOhmE3nu9VFn_Xm9XHzJaH5I,13188862
|
120
|
-
docs/user/widgets/spiral_progress_bar.md,sha256=
|
121
|
+
docs/user/widgets/spiral_progress_bar.md,sha256=QTgUDIl6XPuK_HwSfB6sNijZ4bss26biDg6B_mJ8Pxk,2208
|
121
122
|
docs/user/widgets/w1D.gif,sha256=tuHbleJpl6bJFNNC2OdndF5LF7IyfvlkFCMGZajrQPs,622773
|
122
123
|
docs/user/widgets/widgets.md,sha256=NFdqTlLTHXueErLzvw4wHwTUrzRSEuRelb1fiT4PySg,352
|
123
124
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
125
|
tests/end-2-end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
125
|
-
tests/end-2-end/conftest.py,sha256=
|
126
|
-
tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=
|
127
|
-
tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=
|
128
|
-
tests/end-2-end/test_rpc_register_e2e.py,sha256=
|
126
|
+
tests/end-2-end/conftest.py,sha256=taLqiYVzOhJjMre5ypgQjB7wzSXP4soKANW3XfAjems,1773
|
127
|
+
tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=G-YBfOhJCyV6g74mxXuhAPA9E_BPQ6EUT6xS278aq34,8865
|
128
|
+
tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=yIbGoDJRN22XVmNASCSh51MdcCMSan1d1qNW1QIXiVk,5082
|
129
|
+
tests/end-2-end/test_rpc_register_e2e.py,sha256=yUt0-UzWZX1keyHO-dyK0zIevtTgBWLP47_zpcvBywI,1583
|
129
130
|
tests/unit_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
130
131
|
tests/unit_tests/client_mocks.py,sha256=ErrklY7446jXE2_XGKebs_a-2Pqif5ECOPvxVAKRZXY,4170
|
131
132
|
tests/unit_tests/conftest.py,sha256=KrnktXPWmZhnKNue-xGWOLD1XGEvdz9Vf7V2eO3XQ3A,596
|
@@ -150,7 +151,7 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
|
|
150
151
|
tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
|
151
152
|
tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
152
153
|
tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
|
153
|
-
bec_widgets-0.57.
|
154
|
-
bec_widgets-0.57.
|
155
|
-
bec_widgets-0.57.
|
156
|
-
bec_widgets-0.57.
|
154
|
+
bec_widgets-0.57.3.dist-info/METADATA,sha256=NUwnybNOdIQRdfaJCymSOUpaYxAZhsEK9CIhk0hPz2I,1178
|
155
|
+
bec_widgets-0.57.3.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
156
|
+
bec_widgets-0.57.3.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
157
|
+
bec_widgets-0.57.3.dist-info/RECORD,,
|