bec-widgets 1.25.1__py3-none-any.whl → 2.0.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.
- .gitlab-ci.yml +3 -5
- CHANGELOG.md +631 -0
- PKG-INFO +3 -3
- bec_widgets/__init__.py +4 -0
- bec_widgets/applications/bw_launch.py +23 -0
- bec_widgets/applications/launch_window.py +430 -0
- bec_widgets/assets/app_icons/auto_update.png +0 -0
- bec_widgets/assets/app_icons/ui_loader_tile.png +0 -0
- bec_widgets/cli/__init__.py +0 -1
- bec_widgets/cli/client.py +1779 -2064
- bec_widgets/cli/client_utils.py +346 -174
- bec_widgets/cli/generate_cli.py +143 -37
- bec_widgets/cli/rpc/rpc_base.py +152 -21
- bec_widgets/cli/rpc/rpc_register.py +113 -6
- bec_widgets/cli/rpc/rpc_widget_handler.py +13 -11
- bec_widgets/cli/server.py +125 -239
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +97 -145
- bec_widgets/examples/plugin_example_pyside/tictactoetaskmenu.py +1 -1
- bec_widgets/utils/bec_connector.py +190 -21
- bec_widgets/utils/bec_designer.py +7 -0
- bec_widgets/utils/bec_dispatcher.py +71 -4
- bec_widgets/utils/bec_plugin_helper.py +89 -0
- bec_widgets/utils/bec_signal_proxy.py +1 -1
- bec_widgets/utils/bec_widget.py +26 -10
- bec_widgets/utils/colors.py +1 -1
- bec_widgets/{qt_utils → utils}/compact_popup.py +2 -0
- bec_widgets/utils/container_utils.py +37 -12
- bec_widgets/utils/crosshair.py +25 -8
- bec_widgets/utils/entry_validator.py +3 -1
- bec_widgets/{qt_utils → utils}/error_popups.py +18 -0
- bec_widgets/{qt_utils → utils}/expandable_frame.py +2 -2
- bec_widgets/utils/forms_from_types/forms.py +182 -0
- bec_widgets/{widgets/editors/scan_metadata/_metadata_widgets.py → utils/forms_from_types/items.py} +41 -30
- bec_widgets/utils/generate_designer_plugin.py +40 -36
- bec_widgets/utils/linear_region_selector.py +2 -0
- bec_widgets/utils/name_utils.py +16 -0
- bec_widgets/{qt_utils → utils}/palette_viewer.py +2 -2
- bec_widgets/utils/plot_indicator_items.py +2 -5
- bec_widgets/utils/plugin_utils.py +47 -1
- bec_widgets/{qt_utils → utils}/round_frame.py +14 -14
- bec_widgets/utils/rpc_server.py +277 -0
- bec_widgets/utils/serialization.py +44 -0
- bec_widgets/{qt_utils → utils}/settings_dialog.py +26 -1
- bec_widgets/{qt_utils → utils}/side_panel.py +17 -10
- bec_widgets/{qt_utils → utils}/toolbar.py +69 -25
- bec_widgets/utils/ui_loader.py +8 -8
- bec_widgets/utils/widget_io.py +166 -25
- bec_widgets/widgets/containers/auto_update/auto_updates.py +364 -0
- bec_widgets/widgets/containers/dock/dock.py +157 -49
- bec_widgets/widgets/containers/dock/dock_area.py +186 -138
- bec_widgets/widgets/containers/layout_manager/layout_manager.py +2 -1
- bec_widgets/widgets/containers/main_window/addons/web_links.py +15 -0
- bec_widgets/widgets/containers/main_window/main_window.py +189 -41
- bec_widgets/widgets/control/buttons/button_abort/button_abort.py +3 -4
- bec_widgets/widgets/control/buttons/button_reset/button_reset.py +3 -4
- bec_widgets/widgets/control/buttons/button_resume/button_resume.py +3 -3
- bec_widgets/widgets/control/buttons/stop_button/stop_button.py +18 -7
- bec_widgets/widgets/control/device_control/position_indicator/position_indicator.py +22 -3
- bec_widgets/widgets/control/device_control/positioner_box/_base/positioner_box_base.py +31 -13
- bec_widgets/widgets/control/device_control/positioner_box/positioner_box/positioner_box.py +3 -1
- bec_widgets/widgets/control/device_control/positioner_box/positioner_box/positioner_box.ui +27 -4
- bec_widgets/widgets/control/device_control/positioner_box/positioner_box_2d/positioner_box_2d.py +5 -2
- bec_widgets/widgets/control/device_control/positioner_box/positioner_box_2d/positioner_box_2d.ui +97 -31
- bec_widgets/widgets/control/device_control/positioner_box/positioner_control_line/positioner_control_line.ui +11 -4
- bec_widgets/widgets/control/device_control/positioner_group/positioner_group.py +2 -3
- bec_widgets/widgets/control/device_input/base_classes/device_input_base.py +29 -4
- bec_widgets/widgets/control/device_input/base_classes/device_signal_input_base.py +1 -0
- bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py +2 -2
- bec_widgets/widgets/control/device_input/device_line_edit/device_line_edit.py +2 -2
- bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py +1 -2
- bec_widgets/widgets/control/device_input/signal_line_edit/signal_line_edit.py +1 -2
- bec_widgets/widgets/control/scan_control/scan_control.py +7 -5
- bec_widgets/widgets/control/scan_control/scan_group_box.py +28 -5
- bec_widgets/widgets/dap/dap_combo_box/dap_combo_box.py +1 -2
- bec_widgets/widgets/dap/lmfit_dialog/lmfit_dialog.py +3 -4
- bec_widgets/widgets/dap/lmfit_dialog/lmfit_dialog_vertical.ui +14 -8
- bec_widgets/widgets/editors/console/console.py +1 -1
- bec_widgets/widgets/editors/{scan_metadata/additional_metadata_table.py → dict_backed_table.py} +29 -6
- bec_widgets/widgets/editors/scan_metadata/__init__.py +0 -7
- bec_widgets/widgets/editors/scan_metadata/_util.py +1 -1
- bec_widgets/widgets/{plots/motor_map/register_bec_motor_map_widget.py → editors/scan_metadata/register_scan_metadata.py} +2 -4
- bec_widgets/widgets/editors/scan_metadata/scan_metadata.py +42 -136
- bec_widgets/widgets/editors/scan_metadata/scan_metadata.pyproject +1 -0
- bec_widgets/widgets/{plots/multi_waveform/bec_multi_waveform_widget_plugin.py → editors/scan_metadata/scan_metadata_plugin.py} +9 -9
- bec_widgets/widgets/editors/text_box/text_box.py +2 -3
- bec_widgets/widgets/editors/website/website.py +2 -2
- bec_widgets/widgets/games/minesweeper.py +3 -2
- bec_widgets/widgets/plots/image/image.py +960 -0
- bec_widgets/widgets/plots/image/image.pyproject +1 -0
- bec_widgets/widgets/plots/image/image_item.py +279 -0
- bec_widgets/widgets/plots/{motor_map/bec_motor_map_widget_plugin.py → image/image_plugin.py} +11 -13
- bec_widgets/widgets/{containers/figure/plots → plots}/image/image_processor.py +31 -64
- bec_widgets/widgets/plots/image/{register_bec_image_widget.py → register_image.py} +2 -2
- bec_widgets/widgets/plots/image/toolbar_bundles/image_selection.py +59 -0
- bec_widgets/widgets/plots/image/toolbar_bundles/processing.py +79 -0
- bec_widgets/widgets/plots/motor_map/motor_map.py +832 -0
- bec_widgets/widgets/plots/motor_map/motor_map.pyproject +1 -0
- bec_widgets/widgets/plots/motor_map/motor_map_plugin.py +54 -0
- bec_widgets/widgets/plots/{multi_waveform/register_bec_multi_waveform_widget.py → motor_map/register_motor_map.py} +2 -4
- bec_widgets/widgets/plots/motor_map/settings/motor_map_settings.py +129 -0
- bec_widgets/widgets/plots/motor_map/settings/motor_map_settings.ui +120 -0
- bec_widgets/widgets/plots/motor_map/toolbar_bundles/motor_selection.py +70 -0
- bec_widgets/widgets/plots/multi_waveform/multi_waveform.py +508 -0
- bec_widgets/widgets/plots/multi_waveform/multi_waveform.pyproject +1 -0
- bec_widgets/widgets/plots/multi_waveform/multi_waveform_plugin.py +54 -0
- bec_widgets/widgets/plots/multi_waveform/register_multi_waveform.py +15 -0
- bec_widgets/widgets/plots/multi_waveform/settings/control_panel.py +144 -0
- bec_widgets/widgets/plots/multi_waveform/settings/multi_waveform_controls.ui +164 -0
- bec_widgets/widgets/plots/multi_waveform/toolbar_bundles/monitor_selection.py +65 -0
- bec_widgets/widgets/{plots_next_gen → plots}/plot_base.py +321 -40
- bec_widgets/widgets/plots/{waveform/register_bec_waveform_widget.py → scatter_waveform/register_scatter_waveform.py} +3 -3
- bec_widgets/widgets/plots/scatter_waveform/scatter_curve.py +197 -0
- bec_widgets/widgets/plots/scatter_waveform/scatter_waveform.py +553 -0
- bec_widgets/widgets/plots/scatter_waveform/scatter_waveform.pyproject +1 -0
- bec_widgets/widgets/plots/{image/bec_image_widget_plugin.py → scatter_waveform/scatter_waveform_plugin.py} +9 -13
- bec_widgets/widgets/plots/scatter_waveform/settings/scatter_curve_setting.py +138 -0
- bec_widgets/widgets/plots/scatter_waveform/settings/scatter_curve_settings_horizontal.ui +195 -0
- bec_widgets/widgets/plots/scatter_waveform/settings/scatter_curve_settings_vertical.ui +204 -0
- bec_widgets/widgets/{plots_next_gen → plots}/setting_menus/axis_settings.py +8 -8
- bec_widgets/widgets/{plots_next_gen → plots}/toolbar_bundles/mouse_interactions.py +4 -18
- bec_widgets/widgets/{plots_next_gen → plots}/toolbar_bundles/plot_export.py +14 -3
- bec_widgets/widgets/{plots_next_gen → plots}/toolbar_bundles/roi_bundle.py +6 -1
- bec_widgets/widgets/{plots_next_gen → plots}/toolbar_bundles/save_state.py +2 -2
- bec_widgets/widgets/{containers/figure/plots/waveform/waveform_curve.py → plots/waveform/curve.py} +119 -49
- bec_widgets/widgets/plots/waveform/register_waveform.py +15 -0
- bec_widgets/widgets/plots/waveform/settings/curve_settings/curve_setting.py +125 -0
- bec_widgets/widgets/plots/waveform/settings/curve_settings/curve_tree.py +576 -0
- bec_widgets/widgets/plots/waveform/utils/__init__.py +0 -0
- bec_widgets/widgets/plots/waveform/utils/roi_manager.py +84 -0
- bec_widgets/widgets/plots/waveform/waveform.py +1794 -0
- bec_widgets/widgets/plots/waveform/waveform.pyproject +1 -0
- bec_widgets/widgets/plots/waveform/{bec_waveform_widget_plugin.py → waveform_plugin.py} +9 -13
- bec_widgets/widgets/progress/bec_progressbar/bec_progressbar.py +1 -2
- bec_widgets/widgets/progress/ring_progress_bar/ring.py +11 -10
- bec_widgets/widgets/progress/ring_progress_bar/ring_progress_bar.py +24 -14
- bec_widgets/widgets/services/bec_queue/bec_queue.py +13 -11
- bec_widgets/widgets/services/bec_status_box/bec_status_box.py +3 -4
- bec_widgets/widgets/services/device_browser/device_browser.py +5 -2
- bec_widgets/widgets/services/device_browser/device_item/device_item.py +1 -1
- bec_widgets/widgets/utility/logpanel/logpanel.py +36 -17
- bec_widgets/widgets/utility/spinbox/decimal_spinbox.py +3 -3
- bec_widgets/widgets/utility/visual/color_button/color_button.py +1 -1
- bec_widgets/widgets/utility/visual/colormap_widget/colormap_widget.py +4 -6
- bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py +4 -8
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.0.dist-info}/METADATA +3 -3
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.0.dist-info}/RECORD +168 -153
- pyproject.toml +3 -3
- bec_widgets/applications/alignment/alignment_1d/alignment_1d.py +0 -198
- bec_widgets/applications/alignment/alignment_1d/alignment_1d.ui +0 -615
- bec_widgets/applications/bec_app.py +0 -84
- bec_widgets/cli/auto_updates.py +0 -168
- bec_widgets/widgets/containers/figure/__init__.py +0 -1
- bec_widgets/widgets/containers/figure/figure.py +0 -796
- bec_widgets/widgets/containers/figure/plots/axis_settings.py +0 -91
- bec_widgets/widgets/containers/figure/plots/axis_settings.ui +0 -256
- bec_widgets/widgets/containers/figure/plots/image/image.py +0 -772
- bec_widgets/widgets/containers/figure/plots/image/image_item.py +0 -337
- bec_widgets/widgets/containers/figure/plots/motor_map/motor_map.py +0 -525
- bec_widgets/widgets/containers/figure/plots/multi_waveform/multi_waveform.py +0 -340
- bec_widgets/widgets/containers/figure/plots/plot_base.py +0 -505
- bec_widgets/widgets/containers/figure/plots/waveform/waveform.py +0 -1563
- bec_widgets/widgets/plots/image/bec_image_widget.pyproject +0 -1
- bec_widgets/widgets/plots/image/image_widget.py +0 -515
- bec_widgets/widgets/plots/motor_map/bec_motor_map_widget.pyproject +0 -1
- bec_widgets/widgets/plots/motor_map/motor_map_dialog/motor_map_settings.py +0 -56
- bec_widgets/widgets/plots/motor_map/motor_map_dialog/motor_map_settings.ui +0 -108
- bec_widgets/widgets/plots/motor_map/motor_map_widget.py +0 -234
- bec_widgets/widgets/plots/multi_waveform/bec_multi_waveform_widget.pyproject +0 -1
- bec_widgets/widgets/plots/multi_waveform/multi_waveform_controls.ui +0 -99
- bec_widgets/widgets/plots/multi_waveform/multi_waveform_widget.py +0 -536
- bec_widgets/widgets/plots/waveform/bec_waveform_widget.pyproject +0 -1
- bec_widgets/widgets/plots/waveform/waveform_popups/curve_dialog/curve_dialog.py +0 -336
- bec_widgets/widgets/plots/waveform/waveform_popups/curve_dialog/curve_dialog.ui +0 -372
- bec_widgets/widgets/plots/waveform/waveform_popups/dap_summary_dialog/dap_summary_dialog.py +0 -25
- bec_widgets/widgets/plots/waveform/waveform_widget.py +0 -751
- /bec_widgets/{qt_utils → utils}/collapsible_panel_manager.py +0 -0
- /bec_widgets/{applications/alignment → utils/forms_from_types}/__init__.py +0 -0
- /bec_widgets/{qt_utils → utils}/redis_message_waiter.py +0 -0
- /bec_widgets/{applications/alignment/alignment_1d → widgets/containers/auto_update}/__init__.py +0 -0
- /bec_widgets/{qt_utils → widgets/containers/main_window/addons}/__init__.py +0 -0
- /bec_widgets/widgets/{containers/figure/plots → plots/image/toolbar_bundles}/__init__.py +0 -0
- /bec_widgets/widgets/{containers/figure/plots/image → plots/motor_map/settings}/__init__.py +0 -0
- /bec_widgets/widgets/{containers/figure/plots/motor_map → plots/motor_map/toolbar_bundles}/__init__.py +0 -0
- /bec_widgets/widgets/{containers/figure/plots/multi_waveform → plots/multi_waveform/settings}/__init__.py +0 -0
- /bec_widgets/widgets/{containers/figure/plots/waveform → plots/multi_waveform/toolbar_bundles}/__init__.py +0 -0
- /bec_widgets/widgets/plots/{motor_map/motor_map_dialog → scatter_waveform}/__init__.py +0 -0
- /bec_widgets/widgets/plots/{waveform/waveform_popups → scatter_waveform/settings}/__init__.py +0 -0
- /bec_widgets/widgets/plots/{waveform/waveform_popups/curve_dialog → setting_menus}/__init__.py +0 -0
- /bec_widgets/widgets/{plots_next_gen → plots}/setting_menus/axis_settings_horizontal.ui +0 -0
- /bec_widgets/widgets/{plots_next_gen → plots}/setting_menus/axis_settings_vertical.ui +0 -0
- /bec_widgets/widgets/plots/{waveform/waveform_popups/dap_summary_dialog → toolbar_bundles}/__init__.py +0 -0
- /bec_widgets/widgets/{plots_next_gen/setting_menus → plots/waveform/settings}/__init__.py +0 -0
- /bec_widgets/widgets/{plots_next_gen/toolbar_bundles → plots/waveform/settings/curve_settings}/__init__.py +0 -0
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.0.dist-info}/WHEEL +0 -0
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,336 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import os
|
4
|
-
from typing import Literal
|
5
|
-
|
6
|
-
from bec_qthemes import material_icon
|
7
|
-
from pydantic import BaseModel
|
8
|
-
from qtpy.QtCore import QObject, Slot
|
9
|
-
from qtpy.QtWidgets import QComboBox, QLineEdit, QPushButton, QSpinBox, QTableWidget, QVBoxLayout
|
10
|
-
|
11
|
-
import bec_widgets
|
12
|
-
from bec_widgets.qt_utils.error_popups import WarningPopupUtility
|
13
|
-
from bec_widgets.qt_utils.settings_dialog import SettingWidget
|
14
|
-
from bec_widgets.utils import Colors, UILoader
|
15
|
-
from bec_widgets.widgets.control.device_input.device_line_edit.device_line_edit import (
|
16
|
-
DeviceLineEdit,
|
17
|
-
)
|
18
|
-
from bec_widgets.widgets.dap.dap_combo_box.dap_combo_box import DapComboBox
|
19
|
-
from bec_widgets.widgets.utility.visual.color_button.color_button import ColorButton
|
20
|
-
|
21
|
-
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
22
|
-
|
23
|
-
|
24
|
-
class CurveSettings(SettingWidget):
|
25
|
-
def __init__(self, parent=None, *args, **kwargs):
|
26
|
-
super().__init__(parent, *args, **kwargs)
|
27
|
-
current_path = os.path.dirname(__file__)
|
28
|
-
|
29
|
-
self.ui = UILoader(self).loader(os.path.join(current_path, "curve_dialog.ui"))
|
30
|
-
self._setup_icons()
|
31
|
-
|
32
|
-
self.warning_util = WarningPopupUtility(self)
|
33
|
-
|
34
|
-
self.layout = QVBoxLayout(self)
|
35
|
-
self.layout.addWidget(self.ui)
|
36
|
-
|
37
|
-
self.ui.add_curve.clicked.connect(self.add_curve)
|
38
|
-
self.ui.add_dap.clicked.connect(self.add_dap)
|
39
|
-
self.ui.x_mode.currentIndexChanged.connect(self.set_x_mode)
|
40
|
-
self.ui.normalize_colors_scan.clicked.connect(lambda: self.change_colormap("scan"))
|
41
|
-
self.ui.normalize_colors_dap.clicked.connect(lambda: self.change_colormap("dap"))
|
42
|
-
|
43
|
-
def _setup_icons(self):
|
44
|
-
add_icon = material_icon(icon_name="add", size=(20, 20), convert_to_pixmap=False)
|
45
|
-
self.ui.add_dap.setIcon(add_icon)
|
46
|
-
self.ui.add_dap.setToolTip("Add DAP Curve")
|
47
|
-
self.ui.add_curve.setIcon(add_icon)
|
48
|
-
self.ui.add_curve.setToolTip("Add Scan Curve")
|
49
|
-
|
50
|
-
@Slot(dict)
|
51
|
-
def display_current_settings(self, config: dict | BaseModel):
|
52
|
-
|
53
|
-
# What elements should be enabled
|
54
|
-
x_name = self.target_widget.waveform._x_axis_mode["name"]
|
55
|
-
x_entry = self.target_widget.waveform._x_axis_mode["entry"]
|
56
|
-
self._enable_ui_elements(x_name, x_entry)
|
57
|
-
cm = self.target_widget.config.color_palette
|
58
|
-
self.ui.color_map_selector_scan.colormap = cm
|
59
|
-
|
60
|
-
# Scan Curve Table
|
61
|
-
for source in ["scan_segment", "async"]:
|
62
|
-
for label, curve in config[source].items():
|
63
|
-
row_count = self.ui.scan_table.rowCount()
|
64
|
-
self.ui.scan_table.insertRow(row_count)
|
65
|
-
DialogRow(
|
66
|
-
parent=self,
|
67
|
-
table_widget=self.ui.scan_table,
|
68
|
-
client=self.target_widget.client,
|
69
|
-
row=row_count,
|
70
|
-
config=curve.config,
|
71
|
-
).add_scan_row()
|
72
|
-
|
73
|
-
# Add DAP Curves
|
74
|
-
for label, curve in config["DAP"].items():
|
75
|
-
row_count = self.ui.dap_table.rowCount()
|
76
|
-
self.ui.dap_table.insertRow(row_count)
|
77
|
-
DialogRow(
|
78
|
-
parent=self,
|
79
|
-
table_widget=self.ui.dap_table,
|
80
|
-
client=self.target_widget.client,
|
81
|
-
row=row_count,
|
82
|
-
config=curve.config,
|
83
|
-
).add_dap_row()
|
84
|
-
|
85
|
-
def _enable_ui_elements(self, name, entry):
|
86
|
-
if name is None:
|
87
|
-
name = "best_effort"
|
88
|
-
if name in ["index", "timestamp", "best_effort"]:
|
89
|
-
self.ui.x_mode.setCurrentText(name)
|
90
|
-
self.set_x_mode()
|
91
|
-
else:
|
92
|
-
self.ui.x_mode.setCurrentText("device")
|
93
|
-
self.set_x_mode()
|
94
|
-
self.ui.x_name.setText(name)
|
95
|
-
self.ui.x_entry.setText(entry)
|
96
|
-
|
97
|
-
@Slot()
|
98
|
-
def set_x_mode(self):
|
99
|
-
x_mode = self.ui.x_mode.currentText()
|
100
|
-
if x_mode in ["index", "timestamp", "best_effort"]:
|
101
|
-
self.ui.x_name.setEnabled(False)
|
102
|
-
self.ui.x_entry.setEnabled(False)
|
103
|
-
self.ui.dap_table.setEnabled(False)
|
104
|
-
self.ui.add_dap.setEnabled(False)
|
105
|
-
if self.ui.dap_table.rowCount() > 0:
|
106
|
-
self.warning_util.show_warning(
|
107
|
-
title="DAP Warning",
|
108
|
-
message="DAP is not supported without specific x-axis device. All current DAP curves will be removed.",
|
109
|
-
detailed_text=f"Affected curves: {[self.ui.dap_table.cellWidget(row, 0).text() for row in range(self.ui.dap_table.rowCount())]}",
|
110
|
-
)
|
111
|
-
else:
|
112
|
-
self.ui.x_name.setEnabled(True)
|
113
|
-
self.ui.x_entry.setEnabled(True)
|
114
|
-
self.ui.dap_table.setEnabled(True)
|
115
|
-
self.ui.add_dap.setEnabled(True)
|
116
|
-
|
117
|
-
@Slot()
|
118
|
-
def change_colormap(self, target: Literal["scan", "dap"]):
|
119
|
-
if target == "scan":
|
120
|
-
cm = self.ui.color_map_selector_scan.colormap
|
121
|
-
table = self.ui.scan_table
|
122
|
-
if target == "dap":
|
123
|
-
cm = self.ui.color_map_selector_dap.colormap
|
124
|
-
table = self.ui.dap_table
|
125
|
-
rows = table.rowCount()
|
126
|
-
colors = Colors.golden_angle_color(colormap=cm, num=max(10, rows + 1), format="HEX")
|
127
|
-
color_button_col = 2 if target == "scan" else 3
|
128
|
-
for row in range(rows):
|
129
|
-
table.cellWidget(row, color_button_col).set_color(colors[row])
|
130
|
-
|
131
|
-
@Slot()
|
132
|
-
def accept_changes(self):
|
133
|
-
self.accept_curve_changes()
|
134
|
-
|
135
|
-
def accept_curve_changes(self):
|
136
|
-
sources = ["scan_segment", "async", "DAP"]
|
137
|
-
old_curves = []
|
138
|
-
|
139
|
-
for source in sources:
|
140
|
-
old_curves += list(self.target_widget.waveform._curves_data[source].values())
|
141
|
-
for curve in old_curves:
|
142
|
-
curve.remove()
|
143
|
-
self.get_curve_params()
|
144
|
-
|
145
|
-
def get_curve_params(self):
|
146
|
-
x_mode = self.ui.x_mode.currentText()
|
147
|
-
|
148
|
-
if x_mode in ["index", "timestamp", "best_effort"]:
|
149
|
-
x_name = x_mode
|
150
|
-
x_entry = x_mode
|
151
|
-
else:
|
152
|
-
x_name = self.ui.x_name.text()
|
153
|
-
x_entry = self.ui.x_entry.text()
|
154
|
-
|
155
|
-
self.target_widget.set_x(x_name=x_name, x_entry=x_entry)
|
156
|
-
|
157
|
-
for row in range(self.ui.scan_table.rowCount()):
|
158
|
-
y_name = self.ui.scan_table.cellWidget(row, 0).text()
|
159
|
-
y_entry = self.ui.scan_table.cellWidget(row, 1).text()
|
160
|
-
color = self.ui.scan_table.cellWidget(row, 2).get_color()
|
161
|
-
style = self.ui.scan_table.cellWidget(row, 3).currentText()
|
162
|
-
width = self.ui.scan_table.cellWidget(row, 4).value()
|
163
|
-
symbol_size = self.ui.scan_table.cellWidget(row, 5).value()
|
164
|
-
self.target_widget.plot(
|
165
|
-
y_name=y_name,
|
166
|
-
y_entry=y_entry,
|
167
|
-
color=color,
|
168
|
-
pen_style=style,
|
169
|
-
pen_width=width,
|
170
|
-
symbol_size=symbol_size,
|
171
|
-
)
|
172
|
-
|
173
|
-
if x_mode not in ["index", "timestamp", "best_effort"]:
|
174
|
-
|
175
|
-
for row in range(self.ui.dap_table.rowCount()):
|
176
|
-
y_name = self.ui.dap_table.cellWidget(row, 0).text()
|
177
|
-
y_entry = self.ui.dap_table.cellWidget(row, 1).text()
|
178
|
-
dap = self.ui.dap_table.cellWidget(row, 2).currentText()
|
179
|
-
color = self.ui.dap_table.cellWidget(row, 3).get_color()
|
180
|
-
style = self.ui.dap_table.cellWidget(row, 4).currentText()
|
181
|
-
width = self.ui.dap_table.cellWidget(row, 5).value()
|
182
|
-
symbol_size = self.ui.dap_table.cellWidget(row, 6).value()
|
183
|
-
|
184
|
-
self.target_widget.add_dap(
|
185
|
-
x_name=x_name,
|
186
|
-
x_entry=x_entry,
|
187
|
-
y_name=y_name,
|
188
|
-
y_entry=y_entry,
|
189
|
-
dap=dap,
|
190
|
-
color=color,
|
191
|
-
pen_style=style,
|
192
|
-
pen_width=width,
|
193
|
-
symbol_size=symbol_size,
|
194
|
-
)
|
195
|
-
self.target_widget.scan_history(-1)
|
196
|
-
|
197
|
-
def add_curve(self):
|
198
|
-
row_count = self.ui.scan_table.rowCount()
|
199
|
-
self.ui.scan_table.insertRow(row_count)
|
200
|
-
DialogRow(
|
201
|
-
parent=self,
|
202
|
-
table_widget=self.ui.scan_table,
|
203
|
-
client=self.target_widget.client,
|
204
|
-
row=row_count,
|
205
|
-
config=None,
|
206
|
-
).add_scan_row()
|
207
|
-
|
208
|
-
def add_dap(self):
|
209
|
-
row_count = self.ui.dap_table.rowCount()
|
210
|
-
self.ui.dap_table.insertRow(row_count)
|
211
|
-
DialogRow(
|
212
|
-
parent=self,
|
213
|
-
table_widget=self.ui.dap_table,
|
214
|
-
client=self.target_widget.client,
|
215
|
-
row=row_count,
|
216
|
-
config=None,
|
217
|
-
).add_dap_row()
|
218
|
-
|
219
|
-
|
220
|
-
class DialogRow(QObject):
|
221
|
-
def __init__(
|
222
|
-
self,
|
223
|
-
parent=None,
|
224
|
-
table_widget: QTableWidget = None,
|
225
|
-
row: int = None,
|
226
|
-
config: dict = None,
|
227
|
-
client=None,
|
228
|
-
):
|
229
|
-
|
230
|
-
super().__init__(parent=parent)
|
231
|
-
self.client = client
|
232
|
-
|
233
|
-
self.table_widget = table_widget
|
234
|
-
self.row = row
|
235
|
-
self.config = config
|
236
|
-
self.init_default_widgets()
|
237
|
-
|
238
|
-
def init_default_widgets(self):
|
239
|
-
|
240
|
-
# Remove Button
|
241
|
-
self.remove_button = RemoveButton()
|
242
|
-
|
243
|
-
# Name and Entry
|
244
|
-
self.device_line_edit = DeviceLineEdit()
|
245
|
-
self.entry_line_edit = QLineEdit()
|
246
|
-
|
247
|
-
self.dap_combo = DapComboBox()
|
248
|
-
self.dap_combo.populate_fit_model_combobox()
|
249
|
-
self.dap_combo.select_fit_model("GaussianModel")
|
250
|
-
|
251
|
-
# Styling
|
252
|
-
self.color_button = ColorButton()
|
253
|
-
self.style_combo = StyleComboBox()
|
254
|
-
self.width = QSpinBox()
|
255
|
-
self.width.setMinimum(1)
|
256
|
-
self.width.setMaximum(20)
|
257
|
-
self.width.setValue(4)
|
258
|
-
|
259
|
-
self.symbol_size = QSpinBox()
|
260
|
-
self.symbol_size.setMinimum(1)
|
261
|
-
self.symbol_size.setMaximum(20)
|
262
|
-
self.symbol_size.setValue(7)
|
263
|
-
|
264
|
-
self.remove_button.clicked.connect(
|
265
|
-
lambda: self.remove_row()
|
266
|
-
) # From some reason do not work without lambda
|
267
|
-
|
268
|
-
def add_scan_row(self):
|
269
|
-
if self.config is not None:
|
270
|
-
self.device_line_edit.setText(self.config.signals.y.name)
|
271
|
-
self.entry_line_edit.setText(self.config.signals.y.entry)
|
272
|
-
self.color_button.set_color(self.config.color)
|
273
|
-
self.style_combo.setCurrentText(self.config.pen_style)
|
274
|
-
self.width.setValue(self.config.pen_width)
|
275
|
-
self.symbol_size.setValue(self.config.symbol_size)
|
276
|
-
else:
|
277
|
-
default_colors = Colors.golden_angle_color(
|
278
|
-
colormap="magma", num=max(10, self.row + 1), format="HEX"
|
279
|
-
)
|
280
|
-
default_color = default_colors[self.row]
|
281
|
-
self.color_button.set_color(default_color)
|
282
|
-
|
283
|
-
self.table_widget.setCellWidget(self.row, 0, self.device_line_edit)
|
284
|
-
self.table_widget.setCellWidget(self.row, 1, self.entry_line_edit)
|
285
|
-
self.table_widget.setCellWidget(self.row, 2, self.color_button)
|
286
|
-
self.table_widget.setCellWidget(self.row, 3, self.style_combo)
|
287
|
-
self.table_widget.setCellWidget(self.row, 4, self.width)
|
288
|
-
self.table_widget.setCellWidget(self.row, 5, self.symbol_size)
|
289
|
-
self.table_widget.setCellWidget(self.row, 6, self.remove_button)
|
290
|
-
|
291
|
-
def add_dap_row(self):
|
292
|
-
if self.config is not None:
|
293
|
-
self.device_line_edit.setText(self.config.signals.y.name)
|
294
|
-
self.entry_line_edit.setText(self.config.signals.y.entry)
|
295
|
-
self.dap_combo.fit_model_combobox.setCurrentText(self.config.signals.dap)
|
296
|
-
self.color_button.set_color(self.config.color)
|
297
|
-
self.style_combo.setCurrentText(self.config.pen_style)
|
298
|
-
self.width.setValue(self.config.pen_width)
|
299
|
-
self.symbol_size.setValue(self.config.symbol_size)
|
300
|
-
else:
|
301
|
-
default_colors = Colors.golden_angle_color(
|
302
|
-
colormap="magma", num=max(10, self.row + 1), format="HEX"
|
303
|
-
)
|
304
|
-
default_color = default_colors[self.row]
|
305
|
-
self.color_button.set_color(default_color)
|
306
|
-
|
307
|
-
self.table_widget.setCellWidget(self.row, 0, self.device_line_edit)
|
308
|
-
self.table_widget.setCellWidget(self.row, 1, self.entry_line_edit)
|
309
|
-
self.table_widget.setCellWidget(self.row, 2, self.dap_combo.fit_model_combobox)
|
310
|
-
self.table_widget.setCellWidget(self.row, 3, self.color_button)
|
311
|
-
self.table_widget.setCellWidget(self.row, 4, self.style_combo)
|
312
|
-
self.table_widget.setCellWidget(self.row, 5, self.width)
|
313
|
-
self.table_widget.setCellWidget(self.row, 6, self.symbol_size)
|
314
|
-
self.table_widget.setCellWidget(self.row, 7, self.remove_button)
|
315
|
-
|
316
|
-
@Slot()
|
317
|
-
def remove_row(self):
|
318
|
-
row = self.table_widget.indexAt(self.remove_button.pos()).row()
|
319
|
-
self.cleanup()
|
320
|
-
self.table_widget.removeRow(row)
|
321
|
-
|
322
|
-
def cleanup(self):
|
323
|
-
self.device_line_edit.cleanup()
|
324
|
-
|
325
|
-
|
326
|
-
class StyleComboBox(QComboBox):
|
327
|
-
def __init__(self, parent=None):
|
328
|
-
super().__init__(parent)
|
329
|
-
self.addItems(["solid", "dash", "dot", "dashdot"])
|
330
|
-
|
331
|
-
|
332
|
-
class RemoveButton(QPushButton):
|
333
|
-
def __init__(self, parent=None):
|
334
|
-
super().__init__(parent)
|
335
|
-
icon = material_icon("disabled_by_default", size=(20, 20), convert_to_pixmap=False)
|
336
|
-
self.setIcon(icon)
|