bec-widgets 0.87.1__py3-none-any.whl → 0.88.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. CHANGELOG.md +58 -62
  2. PKG-INFO +1 -1
  3. bec_widgets/assets/designer_icons/BECWaveformWidget.png +0 -0
  4. bec_widgets/assets/designer_icons/colormap_selector.png +0 -0
  5. bec_widgets/assets/toolbar_icons/add.svg +3 -0
  6. bec_widgets/assets/toolbar_icons/auto_range.svg +3 -0
  7. bec_widgets/assets/toolbar_icons/drag_pan_mode.svg +3 -0
  8. bec_widgets/assets/toolbar_icons/export.svg +9 -0
  9. bec_widgets/assets/toolbar_icons/fitting_parameters.svg +3 -0
  10. bec_widgets/assets/toolbar_icons/import.svg +9 -0
  11. bec_widgets/assets/toolbar_icons/line_axis.svg +3 -0
  12. bec_widgets/assets/toolbar_icons/photo_library.svg +3 -0
  13. bec_widgets/assets/toolbar_icons/rectangle_mode.svg +3 -0
  14. bec_widgets/assets/toolbar_icons/remove.svg +5 -0
  15. bec_widgets/assets/toolbar_icons/save.svg +3 -0
  16. bec_widgets/assets/toolbar_icons/settings.svg +4 -0
  17. bec_widgets/cli/client.py +307 -5
  18. bec_widgets/cli/server.py +2 -1
  19. bec_widgets/examples/jupyter_console/jupyter_console_window.py +12 -5
  20. bec_widgets/examples/plugin_example_pyside/tictactoe.py +1 -0
  21. bec_widgets/widgets/{color_map_selector/color_map_selector.py → colormap_selector/colormap_selector.py} +3 -1
  22. bec_widgets/widgets/colormap_selector/colormap_selector.pyproject +1 -0
  23. bec_widgets/widgets/{color_map_selector/color_map_selector_plugin.py → colormap_selector/colormap_selector_plugin.py} +8 -6
  24. bec_widgets/widgets/{color_map_selector/register_color_map_selector.py → colormap_selector/register_colormap_selector.py} +1 -1
  25. bec_widgets/widgets/figure/figure.py +12 -0
  26. bec_widgets/widgets/figure/plots/axis_settings.py +38 -11
  27. bec_widgets/widgets/figure/plots/image/image.py +1 -0
  28. bec_widgets/widgets/figure/plots/motor_map/motor_map.py +1 -0
  29. bec_widgets/widgets/figure/plots/plot_base.py +7 -3
  30. bec_widgets/widgets/figure/plots/waveform/waveform.py +48 -50
  31. bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +9 -0
  32. bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +1 -1
  33. bec_widgets/widgets/motor_map/motor_map_widget.py +7 -0
  34. bec_widgets/widgets/waveform/__init__.py +0 -0
  35. bec_widgets/widgets/waveform/bec_waveform_widget.pyproject +1 -0
  36. bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +59 -0
  37. bec_widgets/widgets/waveform/register_bec_waveform_widget.py +15 -0
  38. bec_widgets/widgets/waveform/waveform_toolbar/__init__.py +0 -0
  39. bec_widgets/widgets/waveform/waveform_toolbar/curve_dialog/__init__.py +0 -0
  40. bec_widgets/widgets/waveform/waveform_toolbar/curve_dialog/curve_dialog.py +341 -0
  41. bec_widgets/widgets/waveform/waveform_toolbar/curve_dialog/curve_dialog.ui +358 -0
  42. bec_widgets/widgets/waveform/waveform_toolbar/dap_summary_dialog/__init__.py +0 -0
  43. bec_widgets/widgets/waveform/waveform_toolbar/dap_summary_dialog/dap_summary.ui +127 -0
  44. bec_widgets/widgets/waveform/waveform_toolbar/dap_summary_dialog/dap_summary_dialog.py +69 -0
  45. bec_widgets/widgets/waveform/waveform_toolbar/waveform_toolbar.py +117 -0
  46. bec_widgets/widgets/waveform/waveform_widget.py +571 -0
  47. {bec_widgets-0.87.1.dist-info → bec_widgets-0.88.0.dist-info}/METADATA +1 -1
  48. {bec_widgets-0.87.1.dist-info → bec_widgets-0.88.0.dist-info}/RECORD +57 -30
  49. pyproject.toml +1 -1
  50. tests/unit_tests/test_color_map_selector.py +1 -1
  51. tests/unit_tests/test_waveform_widget.py +264 -0
  52. bec_widgets/widgets/color_map_selector/assets/color_map_selector_icon.png +0 -0
  53. bec_widgets/widgets/color_map_selector/color_map_selector.pyproject +0 -1
  54. /bec_widgets/assets/{bec_widgets_icon.png → app_icons/bec_widgets_icon.png} +0 -0
  55. /bec_widgets/assets/{terminal_icon.png → app_icons/terminal_icon.png} +0 -0
  56. /bec_widgets/widgets/{color_map_selector → colormap_selector}/__init__.py +0 -0
  57. {bec_widgets-0.87.1.dist-info → bec_widgets-0.88.0.dist-info}/WHEEL +0 -0
  58. {bec_widgets-0.87.1.dist-info → bec_widgets-0.88.0.dist-info}/entry_points.txt +0 -0
  59. {bec_widgets-0.87.1.dist-info → bec_widgets-0.88.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,571 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from typing import Literal
5
+
6
+ import numpy as np
7
+ import pyqtgraph as pg
8
+ from qtpy.QtCore import Slot
9
+ from qtpy.QtWidgets import QVBoxLayout, QWidget
10
+
11
+ from bec_widgets.qt_utils.error_popups import SafeSlot, WarningPopupUtility
12
+ from bec_widgets.qt_utils.settings_dialog import SettingsDialog
13
+ from bec_widgets.qt_utils.toolbar import ModularToolBar, SeparatorAction
14
+ from bec_widgets.utils.bec_widget import BECWidget
15
+ from bec_widgets.widgets.figure import BECFigure
16
+ from bec_widgets.widgets.figure.plots.axis_settings import AxisSettings
17
+ from bec_widgets.widgets.figure.plots.waveform.waveform import Waveform1DConfig
18
+ from bec_widgets.widgets.figure.plots.waveform.waveform_curve import BECCurve
19
+ from bec_widgets.widgets.waveform.waveform_toolbar.curve_dialog.curve_dialog import CurveSettings
20
+ from bec_widgets.widgets.waveform.waveform_toolbar.dap_summary_dialog.dap_summary_dialog import (
21
+ FitSummaryWidget,
22
+ )
23
+ from bec_widgets.widgets.waveform.waveform_toolbar.waveform_toolbar import *
24
+
25
+ try:
26
+ import pandas as pd
27
+ except ImportError:
28
+ pd = None
29
+
30
+
31
+ class BECWaveformWidget(BECWidget, QWidget):
32
+ USER_ACCESS = [
33
+ "curves",
34
+ "plot",
35
+ "add_dap",
36
+ "get_dap_params",
37
+ "remove_curve",
38
+ "scan_history",
39
+ "get_all_data",
40
+ "set",
41
+ "set_x",
42
+ "set_title",
43
+ "set_x_label",
44
+ "set_y_label",
45
+ "set_x_scale",
46
+ "set_y_scale",
47
+ "set_x_lim",
48
+ "set_y_lim",
49
+ "set_legend_label_size",
50
+ "set_grid",
51
+ "lock_aspect_ratio",
52
+ "export",
53
+ "export_to_matplotlib",
54
+ ]
55
+
56
+ def __init__(
57
+ self,
58
+ parent: QWidget | None = None,
59
+ config: Waveform1DConfig | dict = None,
60
+ client=None,
61
+ gui_id: str | None = None,
62
+ ) -> None:
63
+ if config is None:
64
+ config = Waveform1DConfig(widget_class=self.__class__.__name__)
65
+ else:
66
+ if isinstance(config, dict):
67
+ config = Waveform1DConfig(**config)
68
+ super().__init__(client=client, gui_id=gui_id)
69
+ QWidget.__init__(self, parent)
70
+
71
+ self.layout = QVBoxLayout(self)
72
+ self.layout.setSpacing(0)
73
+ self.layout.setContentsMargins(0, 0, 0, 0)
74
+
75
+ self.fig = BECFigure()
76
+ self.toolbar = ModularToolBar(
77
+ actions={
78
+ "save": SaveAction(),
79
+ "matplotlib": MatplotlibAction(),
80
+ "separator_1": SeparatorAction(),
81
+ "drag_mode": DragModeAction(),
82
+ "rectangle_mode": RectangeModeAction(),
83
+ "auto_range": AutoRangeAction(),
84
+ "separator_2": SeparatorAction(),
85
+ "curves": CurveAction(),
86
+ "fit_params": FitParamsAction(),
87
+ "axis_settings": SettingsAction(),
88
+ # "separator_3": SeparatorAction(),
89
+ # "import": ImportAction(),
90
+ # "export": ExportAction(),
91
+ },
92
+ target_widget=self,
93
+ )
94
+
95
+ self.layout.addWidget(self.toolbar)
96
+ self.layout.addWidget(self.fig)
97
+
98
+ self.warning_util = WarningPopupUtility(self)
99
+
100
+ self.waveform = self.fig.plot()
101
+ self.waveform.apply_config(config)
102
+
103
+ self.config = config
104
+
105
+ self._hook_actions()
106
+
107
+ def _hook_actions(self):
108
+ self.toolbar.widgets["save"].action.triggered.connect(self.export)
109
+ self.toolbar.widgets["matplotlib"].action.triggered.connect(self.export_to_matplotlib)
110
+ self.toolbar.widgets["drag_mode"].action.triggered.connect(self.enable_mouse_pan_mode)
111
+ self.toolbar.widgets["rectangle_mode"].action.triggered.connect(
112
+ self.enable_mouse_rectangle_mode
113
+ )
114
+ self.toolbar.widgets["auto_range"].action.triggered.connect(self._auto_range_from_toolbar)
115
+ self.toolbar.widgets["curves"].action.triggered.connect(self.show_curve_settings)
116
+ self.toolbar.widgets["fit_params"].action.triggered.connect(self.show_fit_summary_dialog)
117
+ self.toolbar.widgets["axis_settings"].action.triggered.connect(self.show_axis_settings)
118
+ # self.toolbar.widgets["import"].action.triggered.connect(
119
+ # lambda: self.load_config(path=None, gui=True)
120
+ # )
121
+ # self.toolbar.widgets["export"].action.triggered.connect(
122
+ # lambda: self.save_config(path=None, gui=True)
123
+ # )
124
+
125
+ ###################################
126
+ # Dialog Windows
127
+ ###################################
128
+ def show_axis_settings(self):
129
+ dialog = SettingsDialog(
130
+ self,
131
+ settings_widget=AxisSettings(),
132
+ window_title="Axis Settings",
133
+ config=self._config_dict["axis"],
134
+ )
135
+ dialog.exec()
136
+
137
+ def show_curve_settings(self):
138
+ dialog = SettingsDialog(
139
+ self,
140
+ settings_widget=CurveSettings(),
141
+ window_title="Curve Settings",
142
+ config=self.waveform._curves_data,
143
+ )
144
+ dialog.resize(800, 600)
145
+ dialog.exec()
146
+
147
+ def show_fit_summary_dialog(self):
148
+ dialog = FitSummaryWidget(target_widget=self)
149
+ dialog.resize(800, 600)
150
+ dialog.show()
151
+
152
+ ###################################
153
+ # User Access Methods from Waveform
154
+ ###################################
155
+ @property
156
+ def curves(self) -> list[BECCurve]:
157
+ """
158
+ Get the curves of the plot widget as a list
159
+ Returns:
160
+ list: List of curves.
161
+ """
162
+ return self.waveform._curves
163
+
164
+ @curves.setter
165
+ def curves(self, value: list[BECCurve]):
166
+ self.waveform._curves = value
167
+
168
+ def get_curve(self, identifier) -> BECCurve:
169
+ """
170
+ Get the curve by its index or ID.
171
+
172
+ Args:
173
+ identifier(int|str): Identifier of the curve. Can be either an integer (index) or a string (curve_id).
174
+
175
+ Returns:
176
+ BECCurve: The curve object.
177
+ """
178
+ return self.waveform.get_curve(identifier)
179
+
180
+ def set_colormap(self, colormap: str):
181
+ """
182
+ Set the colormap of the plot widget.
183
+
184
+ Args:
185
+ colormap(str, optional): Scale the colors of curves to colormap. If None, use the default color palette.
186
+ """
187
+ self.waveform.set_colormap(colormap)
188
+
189
+ @SafeSlot(popup_error=True)
190
+ def set_x(self, x_name: str, x_entry: str | None = None):
191
+ """
192
+ Change the x axis of the plot widget.
193
+
194
+ Args:
195
+ x_name(str): Name of the x signal.
196
+ - "best_effort": Use the best effort signal.
197
+ - "timestamp": Use the timestamp signal.
198
+ - "index": Use the index signal.
199
+ - Custom signal name of device from BEC.
200
+ x_entry(str): Entry of the x signal.
201
+ """
202
+ self.waveform.set_x(x_name, x_entry)
203
+
204
+ @SafeSlot(popup_error=True)
205
+ def plot(
206
+ self,
207
+ arg1: list | np.ndarray | str | None = None,
208
+ x: list | np.ndarray | None = None,
209
+ y: list | np.ndarray | None = None,
210
+ x_name: str | None = None,
211
+ y_name: str | None = None,
212
+ z_name: str | None = None,
213
+ x_entry: str | None = None,
214
+ y_entry: str | None = None,
215
+ z_entry: str | None = None,
216
+ color: str | None = None,
217
+ color_map_z: str | None = "plasma",
218
+ label: str | None = None,
219
+ validate: bool = True,
220
+ dap: str | None = None, # TODO add dap custom curve wrapper
221
+ **kwargs,
222
+ ) -> BECCurve:
223
+ """
224
+ Plot a curve to the plot widget.
225
+ Args:
226
+ arg1(list | np.ndarray | str | None): First argument which can be x data(list | np.ndarray), y data(list | np.ndarray), or y_name(str).
227
+ x(list | np.ndarray): Custom x data to plot.
228
+ y(list | np.ndarray): Custom y data to plot.
229
+ x_name(str): The name of the device for the x-axis.
230
+ y_name(str): The name of the device for the y-axis.
231
+ z_name(str): The name of the device for the z-axis.
232
+ x_entry(str): The name of the entry for the x-axis.
233
+ y_entry(str): The name of the entry for the y-axis.
234
+ z_entry(str): The name of the entry for the z-axis.
235
+ color(str): The color of the curve.
236
+ color_map_z(str): The color map to use for the z-axis.
237
+ label(str): The label of the curve.
238
+ validate(bool): If True, validate the device names and entries.
239
+ dap(str): The dap model to use for the curve. If not specified, none will be added.
240
+
241
+ Returns:
242
+ BECCurve: The curve object.
243
+ """
244
+ # self._check_if_scans_have_same_x(enabled=True, x_name_to_check=x_name)
245
+ return self.waveform.plot(
246
+ arg1=arg1,
247
+ x=x,
248
+ y=y,
249
+ x_name=x_name,
250
+ y_name=y_name,
251
+ z_name=z_name,
252
+ x_entry=x_entry,
253
+ y_entry=y_entry,
254
+ z_entry=z_entry,
255
+ color=color,
256
+ color_map_z=color_map_z,
257
+ label=label,
258
+ validate=validate,
259
+ dap=dap,
260
+ **kwargs,
261
+ )
262
+
263
+ @SafeSlot(popup_error=True)
264
+ def add_dap(
265
+ self,
266
+ x_name: str,
267
+ y_name: str,
268
+ x_entry: str | None = None,
269
+ y_entry: str | None = None,
270
+ color: str | None = None,
271
+ dap: str = "GaussianModel",
272
+ validate_bec: bool = True,
273
+ **kwargs,
274
+ ) -> BECCurve:
275
+ """
276
+ Add LMFIT dap model curve to the plot widget.
277
+
278
+ Args:
279
+ x_name(str): Name of the x signal.
280
+ x_entry(str): Entry of the x signal.
281
+ y_name(str): Name of the y signal.
282
+ y_entry(str): Entry of the y signal.
283
+ color(str, optional): Color of the curve. Defaults to None.
284
+ dap(str): The dap model to use for the curve.
285
+ validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
286
+ **kwargs: Additional keyword arguments for the curve configuration.
287
+
288
+ Returns:
289
+ BECCurve: The curve object.
290
+ """
291
+ return self.waveform.add_dap(
292
+ x_name=x_name,
293
+ y_name=y_name,
294
+ x_entry=x_entry,
295
+ y_entry=y_entry,
296
+ color=color,
297
+ dap=dap,
298
+ validate_bec=validate_bec,
299
+ **kwargs,
300
+ )
301
+
302
+ def get_dap_params(self) -> dict:
303
+ """
304
+ Get the DAP parameters of all DAP curves.
305
+
306
+ Returns:
307
+ dict: DAP parameters of all DAP curves.
308
+ """
309
+
310
+ return self.waveform.get_dap_params()
311
+
312
+ def get_dap_summary(self) -> dict:
313
+ """
314
+ Get the DAP summary of all DAP curves.
315
+
316
+ Returns:
317
+ dict: DAP summary of all DAP curves.
318
+ """
319
+ return self.waveform.get_dap_summary()
320
+
321
+ def remove_curve(self, *identifiers):
322
+ """
323
+ Remove a curve from the plot widget.
324
+
325
+ Args:
326
+ *identifiers: Identifier of the curve to be removed. Can be either an integer (index) or a string (curve_id).
327
+ """
328
+ self.waveform.remove_curve(*identifiers)
329
+
330
+ def scan_history(self, scan_index: int = None, scan_id: str = None):
331
+ """
332
+ Update the scan curves with the data from the scan storage.
333
+ Provide only one of scan_id or scan_index.
334
+
335
+ Args:
336
+ scan_id(str, optional): ScanID of the scan to be updated. Defaults to None.
337
+ scan_index(int, optional): Index of the scan to be updated. Defaults to None.
338
+ """
339
+ self.waveform.scan_history(scan_index, scan_id)
340
+
341
+ def get_all_data(self, output: Literal["dict", "pandas"] = "dict") -> dict | pd.DataFrame:
342
+ """
343
+ Extract all curve data into a dictionary or a pandas DataFrame.
344
+
345
+ Args:
346
+ output (Literal["dict", "pandas"]): Format of the output data.
347
+
348
+ Returns:
349
+ dict | pd.DataFrame: Data of all curves in the specified format.
350
+ """
351
+ try:
352
+ import pandas as pd
353
+ except ImportError:
354
+ pd = None
355
+ if output == "pandas":
356
+ print(
357
+ "Pandas is not installed. "
358
+ "Please install pandas using 'pip install pandas'."
359
+ "Output will be dictionary instead."
360
+ )
361
+ output = "dict"
362
+ return self.waveform.get_all_data(output)
363
+
364
+ ###################################
365
+ # User Access Methods from Plotbase
366
+ ###################################
367
+
368
+ def set(self, **kwargs):
369
+ """
370
+ Set the properties of the plot widget.
371
+
372
+ Args:
373
+ **kwargs: Keyword arguments for the properties to be set.
374
+
375
+ Possible properties:
376
+ - title: str
377
+ - x_label: str
378
+ - y_label: str
379
+ - x_scale: Literal["linear", "log"]
380
+ - y_scale: Literal["linear", "log"]
381
+ - x_lim: tuple
382
+ - y_lim: tuple
383
+ - legend_label_size: int
384
+ """
385
+ self.waveform.set(**kwargs)
386
+
387
+ def set_title(self, title: str):
388
+ """
389
+ Set the title of the plot widget.
390
+
391
+ Args:
392
+ title(str): Title of the plot.
393
+ """
394
+ self.waveform.set_title(title)
395
+
396
+ def set_x_label(self, x_label: str):
397
+ """
398
+ Set the x-axis label of the plot widget.
399
+
400
+ Args:
401
+ x_label(str): Label of the x-axis.
402
+ """
403
+ self.waveform.set_x_label(x_label)
404
+
405
+ def set_y_label(self, y_label: str):
406
+ """
407
+ Set the y-axis label of the plot widget.
408
+
409
+ Args:
410
+ y_label(str): Label of the y-axis.
411
+ """
412
+ self.waveform.set_y_label(y_label)
413
+
414
+ def set_x_scale(self, x_scale: Literal["linear", "log"]):
415
+ """
416
+ Set the scale of the x-axis of the plot widget.
417
+
418
+ Args:
419
+ x_scale(Literal["linear", "log"]): Scale of the x-axis.
420
+ """
421
+ self.waveform.set_x_scale(x_scale)
422
+
423
+ def set_y_scale(self, y_scale: Literal["linear", "log"]):
424
+ """
425
+ Set the scale of the y-axis of the plot widget.
426
+
427
+ Args:
428
+ y_scale(Literal["linear", "log"]): Scale of the y-axis.
429
+ """
430
+ self.waveform.set_y_scale(y_scale)
431
+
432
+ def set_x_lim(self, x_lim: tuple):
433
+ """
434
+ Set the limits of the x-axis of the plot widget.
435
+
436
+ Args:
437
+ x_lim(tuple): Limits of the x-axis.
438
+ """
439
+ self.waveform.set_x_lim(x_lim)
440
+
441
+ def set_y_lim(self, y_lim: tuple):
442
+ """
443
+ Set the limits of the y-axis of the plot widget.
444
+
445
+ Args:
446
+ y_lim(tuple): Limits of the y-axis.
447
+ """
448
+ self.waveform.set_y_lim(y_lim)
449
+
450
+ def set_legend_label_size(self, legend_label_size: int):
451
+ """
452
+ Set the size of the legend labels of the plot widget.
453
+
454
+ Args:
455
+ legend_label_size(int): Size of the legend labels.
456
+ """
457
+ self.waveform.set_legend_label_size(legend_label_size)
458
+
459
+ def set_auto_range(self, enabled: bool, axis: str = "xy"):
460
+ """
461
+ Set the auto range of the plot widget.
462
+
463
+ Args:
464
+ enabled(bool): If True, enable the auto range.
465
+ axis(str, optional): The axis to enable the auto range.
466
+ - "xy": Enable auto range for both x and y axis.
467
+ - "x": Enable auto range for x axis.
468
+ - "y": Enable auto range for y axis.
469
+ """
470
+ self.waveform.set_auto_range(enabled, axis)
471
+
472
+ @SafeSlot()
473
+ def _auto_range_from_toolbar(self):
474
+ """
475
+ Set the auto range of the plot widget from the toolbar.
476
+ """
477
+ self.waveform.set_auto_range(True, "xy")
478
+
479
+ def set_grid(self, x_grid: bool, y_grid: bool):
480
+ """
481
+ Set the grid visibility of the plot widget.
482
+
483
+ Args:
484
+ x_grid(bool): Visibility of the x-axis grid.
485
+ y_grid(bool): Visibility of the y-axis grid.
486
+ """
487
+ self.waveform.set_grid(x_grid, y_grid)
488
+
489
+ def lock_aspect_ratio(self, lock: bool):
490
+ """
491
+ Lock the aspect ratio of the plot widget.
492
+
493
+ Args:
494
+ lock(bool): Lock the aspect ratio.
495
+ """
496
+ self.waveform.lock_aspect_ratio(lock)
497
+
498
+ @SafeSlot()
499
+ def enable_mouse_rectangle_mode(self):
500
+ self.toolbar.widgets["rectangle_mode"].action.setChecked(True)
501
+ self.toolbar.widgets["drag_mode"].action.setChecked(False)
502
+ self.waveform.plot_item.getViewBox().setMouseMode(pg.ViewBox.RectMode)
503
+
504
+ @SafeSlot()
505
+ def enable_mouse_pan_mode(self):
506
+ self.toolbar.widgets["drag_mode"].action.setChecked(True)
507
+ self.toolbar.widgets["rectangle_mode"].action.setChecked(False)
508
+ self.waveform.plot_item.getViewBox().setMouseMode(pg.ViewBox.PanMode)
509
+
510
+ def export(self):
511
+ """
512
+ Show the export dialog for the plot widget.
513
+ """
514
+ self.waveform.export()
515
+
516
+ def export_to_matplotlib(self):
517
+ """
518
+ Export the plot widget to Matplotlib.
519
+ """
520
+ try:
521
+ import matplotlib as mpl
522
+ except ImportError:
523
+ self.warning_util.show_warning(
524
+ title="Matplotlib not installed",
525
+ message="Matplotlib is required for this feature.",
526
+ detailed_text="Please install matplotlib in your Python environment by using 'pip install matplotlib'.",
527
+ )
528
+ return
529
+ self.waveform.export_to_matplotlib()
530
+
531
+ #######################################
532
+ # User Access Methods from BECConnector
533
+ ######################################
534
+ def load_config(self, path: str | None = None, gui: bool = False):
535
+ """
536
+ Load the configuration of the widget from YAML.
537
+
538
+ Args:
539
+ path(str): Path to the configuration file for non-GUI dialog mode.
540
+ gui(bool): If True, use the GUI dialog to load the configuration file.
541
+ """
542
+ self.fig.load_config(path=path, gui=gui)
543
+
544
+ def save_config(self, path: str | None = None, gui: bool = False):
545
+ """
546
+ Save the configuration of the widget to YAML.
547
+
548
+ Args:
549
+ path(str): Path to save the configuration file for non-GUI dialog mode.
550
+ gui(bool): If True, use the GUI dialog to save the configuration file.
551
+ """
552
+ self.fig.save_config(path=path, gui=gui)
553
+
554
+ def cleanup(self):
555
+ self.fig.cleanup()
556
+ self.client.shutdown()
557
+ return super().cleanup()
558
+
559
+
560
+ def main(): # pragma: no cover
561
+
562
+ from qtpy.QtWidgets import QApplication
563
+
564
+ app = QApplication(sys.argv)
565
+ widget = BECWaveformWidget()
566
+ widget.show()
567
+ sys.exit(app.exec_())
568
+
569
+
570
+ if __name__ == "__main__": # pragma: no cover
571
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.87.1
3
+ Version: 0.88.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