bec-widgets 0.104.0__py3-none-any.whl → 0.106.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 +26 -24
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +39 -0
- bec_widgets/cli/client_utils.py +5 -4
- bec_widgets/cli/server.py +21 -9
- bec_widgets/examples/plugin_example_pyside/tictactoe.py +0 -1
- bec_widgets/utils/bec_connector.py +5 -4
- bec_widgets/utils/bec_dispatcher.py +9 -13
- bec_widgets/utils/bec_widget.py +4 -0
- bec_widgets/widgets/dap_combo_box/__init__.py +0 -0
- bec_widgets/widgets/dap_combo_box/dap_combo_box.py +185 -0
- bec_widgets/widgets/dap_combo_box/dap_combo_box.pyproject +1 -0
- bec_widgets/widgets/dap_combo_box/dap_combo_box_plugin.py +54 -0
- bec_widgets/widgets/dap_combo_box/register_dap_combo_box.py +15 -0
- bec_widgets/widgets/device_browser/device_item/device_item.py +4 -1
- bec_widgets/widgets/figure/figure.py +4 -1
- bec_widgets/widgets/figure/plots/axis_settings.py +3 -0
- bec_widgets/widgets/figure/plots/axis_settings.ui +38 -17
- bec_widgets/widgets/figure/plots/image/image.py +4 -1
- bec_widgets/widgets/figure/plots/image/image_item.py +4 -1
- bec_widgets/widgets/figure/plots/motor_map/motor_map.py +5 -2
- bec_widgets/widgets/figure/plots/plot_base.py +18 -1
- bec_widgets/widgets/figure/plots/waveform/waveform.py +7 -4
- bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +4 -2
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar.py +8 -5
- bec_widgets/widgets/scan_control/scan_group_box.py +6 -1
- bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +6 -14
- bec_widgets/widgets/waveform/waveform_widget.py +13 -5
- {bec_widgets-0.104.0.dist-info → bec_widgets-0.106.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.104.0.dist-info → bec_widgets-0.106.0.dist-info}/RECORD +34 -29
- pyproject.toml +1 -1
- {bec_widgets-0.104.0.dist-info → bec_widgets-0.106.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.104.0.dist-info → bec_widgets-0.106.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.104.0.dist-info → bec_widgets-0.106.0.dist-info}/licenses/LICENSE +0 -0
@@ -7,6 +7,7 @@ from typing import Literal, Optional
|
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import pyqtgraph as pg
|
10
|
+
from bec_lib.logger import bec_logger
|
10
11
|
from pydantic import Field, ValidationError, field_validator
|
11
12
|
from qtpy.QtCore import Signal as pyqtSignal
|
12
13
|
from qtpy.QtWidgets import QWidget
|
@@ -20,6 +21,8 @@ from bec_widgets.widgets.figure.plots.motor_map.motor_map import BECMotorMap, Mo
|
|
20
21
|
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase, SubplotConfig
|
21
22
|
from bec_widgets.widgets.figure.plots.waveform.waveform import BECWaveform, Waveform1DConfig
|
22
23
|
|
24
|
+
logger = bec_logger.logger
|
25
|
+
|
23
26
|
|
24
27
|
class FigureConfig(ConnectionConfig):
|
25
28
|
"""Configuration for BECFigure. Inheriting from ConnectionConfig widget_class and gui_id"""
|
@@ -179,7 +182,7 @@ class BECFigure(BECWidget, pg.GraphicsLayoutWidget):
|
|
179
182
|
try:
|
180
183
|
config = FigureConfig(**config)
|
181
184
|
except ValidationError as e:
|
182
|
-
|
185
|
+
logger.error(f"Error in applying config: {e}")
|
183
186
|
return
|
184
187
|
self.config = config
|
185
188
|
|
@@ -31,6 +31,7 @@ class AxisSettings(SettingWidget):
|
|
31
31
|
|
32
32
|
# Top Box
|
33
33
|
WidgetIO.set_value(self.ui.plot_title, axis_config["title"])
|
34
|
+
self.ui.switch_outer_axes.checked = axis_config["outer_axes"]
|
34
35
|
|
35
36
|
# X Axis Box
|
36
37
|
WidgetIO.set_value(self.ui.x_label, axis_config["x_label"])
|
@@ -63,6 +64,7 @@ class AxisSettings(SettingWidget):
|
|
63
64
|
@Slot()
|
64
65
|
def accept_changes(self):
|
65
66
|
title = WidgetIO.get_value(self.ui.plot_title)
|
67
|
+
outer_axes = self.ui.switch_outer_axes.checked
|
66
68
|
|
67
69
|
# X Axis
|
68
70
|
x_label = WidgetIO.get_value(self.ui.x_label)
|
@@ -86,3 +88,4 @@ class AxisSettings(SettingWidget):
|
|
86
88
|
y_lim=y_lim,
|
87
89
|
)
|
88
90
|
self.target_widget.set_grid(x_grid, y_grid)
|
91
|
+
self.target_widget.set_outer_axes(outer_axes)
|
@@ -6,8 +6,8 @@
|
|
6
6
|
<rect>
|
7
7
|
<x>0</x>
|
8
8
|
<y>0</y>
|
9
|
-
<width>
|
10
|
-
<height>
|
9
|
+
<width>427</width>
|
10
|
+
<height>270</height>
|
11
11
|
</rect>
|
12
12
|
</property>
|
13
13
|
<property name="minimumSize">
|
@@ -26,7 +26,28 @@
|
|
26
26
|
<string>Form</string>
|
27
27
|
</property>
|
28
28
|
<layout class="QGridLayout" name="gridLayout">
|
29
|
-
<item row="
|
29
|
+
<item row="0" column="0" colspan="2">
|
30
|
+
<layout class="QHBoxLayout" name="horizontalLayout">
|
31
|
+
<item>
|
32
|
+
<widget class="QLabel" name="plot_title_label">
|
33
|
+
<property name="text">
|
34
|
+
<string>Plot Title</string>
|
35
|
+
</property>
|
36
|
+
</widget>
|
37
|
+
</item>
|
38
|
+
<item>
|
39
|
+
<widget class="QLineEdit" name="plot_title"/>
|
40
|
+
</item>
|
41
|
+
</layout>
|
42
|
+
</item>
|
43
|
+
<item row="1" column="0">
|
44
|
+
<widget class="QLabel" name="label_outer_axes">
|
45
|
+
<property name="text">
|
46
|
+
<string>Outer Axes</string>
|
47
|
+
</property>
|
48
|
+
</widget>
|
49
|
+
</item>
|
50
|
+
<item row="2" column="1">
|
30
51
|
<widget class="QGroupBox" name="y_axis_box">
|
31
52
|
<property name="title">
|
32
53
|
<string>Y Axis</string>
|
@@ -120,7 +141,7 @@
|
|
120
141
|
</layout>
|
121
142
|
</widget>
|
122
143
|
</item>
|
123
|
-
<item row="
|
144
|
+
<item row="2" column="0">
|
124
145
|
<widget class="QGroupBox" name="x_axis_box">
|
125
146
|
<property name="title">
|
126
147
|
<string>X Axis</string>
|
@@ -214,22 +235,22 @@
|
|
214
235
|
</layout>
|
215
236
|
</widget>
|
216
237
|
</item>
|
217
|
-
<item row="
|
218
|
-
<
|
219
|
-
<
|
220
|
-
<
|
221
|
-
|
222
|
-
|
223
|
-
</property>
|
224
|
-
</widget>
|
225
|
-
</item>
|
226
|
-
<item>
|
227
|
-
<widget class="QLineEdit" name="plot_title"/>
|
228
|
-
</item>
|
229
|
-
</layout>
|
238
|
+
<item row="1" column="1">
|
239
|
+
<widget class="ToggleSwitch" name="switch_outer_axes">
|
240
|
+
<property name="checked" stdset="0">
|
241
|
+
<bool>false</bool>
|
242
|
+
</property>
|
243
|
+
</widget>
|
230
244
|
</item>
|
231
245
|
</layout>
|
232
246
|
</widget>
|
247
|
+
<customwidgets>
|
248
|
+
<customwidget>
|
249
|
+
<class>ToggleSwitch</class>
|
250
|
+
<extends>QWidget</extends>
|
251
|
+
<header>toggle_switch</header>
|
252
|
+
</customwidget>
|
253
|
+
</customwidgets>
|
233
254
|
<resources/>
|
234
255
|
<connections/>
|
235
256
|
</ui>
|
@@ -5,6 +5,7 @@ from typing import Any, Literal, Optional
|
|
5
5
|
|
6
6
|
import numpy as np
|
7
7
|
from bec_lib.endpoints import MessageEndpoints
|
8
|
+
from bec_lib.logger import bec_logger
|
8
9
|
from pydantic import BaseModel, Field, ValidationError
|
9
10
|
from qtpy.QtCore import QThread
|
10
11
|
from qtpy.QtWidgets import QWidget
|
@@ -19,6 +20,8 @@ from bec_widgets.widgets.figure.plots.image.image_processor import (
|
|
19
20
|
)
|
20
21
|
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase, SubplotConfig
|
21
22
|
|
23
|
+
logger = bec_logger.logger
|
24
|
+
|
22
25
|
|
23
26
|
class ImageConfig(SubplotConfig):
|
24
27
|
images: dict[str, ImageItemConfig] = Field(
|
@@ -130,7 +133,7 @@ class BECImageShow(BECPlotBase):
|
|
130
133
|
try:
|
131
134
|
config = ImageConfig(**config)
|
132
135
|
except ValidationError as e:
|
133
|
-
|
136
|
+
logger.error(f"Validation error when applying config to BECImageShow: {e}")
|
134
137
|
return
|
135
138
|
self.config = config
|
136
139
|
self.plot_item.clear()
|
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Literal, Optional
|
|
4
4
|
|
5
5
|
import numpy as np
|
6
6
|
import pyqtgraph as pg
|
7
|
+
from bec_lib.logger import bec_logger
|
7
8
|
from pydantic import Field
|
8
9
|
|
9
10
|
from bec_widgets.utils import BECConnector, ConnectionConfig
|
@@ -12,6 +13,8 @@ from bec_widgets.widgets.figure.plots.image.image_processor import ImageStats, P
|
|
12
13
|
if TYPE_CHECKING:
|
13
14
|
from bec_widgets.widgets.figure.plots.image.image import BECImageShow
|
14
15
|
|
16
|
+
logger = bec_logger.logger
|
17
|
+
|
15
18
|
|
16
19
|
class ImageItemConfig(ConnectionConfig):
|
17
20
|
parent_id: Optional[str] = Field(None, description="The parent plot of the image.")
|
@@ -133,7 +136,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
133
136
|
if key in method_map:
|
134
137
|
method_map[key](value)
|
135
138
|
else:
|
136
|
-
|
139
|
+
logger.warning(f"Warning: '{key}' is not a recognized property.")
|
137
140
|
|
138
141
|
def set_fft(self, enable: bool = False):
|
139
142
|
"""
|
@@ -6,6 +6,7 @@ from typing import Optional, Union
|
|
6
6
|
import numpy as np
|
7
7
|
import pyqtgraph as pg
|
8
8
|
from bec_lib.endpoints import MessageEndpoints
|
9
|
+
from bec_lib.logger import bec_logger
|
9
10
|
from pydantic import Field, ValidationError, field_validator
|
10
11
|
from pydantic_core import PydanticCustomError
|
11
12
|
from qtpy import QtCore, QtGui
|
@@ -17,6 +18,8 @@ from bec_widgets.utils import Colors, EntryValidator
|
|
17
18
|
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase, SubplotConfig
|
18
19
|
from bec_widgets.widgets.figure.plots.waveform.waveform import Signal, SignalData
|
19
20
|
|
21
|
+
logger = bec_logger.logger
|
22
|
+
|
20
23
|
|
21
24
|
class MotorMapConfig(SubplotConfig):
|
22
25
|
signals: Optional[Signal] = Field(None, description="Signals of the motor map")
|
@@ -101,7 +104,7 @@ class BECMotorMap(BECPlotBase):
|
|
101
104
|
try:
|
102
105
|
config = MotorMapConfig(**config)
|
103
106
|
except ValidationError as e:
|
104
|
-
|
107
|
+
logger.error(f"Error in applying config: {e}")
|
105
108
|
return
|
106
109
|
|
107
110
|
self.config = config
|
@@ -440,7 +443,7 @@ class BECMotorMap(BECPlotBase):
|
|
440
443
|
return limits
|
441
444
|
except AttributeError: # TODO maybe not needed, if no limits it returns [0,0]
|
442
445
|
# If the motor doesn't have a 'limits' attribute, return a default value or raise a custom exception
|
443
|
-
|
446
|
+
logger.error(f"The device '{motor}' does not have defined limits.")
|
444
447
|
return None
|
445
448
|
|
446
449
|
@Slot()
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
from collections import defaultdict
|
3
4
|
from typing import Literal, Optional
|
4
5
|
|
5
6
|
import bec_qthemes
|
6
7
|
import pyqtgraph as pg
|
8
|
+
from bec_lib.logger import bec_logger
|
7
9
|
from pydantic import BaseModel, Field
|
8
10
|
from qtpy.QtCore import Signal, Slot
|
9
11
|
from qtpy.QtWidgets import QApplication, QWidget
|
@@ -11,6 +13,8 @@ from qtpy.QtWidgets import QApplication, QWidget
|
|
11
13
|
from bec_widgets.utils import BECConnector, ConnectionConfig
|
12
14
|
from bec_widgets.utils.crosshair import Crosshair
|
13
15
|
|
16
|
+
logger = bec_logger.logger
|
17
|
+
|
14
18
|
|
15
19
|
class AxisConfig(BaseModel):
|
16
20
|
title: Optional[str] = Field(None, description="The title of the axes.")
|
@@ -28,6 +32,7 @@ class AxisConfig(BaseModel):
|
|
28
32
|
y_lim: Optional[tuple] = Field(None, description="The limits of the y-axis.")
|
29
33
|
x_grid: bool = Field(False, description="Show grid on the x-axis.")
|
30
34
|
y_grid: bool = Field(False, description="Show grid on the y-axis.")
|
35
|
+
outer_axes: bool = Field(False, description="Show the outer axes of the plot widget.")
|
31
36
|
model_config: dict = {"validate_assignment": True}
|
32
37
|
|
33
38
|
|
@@ -72,6 +77,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
72
77
|
"set_x_lim",
|
73
78
|
"set_y_lim",
|
74
79
|
"set_grid",
|
80
|
+
"set_outer_axes",
|
75
81
|
"lock_aspect_ratio",
|
76
82
|
"export",
|
77
83
|
"remove",
|
@@ -164,7 +170,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
164
170
|
if key in method_map:
|
165
171
|
method_map[key](value)
|
166
172
|
else:
|
167
|
-
|
173
|
+
logger.warning(f"Warning: '{key}' is not a recognized property.")
|
168
174
|
|
169
175
|
def apply_axis_config(self):
|
170
176
|
"""Apply the axis configuration to the plot widget."""
|
@@ -333,6 +339,17 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
333
339
|
self.config.axis.x_grid = x
|
334
340
|
self.config.axis.y_grid = y
|
335
341
|
|
342
|
+
def set_outer_axes(self, show: bool = True):
|
343
|
+
"""
|
344
|
+
Set the outer axes of the plot widget.
|
345
|
+
|
346
|
+
Args:
|
347
|
+
show(bool): Show the outer axes.
|
348
|
+
"""
|
349
|
+
self.plot_item.showAxis("top", show)
|
350
|
+
self.plot_item.showAxis("right", show)
|
351
|
+
self.config.axis.outer_axes = show
|
352
|
+
|
336
353
|
def add_legend(self):
|
337
354
|
"""Add legend to the plot"""
|
338
355
|
self.plot_item.addLegend()
|
@@ -8,6 +8,7 @@ import pyqtgraph as pg
|
|
8
8
|
from bec_lib import messages
|
9
9
|
from bec_lib.device import ReadoutPriority
|
10
10
|
from bec_lib.endpoints import MessageEndpoints
|
11
|
+
from bec_lib.logger import bec_logger
|
11
12
|
from pydantic import Field, ValidationError, field_validator
|
12
13
|
from pyqtgraph.exporters import MatplotlibExporter
|
13
14
|
from qtpy.QtCore import Signal as pyqtSignal
|
@@ -23,6 +24,8 @@ from bec_widgets.widgets.figure.plots.waveform.waveform_curve import (
|
|
23
24
|
SignalData,
|
24
25
|
)
|
25
26
|
|
27
|
+
logger = bec_logger.logger
|
28
|
+
|
26
29
|
|
27
30
|
class Waveform1DConfig(SubplotConfig):
|
28
31
|
color_palette: Optional[str] = Field(
|
@@ -139,7 +142,7 @@ class BECWaveform(BECPlotBase):
|
|
139
142
|
try:
|
140
143
|
config = Waveform1DConfig(**config)
|
141
144
|
except ValidationError as e:
|
142
|
-
|
145
|
+
logger.error(f"Validation error when applying config to BECWaveform1D: {e}")
|
143
146
|
return
|
144
147
|
|
145
148
|
self.config = config
|
@@ -553,7 +556,7 @@ class BECWaveform(BECPlotBase):
|
|
553
556
|
format="HEX",
|
554
557
|
)[len(self.plot_item.curves)]
|
555
558
|
)
|
556
|
-
|
559
|
+
logger.info(f"Color: {color}")
|
557
560
|
|
558
561
|
# Create curve by config
|
559
562
|
curve_config = CurveConfig(
|
@@ -1291,7 +1294,7 @@ class BECWaveform(BECPlotBase):
|
|
1291
1294
|
try:
|
1292
1295
|
self.scan_id = self.queue.scan_storage.storage[scan_index].scan_id
|
1293
1296
|
except IndexError:
|
1294
|
-
|
1297
|
+
logger.error(f"Scan index {scan_index} out of range.")
|
1295
1298
|
return
|
1296
1299
|
elif scan_id is not None:
|
1297
1300
|
self.scan_id = scan_id
|
@@ -1317,7 +1320,7 @@ class BECWaveform(BECPlotBase):
|
|
1317
1320
|
except ImportError:
|
1318
1321
|
pd = None
|
1319
1322
|
if output == "pandas":
|
1320
|
-
|
1323
|
+
logger.warning(
|
1321
1324
|
"Pandas is not installed. "
|
1322
1325
|
"Please install pandas using 'pip install pandas'."
|
1323
1326
|
"Output will be dictionary instead."
|
@@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any, Literal, Optional
|
|
4
4
|
|
5
5
|
import numpy as np
|
6
6
|
import pyqtgraph as pg
|
7
|
+
from bec_lib.logger import bec_logger
|
7
8
|
from pydantic import BaseModel, Field, field_validator
|
8
|
-
from pydantic_core import PydanticCustomError
|
9
9
|
from qtpy import QtCore
|
10
10
|
|
11
11
|
from bec_widgets.utils import BECConnector, Colors, ConnectionConfig
|
@@ -13,6 +13,8 @@ from bec_widgets.utils import BECConnector, Colors, ConnectionConfig
|
|
13
13
|
if TYPE_CHECKING:
|
14
14
|
from bec_widgets.widgets.figure.plots.waveform import BECWaveform1D
|
15
15
|
|
16
|
+
logger = bec_logger.logger
|
17
|
+
|
16
18
|
|
17
19
|
class SignalData(BaseModel):
|
18
20
|
"""The data configuration of a signal in the 1D waveform widget for x and y axis."""
|
@@ -177,7 +179,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
177
179
|
if key in method_map:
|
178
180
|
method_map[key](value)
|
179
181
|
else:
|
180
|
-
|
182
|
+
logger.warning(f"Warning: '{key}' is not a recognized property.")
|
181
183
|
|
182
184
|
def set_color(self, color: str, symbol_color: Optional[str] = None):
|
183
185
|
"""
|
@@ -4,6 +4,7 @@ from typing import Literal, Optional
|
|
4
4
|
|
5
5
|
import pyqtgraph as pg
|
6
6
|
from bec_lib.endpoints import MessageEndpoints
|
7
|
+
from bec_lib.logger import bec_logger
|
7
8
|
from pydantic import Field, field_validator
|
8
9
|
from pydantic_core import PydanticCustomError
|
9
10
|
from qtpy import QtCore, QtGui
|
@@ -14,6 +15,8 @@ from bec_widgets.utils import Colors, ConnectionConfig, EntryValidator
|
|
14
15
|
from bec_widgets.utils.bec_widget import BECWidget
|
15
16
|
from bec_widgets.widgets.ring_progress_bar.ring import Ring, RingConfig
|
16
17
|
|
18
|
+
logger = bec_logger.logger
|
19
|
+
|
17
20
|
|
18
21
|
class RingProgressBarConfig(ConnectionConfig):
|
19
22
|
color_map: Optional[str] = Field(
|
@@ -38,7 +41,7 @@ class RingProgressBarConfig(ConnectionConfig):
|
|
38
41
|
min_number_of_bars = values.data.get("min_number_of_bars", None)
|
39
42
|
max_number_of_bars = values.data.get("max_number_of_bars", None)
|
40
43
|
if min_number_of_bars is not None and max_number_of_bars is not None:
|
41
|
-
|
44
|
+
logger.info(
|
42
45
|
f"Number of bars adjusted to be between defined min:{min_number_of_bars} and max:{max_number_of_bars} number of bars."
|
43
46
|
)
|
44
47
|
v = max(min_number_of_bars, min(v, max_number_of_bars))
|
@@ -318,7 +321,7 @@ class RingProgressBar(BECWidget, QWidget):
|
|
318
321
|
ring = self._find_ring_by_index(ring_index)
|
319
322
|
if isinstance(values, list):
|
320
323
|
values = values[0]
|
321
|
-
|
324
|
+
logger.warning(
|
322
325
|
f"Warning: Only a single value can be set for a single progress bar. Using the first value in the list {values}"
|
323
326
|
)
|
324
327
|
ring.set_value(values)
|
@@ -380,7 +383,7 @@ class RingProgressBar(BECWidget, QWidget):
|
|
380
383
|
ring = self._find_ring_by_index(bar_index)
|
381
384
|
if isinstance(widths, list):
|
382
385
|
widths = widths[0]
|
383
|
-
|
386
|
+
logger.warning(
|
384
387
|
f"Warning: Only a single line width can be set for a single progress bar. Using the first value in the list {widths}"
|
385
388
|
)
|
386
389
|
ring.set_line_width(widths)
|
@@ -487,7 +490,7 @@ class RingProgressBar(BECWidget, QWidget):
|
|
487
490
|
for index, device in enumerate(devices):
|
488
491
|
self._hook_readback(index, device, start[index], end[index])
|
489
492
|
else:
|
490
|
-
|
493
|
+
logger.error(f"{instruction_type} not supported yet.")
|
491
494
|
|
492
495
|
# elif instruction_type == "device_progress":
|
493
496
|
# print("hook device_progress")
|
@@ -609,7 +612,7 @@ class RingProgressBar(BECWidget, QWidget):
|
|
609
612
|
Calculate the minimum size of the widget.
|
610
613
|
"""
|
611
614
|
if not self.config.rings:
|
612
|
-
|
615
|
+
logger.warning("no rings to get size from setting size to 10x10")
|
613
616
|
return QSize(10, 10)
|
614
617
|
ring_widths = [self.config.rings[i].line_width for i in range(self.config.num_bars)]
|
615
618
|
total_width = sum(ring_widths) + self.config.gap * (self.config.num_bars - 1)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from typing import Literal
|
2
2
|
|
3
|
+
from bec_lib.logger import bec_logger
|
3
4
|
from qtpy.QtCore import Qt
|
4
5
|
from qtpy.QtWidgets import (
|
5
6
|
QCheckBox,
|
@@ -18,6 +19,8 @@ from qtpy.QtWidgets import (
|
|
18
19
|
from bec_widgets.utils.widget_io import WidgetIO
|
19
20
|
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
|
20
21
|
|
22
|
+
logger = bec_logger.logger
|
23
|
+
|
21
24
|
|
22
25
|
class ScanArgType:
|
23
26
|
DEVICE = "device"
|
@@ -191,7 +194,9 @@ class ScanGroupBox(QGroupBox):
|
|
191
194
|
default = item.get("default", None)
|
192
195
|
widget = self.WIDGET_HANDLER.get(item["type"], None)
|
193
196
|
if widget is None:
|
194
|
-
|
197
|
+
logger.error(
|
198
|
+
f"Unsupported annotation '{item['type']}' for parameter '{item['name']}'"
|
199
|
+
)
|
195
200
|
continue
|
196
201
|
if default == "_empty":
|
197
202
|
default = None
|
@@ -13,6 +13,7 @@ from bec_widgets.qt_utils.error_popups import WarningPopupUtility
|
|
13
13
|
from bec_widgets.qt_utils.settings_dialog import SettingWidget
|
14
14
|
from bec_widgets.utils import Colors, UILoader
|
15
15
|
from bec_widgets.widgets.color_button.color_button import ColorButton
|
16
|
+
from bec_widgets.widgets.dap_combo_box.dap_combo_box import DapComboBox
|
16
17
|
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
|
17
18
|
|
18
19
|
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
@@ -241,8 +242,9 @@ class DialogRow(QObject):
|
|
241
242
|
self.device_line_edit = DeviceLineEdit()
|
242
243
|
self.entry_line_edit = QLineEdit()
|
243
244
|
|
244
|
-
self.dap_combo =
|
245
|
-
self.
|
245
|
+
self.dap_combo = DapComboBox()
|
246
|
+
self.dap_combo.populate_fit_model_combobox()
|
247
|
+
self.dap_combo.select_fit_model("GaussianModel")
|
246
248
|
|
247
249
|
# Styling
|
248
250
|
self.color_button = ColorButton()
|
@@ -261,16 +263,6 @@ class DialogRow(QObject):
|
|
261
263
|
lambda: self.remove_row()
|
262
264
|
) # From some reason do not work without lambda
|
263
265
|
|
264
|
-
def populate_dap_combobox(self):
|
265
|
-
available_models = [
|
266
|
-
attr
|
267
|
-
for attr in dir(self.client.dap)
|
268
|
-
if not attr.startswith("__")
|
269
|
-
and not callable(getattr(self.client.dap, attr))
|
270
|
-
and not attr.startswith("_")
|
271
|
-
]
|
272
|
-
self.dap_combo.addItems(available_models)
|
273
|
-
|
274
266
|
def add_scan_row(self):
|
275
267
|
if self.config is not None:
|
276
268
|
self.device_line_edit.setText(self.config.signals.y.name)
|
@@ -298,7 +290,7 @@ class DialogRow(QObject):
|
|
298
290
|
if self.config is not None:
|
299
291
|
self.device_line_edit.setText(self.config.signals.y.name)
|
300
292
|
self.entry_line_edit.setText(self.config.signals.y.entry)
|
301
|
-
self.dap_combo.setCurrentText(self.config.signals.dap)
|
293
|
+
self.dap_combo.fit_model_combobox.setCurrentText(self.config.signals.dap)
|
302
294
|
self.color_button.set_color(self.config.color)
|
303
295
|
self.style_combo.setCurrentText(self.config.pen_style)
|
304
296
|
self.width.setValue(self.config.pen_width)
|
@@ -312,7 +304,7 @@ class DialogRow(QObject):
|
|
312
304
|
|
313
305
|
self.table_widget.setCellWidget(self.row, 0, self.device_line_edit)
|
314
306
|
self.table_widget.setCellWidget(self.row, 1, self.entry_line_edit)
|
315
|
-
self.table_widget.setCellWidget(self.row, 2, self.dap_combo)
|
307
|
+
self.table_widget.setCellWidget(self.row, 2, self.dap_combo.fit_model_combobox)
|
316
308
|
self.table_widget.setCellWidget(self.row, 3, self.color_button)
|
317
309
|
self.table_widget.setCellWidget(self.row, 4, self.style_combo)
|
318
310
|
self.table_widget.setCellWidget(self.row, 5, self.width)
|
@@ -5,6 +5,7 @@ from typing import Literal
|
|
5
5
|
|
6
6
|
import numpy as np
|
7
7
|
import pyqtgraph as pg
|
8
|
+
from bec_lib.logger import bec_logger
|
8
9
|
from qtpy.QtCore import Signal
|
9
10
|
from qtpy.QtWidgets import QVBoxLayout, QWidget
|
10
11
|
|
@@ -26,6 +27,8 @@ try:
|
|
26
27
|
except ImportError:
|
27
28
|
pd = None
|
28
29
|
|
30
|
+
logger = bec_logger.logger
|
31
|
+
|
29
32
|
|
30
33
|
class BECWaveformWidget(BECWidget, QWidget):
|
31
34
|
ICON_NAME = "show_chart"
|
@@ -340,7 +343,6 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|
340
343
|
x_entry: str | None = None,
|
341
344
|
y_entry: str | None = None,
|
342
345
|
color: str | None = None,
|
343
|
-
# dap: str = "GaussianModel",
|
344
346
|
validate_bec: bool = True,
|
345
347
|
**kwargs,
|
346
348
|
) -> BECCurve:
|
@@ -425,7 +427,7 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|
425
427
|
except ImportError:
|
426
428
|
pd = None
|
427
429
|
if output == "pandas":
|
428
|
-
|
430
|
+
logger.warning(
|
429
431
|
"Pandas is not installed. "
|
430
432
|
"Please install pandas using 'pip install pandas'."
|
431
433
|
"Output will be dictionary instead."
|
@@ -558,6 +560,15 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|
558
560
|
"""
|
559
561
|
self.waveform.set_grid(x_grid, y_grid)
|
560
562
|
|
563
|
+
def set_outer_axes(self, show: bool):
|
564
|
+
"""
|
565
|
+
Set the outer axes visibility of the plot widget.
|
566
|
+
|
567
|
+
Args:
|
568
|
+
show(bool): Visibility of the outer axes.
|
569
|
+
"""
|
570
|
+
self.waveform.set_outer_axes(show)
|
571
|
+
|
561
572
|
def lock_aspect_ratio(self, lock: bool):
|
562
573
|
"""
|
563
574
|
Lock the aspect ratio of the plot widget.
|
@@ -631,10 +642,7 @@ class BECWaveformWidget(BECWidget, QWidget):
|
|
631
642
|
def main(): # pragma: no cover
|
632
643
|
from qtpy.QtWidgets import QApplication
|
633
644
|
|
634
|
-
from bec_widgets.utils.colors import set_theme
|
635
|
-
|
636
645
|
app = QApplication(sys.argv)
|
637
|
-
set_theme("auto")
|
638
646
|
widget = BECWaveformWidget()
|
639
647
|
widget.show()
|
640
648
|
sys.exit(app.exec_())
|