bec-widgets 0.63.2__py3-none-any.whl → 0.64.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .gitlab-ci.yml +34 -27
- CHANGELOG.md +36 -42
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +39 -9
- bec_widgets/cli/generate_cli.py +2 -48
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +1 -1
- bec_widgets/utils/plugin_utils.py +48 -0
- bec_widgets/widgets/__init__.py +5 -5
- bec_widgets/widgets/dock/dock.py +1 -1
- bec_widgets/widgets/figure/figure.py +6 -0
- bec_widgets/widgets/figure/plots/plot_base.py +62 -6
- bec_widgets/widgets/figure/plots/waveform/waveform.py +2 -0
- {bec_widgets-0.63.2.dist-info → bec_widgets-0.64.1.dist-info}/METADATA +1 -1
- {bec_widgets-0.63.2.dist-info → bec_widgets-0.64.1.dist-info}/RECORD +36 -32
- docs/developer/developer.md +38 -10
- docs/developer/getting_started/development.md +27 -0
- docs/developer/getting_started/getting_started.md +12 -0
- docs/developer/widgets/widgets.md +12 -0
- docs/user/customisation.md +2 -2
- docs/user/getting_started/installation.md +1 -1
- docs/user/widgets/buttons.md +1 -1
- docs/user/widgets/text_box.md +1 -1
- pyproject.toml +1 -1
- tests/end-2-end/conftest.py +2 -1
- tests/unit_tests/test_bec_dock.py +1 -1
- tests/unit_tests/test_bec_figure.py +1 -1
- tests/unit_tests/test_generate_cli_client.py +0 -14
- tests/unit_tests/test_plot_base.py +27 -0
- tests/unit_tests/test_plugin_utils.py +14 -0
- tests/unit_tests/test_scan_control.py +1 -1
- tests/unit_tests/test_spiral_progress_bar.py +1 -1
- tests/unit_tests/test_stop_button.py +1 -1
- tests/unit_tests/test_waveform1d.py +25 -9
- {bec_widgets-0.63.2.dist-info → bec_widgets-0.64.1.dist-info}/WHEEL +0 -0
- {bec_widgets-0.63.2.dist-info → bec_widgets-0.64.1.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.63.2.dist-info → bec_widgets-0.64.1.dist-info}/licenses/LICENSE +0 -0
.gitlab-ci.yml
CHANGED
@@ -22,6 +22,13 @@ workflow:
|
|
22
22
|
|
23
23
|
include:
|
24
24
|
- template: Security/Secret-Detection.gitlab-ci.yml
|
25
|
+
- project: "bec/awi_utils"
|
26
|
+
file: "/templates/check-packages-job.yml"
|
27
|
+
inputs:
|
28
|
+
stage: test
|
29
|
+
path: "."
|
30
|
+
pytest_args: "-v --random-order tests/"
|
31
|
+
exclude_packages: ""
|
25
32
|
|
26
33
|
# different stages in the pipeline
|
27
34
|
stages:
|
@@ -32,21 +39,21 @@ stages:
|
|
32
39
|
- Deploy
|
33
40
|
|
34
41
|
.install-qt-webengine-deps: &install-qt-webengine-deps
|
35
|
-
|
36
|
-
|
42
|
+
- apt-get -y install libnss3 libxdamage1 libasound2 libatomic1 libxcursor1
|
43
|
+
- export QTWEBENGINE_DISABLE_SANDBOX=1
|
37
44
|
|
38
45
|
.clone-repos: &clone-repos
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
- git clone --branch $BEC_CORE_BRANCH https://gitlab.psi.ch/bec/bec.git
|
47
|
+
- git clone --branch $OPHYD_DEVICES_BRANCH https://gitlab.psi.ch/bec/ophyd_devices.git
|
48
|
+
- export OHPYD_DEVICES_PATH=$PWD/ophyd_devices
|
49
|
+
|
43
50
|
.install-os-packages: &install-os-packages
|
44
|
-
|
45
|
-
|
46
|
-
|
51
|
+
- apt-get update
|
52
|
+
- apt-get install -y libgl1-mesa-glx libegl1-mesa x11-utils libxkbcommon-x11-0 libdbus-1-3
|
53
|
+
- *install-qt-webengine-deps
|
47
54
|
|
48
55
|
before_script:
|
49
|
-
- if [[ "$CI_PROJECT_PATH" != "bec/bec_widgets" ]]; then
|
56
|
+
- if [[ "$CI_PROJECT_PATH" != "bec/bec_widgets" ]]; then
|
50
57
|
echo -e "\033[35;1m Using branch $CHILD_PIPELINE_BRANCH of BEC Widgets \033[0;m";
|
51
58
|
test -d bec_widgets || git clone --branch $CHILD_PIPELINE_BRANCH https://gitlab.psi.ch/bec/bec_widgets.git; cd bec_widgets;
|
52
59
|
fi
|
@@ -92,10 +99,10 @@ pylint-check:
|
|
92
99
|
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
93
100
|
# Identify changed Python files
|
94
101
|
- if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then
|
95
|
-
|
96
|
-
|
102
|
+
TARGET_BRANCH_COMMIT_SHA=$(git rev-parse origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME);
|
103
|
+
CHANGED_FILES=$(git diff --name-only $TARGET_BRANCH_COMMIT_SHA HEAD | grep '\.py$' || true);
|
97
104
|
else
|
98
|
-
|
105
|
+
CHANGED_FILES=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep '\.py$' || true);
|
99
106
|
fi
|
100
107
|
- if [ -z "$CHANGED_FILES" ]; then echo "No Python files changed."; exit 0; fi
|
101
108
|
|
@@ -120,7 +127,7 @@ tests:
|
|
120
127
|
stage: test
|
121
128
|
needs: []
|
122
129
|
variables:
|
123
|
-
|
130
|
+
QT_QPA_PLATFORM: "offscreen"
|
124
131
|
script:
|
125
132
|
- *clone-repos
|
126
133
|
- *install-os-packages
|
@@ -141,21 +148,21 @@ tests:
|
|
141
148
|
test-matrix:
|
142
149
|
parallel:
|
143
150
|
matrix:
|
144
|
-
- PYTHON_VERSION:
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
QT_PCKG:
|
149
|
-
|
150
|
-
|
151
|
-
|
151
|
+
- PYTHON_VERSION:
|
152
|
+
- "3.10"
|
153
|
+
- "3.11"
|
154
|
+
- "3.12"
|
155
|
+
QT_PCKG:
|
156
|
+
- "pyside6"
|
157
|
+
- "pyqt5"
|
158
|
+
- "pyqt6"
|
152
159
|
|
153
160
|
stage: AdditionalTests
|
154
161
|
needs: []
|
155
162
|
variables:
|
156
|
-
|
157
|
-
|
158
|
-
|
163
|
+
QT_QPA_PLATFORM: "offscreen"
|
164
|
+
PYTHON_VERSION: ""
|
165
|
+
QT_PCKG: ""
|
159
166
|
image: $CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/python:$PYTHON_VERSION
|
160
167
|
script:
|
161
168
|
- *clone-repos
|
@@ -226,7 +233,7 @@ semver:
|
|
226
233
|
- pip install python-semantic-release==9.* wheel build twine
|
227
234
|
- export GL_TOKEN=$CI_UPDATES
|
228
235
|
- semantic-release -vv version
|
229
|
-
|
236
|
+
|
230
237
|
# check if any artifacts were created
|
231
238
|
- if [ ! -d dist ]; then echo No release will be made; exit 0; fi
|
232
239
|
- twine upload dist/* -u __token__ -p $CI_PYPI_TOKEN --skip-existing
|
@@ -242,7 +249,7 @@ pages:
|
|
242
249
|
variables:
|
243
250
|
TARGET_BRANCH: $CI_COMMIT_REF_NAME
|
244
251
|
rules:
|
245
|
-
- if:
|
252
|
+
- if: "$CI_COMMIT_TAG != null"
|
246
253
|
variables:
|
247
254
|
TARGET_BRANCH: $CI_COMMIT_TAG
|
248
255
|
- if: '$CI_COMMIT_REF_NAME == "main" && $CI_PROJECT_PATH == "bec/bec_widgets"'
|
CHANGELOG.md
CHANGED
@@ -1,6 +1,42 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v0.64.1 (2024-06-19)
|
3
4
|
|
5
|
+
### Fix
|
6
|
+
|
7
|
+
* fix(widgets): removed widget module import of sub widgets ([`216511b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/216511b951ff0e15b6d7c70133095f3ac45c23f4))
|
8
|
+
|
9
|
+
### Refactor
|
10
|
+
|
11
|
+
* refactor(utils): moved get_rpc_widgets to plugin_utils ([`6dabbf8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6dabbf874fbbdde89c34a7885bf95aa9c895a28b))
|
12
|
+
|
13
|
+
### Test
|
14
|
+
|
15
|
+
* test: moved rpc_classes test ([`b3575eb`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b3575eb06852b456cde915dfda281a3e778e3aeb))
|
16
|
+
|
17
|
+
## v0.64.0 (2024-06-19)
|
18
|
+
|
19
|
+
### Ci
|
20
|
+
|
21
|
+
* ci: add job optional dependency check ([`27426ce`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/27426ce7a52b4cbad7f3bef114d6efe6ad73bd7f))
|
22
|
+
|
23
|
+
### Documentation
|
24
|
+
|
25
|
+
* docs: fix links in developer section ([`9e16f2f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9e16f2faf9c59a5d36ae878512c5a910cca31e69))
|
26
|
+
|
27
|
+
* docs: refactor developer section, add widget tutorial ([`2a36d93`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/2a36d9364f242bf42e4cda4b50e6f46aa3833bbd))
|
28
|
+
|
29
|
+
### Feature
|
30
|
+
|
31
|
+
* feat: add option to change size of the fonts ([`ea805d1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ea805d1362fc084d3b703b6f81b0180072f0825d))
|
32
|
+
|
33
|
+
### Fix
|
34
|
+
|
35
|
+
* 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))
|
36
|
+
|
37
|
+
### Test
|
38
|
+
|
39
|
+
* test: add tests ([`140ad83`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/140ad83380808928edf7953e23c762ab72a0a1e9))
|
4
40
|
|
5
41
|
## v0.63.2 (2024-06-14)
|
6
42
|
|
@@ -16,7 +52,6 @@ Like with QtWebEngine ([`6f96498`](https://gitlab.psi.ch/bec/bec_widgets/-/commi
|
|
16
52
|
|
17
53
|
This reverts commit fe04dd80e59a0e74f7fdea603e0642707ecc7c2a. ([`836b6e6`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/836b6e64f694916d6b6f909dedf11a4a6d2c86a4))
|
18
54
|
|
19
|
-
|
20
55
|
## v0.63.1 (2024-06-13)
|
21
56
|
|
22
57
|
### Fix
|
@@ -26,7 +61,6 @@ This reverts commit fe04dd80e59a0e74f7fdea603e0642707ecc7c2a. ([`836b6e6`](https
|
|
26
61
|
The proper finalization sequence will be executed by the remote process
|
27
62
|
on SIGTERM ([`9263f8e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9263f8ef5c17ae7a007a1a564baf787b39061756))
|
28
63
|
|
29
|
-
|
30
64
|
## v0.63.0 (2024-06-13)
|
31
65
|
|
32
66
|
### Documentation
|
@@ -51,7 +85,6 @@ on SIGTERM ([`9263f8e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9263f8ef5
|
|
51
85
|
|
52
86
|
This reverts commit abc6caa2d0b6141dfbe1f3d025f78ae14deddcb3 ([`fe04dd8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/fe04dd80e59a0e74f7fdea603e0642707ecc7c2a))
|
53
87
|
|
54
|
-
|
55
88
|
## v0.62.0 (2024-06-12)
|
56
89
|
|
57
90
|
### Feature
|
@@ -62,7 +95,6 @@ This reverts commit abc6caa2d0b6141dfbe1f3d025f78ae14deddcb3 ([`fe04dd8`](https:
|
|
62
95
|
|
63
96
|
* doc: add documentation about creating custom GUI applications embedding BEC Widgets ([`17a0068`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/17a00687579f5efab1990cd83862ec0e78198633))
|
64
97
|
|
65
|
-
|
66
98
|
## v0.61.0 (2024-06-12)
|
67
99
|
|
68
100
|
### Feature
|
@@ -73,7 +105,6 @@ This reverts commit abc6caa2d0b6141dfbe1f3d025f78ae14deddcb3 ([`fe04dd8`](https:
|
|
73
105
|
|
74
106
|
* refactor: improve labe of auto_update script ([`40b5688`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/40b568815893cd41af3531bb2e647ca1e2e315f4))
|
75
107
|
|
76
|
-
|
77
108
|
## v0.60.0 (2024-06-08)
|
78
109
|
|
79
110
|
### Ci
|
@@ -116,14 +147,12 @@ This reverts commit abc6caa2d0b6141dfbe1f3d025f78ae14deddcb3 ([`fe04dd8`](https:
|
|
116
147
|
|
117
148
|
* test: added missing pylint statement to header ([`f662985`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/f6629852ebc2b4ee239fa560cc310a5ae2627cf7))
|
118
149
|
|
119
|
-
|
120
150
|
## v0.59.1 (2024-06-07)
|
121
151
|
|
122
152
|
### Fix
|
123
153
|
|
124
154
|
* fix(curve): set_color_map_z typo fixed in user access ([`e7838b0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e7838b0f2fc23b0a232ed7d68fbd7f3493a91b9e))
|
125
155
|
|
126
|
-
|
127
156
|
## v0.59.0 (2024-06-07)
|
128
157
|
|
129
158
|
### Build
|
@@ -139,38 +168,3 @@ This reverts commit abc6caa2d0b6141dfbe1f3d025f78ae14deddcb3 ([`fe04dd8`](https:
|
|
139
168
|
### Documentation
|
140
169
|
|
141
170
|
* docs: added website docs ([`cf6e5a4`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/cf6e5a40fc8320e9898a446a5bf14b77e94ef013))
|
142
|
-
|
143
|
-
### Feature
|
144
|
-
|
145
|
-
* feat(widget): added simple website widget with rpc ([`64abd67`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/64abd67b9b416bff9c89880b248d6e8639aa1e70))
|
146
|
-
|
147
|
-
|
148
|
-
## v0.58.1 (2024-06-07)
|
149
|
-
|
150
|
-
### Fix
|
151
|
-
|
152
|
-
* fix(dock): new dock can be detached upon creation ([`02a2608`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/02a26086c4540127a11c235cba30afc4fd712007))
|
153
|
-
|
154
|
-
|
155
|
-
## v0.58.0 (2024-06-07)
|
156
|
-
|
157
|
-
### Feature
|
158
|
-
|
159
|
-
* feat(utils.colors): general color validators ([`3094632`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/30946321348abc349fb4003dc39d0232dc19606c))
|
160
|
-
|
161
|
-
### Fix
|
162
|
-
|
163
|
-
* fix: bar colormap dynamic setting ([`67fd5e8`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/67fd5e8581f60fe64027ac57f1f12cefa4d28343))
|
164
|
-
|
165
|
-
* fix: formatting isort ([`bf699ec`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/bf699ec1fbe2aacd31854e84fb0438c336840fcf))
|
166
|
-
|
167
|
-
* fix(curve): 2D scatter updated if color_map_z is changed ([`6985ff0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6985ff0fcef9791b53198206ec8cbccd1d65ef99))
|
168
|
-
|
169
|
-
* fix(curve): color_map_z setting works ([`33f7be4`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/33f7be42c512402dab3fdd9781a8234e3ec5f4ba))
|
170
|
-
|
171
|
-
### Test
|
172
|
-
|
173
|
-
* test(color): validation tests added ([`c0ddece`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c0ddeceeeabacbf33019a8f24b18821926dc17ac))
|
174
|
-
|
175
|
-
|
176
|
-
## v0.57.7 (2024-06-07)
|
PKG-INFO
CHANGED
bec_widgets/cli/client.py
CHANGED
@@ -1044,33 +1044,37 @@ class BECImageShow(RPCBase):
|
|
1044
1044
|
- y_scale: Literal["linear", "log"]
|
1045
1045
|
- x_lim: tuple
|
1046
1046
|
- y_lim: tuple
|
1047
|
+
- legend_label_size: int
|
1047
1048
|
"""
|
1048
1049
|
|
1049
1050
|
@rpc_call
|
1050
|
-
def set_title(self, title: "str"):
|
1051
|
+
def set_title(self, title: "str", size: "int" = None):
|
1051
1052
|
"""
|
1052
1053
|
Set the title of the plot widget.
|
1053
1054
|
|
1054
1055
|
Args:
|
1055
1056
|
title(str): Title of the plot widget.
|
1057
|
+
size(int): Font size of the title.
|
1056
1058
|
"""
|
1057
1059
|
|
1058
1060
|
@rpc_call
|
1059
|
-
def set_x_label(self, label: "str"):
|
1061
|
+
def set_x_label(self, label: "str", size: "int" = None):
|
1060
1062
|
"""
|
1061
1063
|
Set the label of the x-axis.
|
1062
1064
|
|
1063
1065
|
Args:
|
1064
1066
|
label(str): Label of the x-axis.
|
1067
|
+
size(int): Font size of the label.
|
1065
1068
|
"""
|
1066
1069
|
|
1067
1070
|
@rpc_call
|
1068
|
-
def set_y_label(self, label: "str"):
|
1071
|
+
def set_y_label(self, label: "str", size: "int" = None):
|
1069
1072
|
"""
|
1070
1073
|
Set the label of the y-axis.
|
1071
1074
|
|
1072
1075
|
Args:
|
1073
1076
|
label(str): Label of the y-axis.
|
1077
|
+
size(int): Font size of the label.
|
1074
1078
|
"""
|
1075
1079
|
|
1076
1080
|
@rpc_call
|
@@ -1268,33 +1272,37 @@ class BECPlotBase(RPCBase):
|
|
1268
1272
|
- y_scale: Literal["linear", "log"]
|
1269
1273
|
- x_lim: tuple
|
1270
1274
|
- y_lim: tuple
|
1275
|
+
- legend_label_size: int
|
1271
1276
|
"""
|
1272
1277
|
|
1273
1278
|
@rpc_call
|
1274
|
-
def set_title(self, title: "str"):
|
1279
|
+
def set_title(self, title: "str", size: "int" = None):
|
1275
1280
|
"""
|
1276
1281
|
Set the title of the plot widget.
|
1277
1282
|
|
1278
1283
|
Args:
|
1279
1284
|
title(str): Title of the plot widget.
|
1285
|
+
size(int): Font size of the title.
|
1280
1286
|
"""
|
1281
1287
|
|
1282
1288
|
@rpc_call
|
1283
|
-
def set_x_label(self, label: "str"):
|
1289
|
+
def set_x_label(self, label: "str", size: "int" = None):
|
1284
1290
|
"""
|
1285
1291
|
Set the label of the x-axis.
|
1286
1292
|
|
1287
1293
|
Args:
|
1288
1294
|
label(str): Label of the x-axis.
|
1295
|
+
size(int): Font size of the label.
|
1289
1296
|
"""
|
1290
1297
|
|
1291
1298
|
@rpc_call
|
1292
|
-
def set_y_label(self, label: "str"):
|
1299
|
+
def set_y_label(self, label: "str", size: "int" = None):
|
1293
1300
|
"""
|
1294
1301
|
Set the label of the y-axis.
|
1295
1302
|
|
1296
1303
|
Args:
|
1297
1304
|
label(str): Label of the y-axis.
|
1305
|
+
size(int): Font size of the label.
|
1298
1306
|
"""
|
1299
1307
|
|
1300
1308
|
@rpc_call
|
@@ -1370,6 +1378,15 @@ class BECPlotBase(RPCBase):
|
|
1370
1378
|
Remove the plot widget from the figure.
|
1371
1379
|
"""
|
1372
1380
|
|
1381
|
+
@rpc_call
|
1382
|
+
def set_legend_label_size(self, size: "int" = None):
|
1383
|
+
"""
|
1384
|
+
Set the font size of the legend.
|
1385
|
+
|
1386
|
+
Args:
|
1387
|
+
size(int): Font size of the legend.
|
1388
|
+
"""
|
1389
|
+
|
1373
1390
|
|
1374
1391
|
class BECWaveform(RPCBase):
|
1375
1392
|
@property
|
@@ -1516,33 +1533,37 @@ class BECWaveform(RPCBase):
|
|
1516
1533
|
- y_scale: Literal["linear", "log"]
|
1517
1534
|
- x_lim: tuple
|
1518
1535
|
- y_lim: tuple
|
1536
|
+
- legend_label_size: int
|
1519
1537
|
"""
|
1520
1538
|
|
1521
1539
|
@rpc_call
|
1522
|
-
def set_title(self, title: "str"):
|
1540
|
+
def set_title(self, title: "str", size: "int" = None):
|
1523
1541
|
"""
|
1524
1542
|
Set the title of the plot widget.
|
1525
1543
|
|
1526
1544
|
Args:
|
1527
1545
|
title(str): Title of the plot widget.
|
1546
|
+
size(int): Font size of the title.
|
1528
1547
|
"""
|
1529
1548
|
|
1530
1549
|
@rpc_call
|
1531
|
-
def set_x_label(self, label: "str"):
|
1550
|
+
def set_x_label(self, label: "str", size: "int" = None):
|
1532
1551
|
"""
|
1533
1552
|
Set the label of the x-axis.
|
1534
1553
|
|
1535
1554
|
Args:
|
1536
1555
|
label(str): Label of the x-axis.
|
1556
|
+
size(int): Font size of the label.
|
1537
1557
|
"""
|
1538
1558
|
|
1539
1559
|
@rpc_call
|
1540
|
-
def set_y_label(self, label: "str"):
|
1560
|
+
def set_y_label(self, label: "str", size: "int" = None):
|
1541
1561
|
"""
|
1542
1562
|
Set the label of the y-axis.
|
1543
1563
|
|
1544
1564
|
Args:
|
1545
1565
|
label(str): Label of the y-axis.
|
1566
|
+
size(int): Font size of the label.
|
1546
1567
|
"""
|
1547
1568
|
|
1548
1569
|
@rpc_call
|
@@ -1618,6 +1639,15 @@ class BECWaveform(RPCBase):
|
|
1618
1639
|
Remove the plot widget from the figure.
|
1619
1640
|
"""
|
1620
1641
|
|
1642
|
+
@rpc_call
|
1643
|
+
def set_legend_label_size(self, size: "int" = None):
|
1644
|
+
"""
|
1645
|
+
Set the font size of the legend.
|
1646
|
+
|
1647
|
+
Args:
|
1648
|
+
size(int): Font size of the legend.
|
1649
|
+
"""
|
1650
|
+
|
1621
1651
|
|
1622
1652
|
class Ring(RPCBase):
|
1623
1653
|
@rpc_call
|
bec_widgets/cli/generate_cli.py
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
from __future__ import annotations
|
3
3
|
|
4
4
|
import argparse
|
5
|
-
import importlib
|
6
5
|
import inspect
|
7
6
|
import os
|
8
7
|
import sys
|
@@ -10,9 +9,8 @@ from typing import Literal
|
|
10
9
|
|
11
10
|
import black
|
12
11
|
import isort
|
13
|
-
from qtpy.QtWidgets import QGraphicsWidget, QWidget
|
14
12
|
|
15
|
-
from bec_widgets.utils import
|
13
|
+
from bec_widgets.utils.plugin_utils import get_rpc_classes
|
16
14
|
|
17
15
|
if sys.version_info >= (3, 11):
|
18
16
|
from typing import get_overloads
|
@@ -138,50 +136,6 @@ class {class_name}(RPCBase):"""
|
|
138
136
|
with open(file_name, "w", encoding="utf-8") as file:
|
139
137
|
file.write(formatted_content)
|
140
138
|
|
141
|
-
@staticmethod
|
142
|
-
def get_rpc_classes(
|
143
|
-
repo_name: str,
|
144
|
-
) -> dict[Literal["connector_classes", "top_level_classes"], list[type]]:
|
145
|
-
"""
|
146
|
-
Get all RPC-enabled classes in the specified repository.
|
147
|
-
|
148
|
-
Args:
|
149
|
-
repo_name(str): The name of the repository.
|
150
|
-
|
151
|
-
Returns:
|
152
|
-
dict: A dictionary with keys "connector_classes" and "top_level_classes" and values as lists of classes.
|
153
|
-
"""
|
154
|
-
connector_classes = []
|
155
|
-
top_level_classes = []
|
156
|
-
anchor_module = importlib.import_module(f"{repo_name}.widgets")
|
157
|
-
directory = os.path.dirname(anchor_module.__file__)
|
158
|
-
for root, _, files in sorted(os.walk(directory)):
|
159
|
-
for file in files:
|
160
|
-
if not file.endswith(".py") or file.startswith("__"):
|
161
|
-
continue
|
162
|
-
|
163
|
-
path = os.path.join(root, file)
|
164
|
-
subs = os.path.dirname(os.path.relpath(path, directory)).split("/")
|
165
|
-
if len(subs) == 1 and not subs[0]:
|
166
|
-
module_name = file.split(".")[0]
|
167
|
-
else:
|
168
|
-
module_name = ".".join(subs + [file.split(".")[0]])
|
169
|
-
|
170
|
-
module = importlib.import_module(f"{repo_name}.widgets.{module_name}")
|
171
|
-
|
172
|
-
for name in dir(module):
|
173
|
-
obj = getattr(module, name)
|
174
|
-
if not hasattr(obj, "__module__") or obj.__module__ != module.__name__:
|
175
|
-
continue
|
176
|
-
if isinstance(obj, type) and issubclass(obj, BECConnector):
|
177
|
-
connector_classes.append(obj)
|
178
|
-
if len(subs) == 1 and (
|
179
|
-
issubclass(obj, QWidget) or issubclass(obj, QGraphicsWidget)
|
180
|
-
):
|
181
|
-
top_level_classes.append(obj)
|
182
|
-
|
183
|
-
return {"connector_classes": connector_classes, "top_level_classes": top_level_classes}
|
184
|
-
|
185
139
|
|
186
140
|
def main():
|
187
141
|
"""
|
@@ -197,7 +151,7 @@ def main():
|
|
197
151
|
current_path = os.path.dirname(__file__)
|
198
152
|
client_path = os.path.join(current_path, "client.py")
|
199
153
|
|
200
|
-
rpc_classes =
|
154
|
+
rpc_classes = get_rpc_classes("bec_widgets")
|
201
155
|
rpc_classes["connector_classes"].sort(key=lambda x: x.__name__)
|
202
156
|
|
203
157
|
generator = ClientGenerator()
|
@@ -10,8 +10,8 @@ from qtpy.QtGui import QIcon
|
|
10
10
|
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
11
11
|
|
12
12
|
from bec_widgets.utils import BECDispatcher, UILoader
|
13
|
-
from bec_widgets.widgets import BECFigure
|
14
13
|
from bec_widgets.widgets.dock.dock_area import BECDockArea
|
14
|
+
from bec_widgets.widgets.figure import BECFigure
|
15
15
|
from bec_widgets.widgets.jupyter_console.jupyter_console import BECJupyterConsole
|
16
16
|
|
17
17
|
# class JupyterConsoleWidget(RichJupyterWidget): # pragma: no cover:
|
@@ -1,6 +1,10 @@
|
|
1
|
+
import importlib
|
1
2
|
import inspect
|
3
|
+
import os
|
4
|
+
from typing import Literal
|
2
5
|
|
3
6
|
from bec_lib.plugin_helper import _get_available_plugins
|
7
|
+
from qtpy.QtWidgets import QGraphicsWidget, QWidget
|
4
8
|
|
5
9
|
from bec_widgets.utils import BECConnector
|
6
10
|
|
@@ -38,3 +42,47 @@ def get_plugin_widgets() -> dict[str, BECConnector]:
|
|
38
42
|
|
39
43
|
def _filter_plugins(obj):
|
40
44
|
return inspect.isclass(obj) and issubclass(obj, BECConnector)
|
45
|
+
|
46
|
+
|
47
|
+
def get_rpc_classes(
|
48
|
+
repo_name: str,
|
49
|
+
) -> dict[Literal["connector_classes", "top_level_classes"], list[type]]:
|
50
|
+
"""
|
51
|
+
Get all RPC-enabled classes in the specified repository.
|
52
|
+
|
53
|
+
Args:
|
54
|
+
repo_name(str): The name of the repository.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
dict: A dictionary with keys "connector_classes" and "top_level_classes" and values as lists of classes.
|
58
|
+
"""
|
59
|
+
connector_classes = []
|
60
|
+
top_level_classes = []
|
61
|
+
anchor_module = importlib.import_module(f"{repo_name}.widgets")
|
62
|
+
directory = os.path.dirname(anchor_module.__file__)
|
63
|
+
for root, _, files in sorted(os.walk(directory)):
|
64
|
+
for file in files:
|
65
|
+
if not file.endswith(".py") or file.startswith("__"):
|
66
|
+
continue
|
67
|
+
|
68
|
+
path = os.path.join(root, file)
|
69
|
+
subs = os.path.dirname(os.path.relpath(path, directory)).split("/")
|
70
|
+
if len(subs) == 1 and not subs[0]:
|
71
|
+
module_name = file.split(".")[0]
|
72
|
+
else:
|
73
|
+
module_name = ".".join(subs + [file.split(".")[0]])
|
74
|
+
|
75
|
+
module = importlib.import_module(f"{repo_name}.widgets.{module_name}")
|
76
|
+
|
77
|
+
for name in dir(module):
|
78
|
+
obj = getattr(module, name)
|
79
|
+
if not hasattr(obj, "__module__") or obj.__module__ != module.__name__:
|
80
|
+
continue
|
81
|
+
if isinstance(obj, type) and issubclass(obj, BECConnector):
|
82
|
+
connector_classes.append(obj)
|
83
|
+
if len(subs) == 1 and (
|
84
|
+
issubclass(obj, QWidget) or issubclass(obj, QGraphicsWidget)
|
85
|
+
):
|
86
|
+
top_level_classes.append(obj)
|
87
|
+
|
88
|
+
return {"connector_classes": connector_classes, "top_level_classes": top_level_classes}
|
bec_widgets/widgets/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
from .buttons import StopButton
|
2
|
-
from .dock import BECDock, BECDockArea
|
3
|
-
from .figure import BECFigure, FigureConfig
|
4
|
-
from .scan_control import ScanControl
|
5
|
-
from .spiral_progress_bar import SpiralProgressBar
|
1
|
+
# from .buttons import StopButton
|
2
|
+
# from .dock import BECDock, BECDockArea
|
3
|
+
# from .figure import BECFigure, FigureConfig
|
4
|
+
# from .scan_control import ScanControl
|
5
|
+
# from .spiral_progress_bar import SpiralProgressBar
|
bec_widgets/widgets/dock/dock.py
CHANGED
@@ -11,7 +11,7 @@ from bec_widgets.utils import BECConnector, ConnectionConfig, GridLayoutManager
|
|
11
11
|
if TYPE_CHECKING:
|
12
12
|
from qtpy.QtWidgets import QWidget
|
13
13
|
|
14
|
-
from bec_widgets.widgets import BECDockArea
|
14
|
+
from bec_widgets.widgets.dock import BECDockArea
|
15
15
|
|
16
16
|
|
17
17
|
class DockConfig(ConnectionConfig):
|
@@ -711,6 +711,12 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
711
711
|
qdarktheme.setup_theme(theme)
|
712
712
|
self.setBackground("k" if theme == "dark" else "w")
|
713
713
|
self.config.theme = theme
|
714
|
+
for plot in self.widget_list:
|
715
|
+
plot.set_x_label(plot.plot_item.getAxis("bottom").label.toPlainText())
|
716
|
+
plot.set_y_label(plot.plot_item.getAxis("left").label.toPlainText())
|
717
|
+
if plot.plot_item.titleLabel.text:
|
718
|
+
plot.set_title(plot.plot_item.titleLabel.text)
|
719
|
+
plot.set_legend_label_size()
|
714
720
|
|
715
721
|
def _remove_by_coordinates(self, row: int, col: int) -> None:
|
716
722
|
"""
|