bec-widgets 1.25.1__py3-none-any.whl → 2.0.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 +3 -5
- CHANGELOG.md +639 -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 +188 -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.1.dist-info}/METADATA +3 -3
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.1.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.1.dist-info}/WHEEL +0 -0
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.1.dist-info}/entry_points.txt +0 -0
- {bec_widgets-1.25.1.dist-info → bec_widgets-2.0.1.dist-info}/licenses/LICENSE +0 -0
pyproject.toml
CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "bec_widgets"
|
7
|
-
version = "
|
7
|
+
version = "2.0.1"
|
8
8
|
description = "BEC Widgets"
|
9
9
|
requires-python = ">=3.10"
|
10
10
|
classifiers = [
|
@@ -14,13 +14,13 @@ classifiers = [
|
|
14
14
|
]
|
15
15
|
dependencies = [
|
16
16
|
"bec_ipython_client>=2.21.4, <=4.0", # needed for jupyter console
|
17
|
-
"bec_lib>=
|
17
|
+
"bec_lib>=3.29, <=4.0",
|
18
18
|
"bec_qthemes~=0.7, >=0.7",
|
19
19
|
"black~=24.0", # needed for bw-generate-cli
|
20
20
|
"isort~=5.13, >=5.13.2", # needed for bw-generate-cli
|
21
21
|
"pydantic~=2.0",
|
22
22
|
"pyqtgraph~=0.13",
|
23
|
-
"PySide6
|
23
|
+
"PySide6~=6.8.2",
|
24
24
|
"pyte", # needed for vt100 console
|
25
25
|
"qtconsole~=5.5, >=5.5.1", # needed for jupyter console
|
26
26
|
"qtpy~=2.4",
|
@@ -1,198 +0,0 @@
|
|
1
|
-
""" This module contains the GUI for the 1D alignment application.
|
2
|
-
It is a preliminary version of the GUI, which will be added to the main branch and steadily updated to be improved.
|
3
|
-
"""
|
4
|
-
|
5
|
-
import os
|
6
|
-
from typing import Optional
|
7
|
-
|
8
|
-
from bec_lib.device import Signal as BECSignal
|
9
|
-
from bec_lib.endpoints import MessageEndpoints
|
10
|
-
from bec_lib.logger import bec_logger
|
11
|
-
from qtpy.QtCore import QSize
|
12
|
-
from qtpy.QtGui import QIcon
|
13
|
-
from qtpy.QtWidgets import QApplication
|
14
|
-
|
15
|
-
import bec_widgets
|
16
|
-
from bec_widgets.qt_utils.error_popups import SafeSlot as Slot
|
17
|
-
from bec_widgets.utils import UILoader
|
18
|
-
from bec_widgets.utils.bec_dispatcher import BECDispatcher
|
19
|
-
from bec_widgets.utils.colors import get_accent_colors
|
20
|
-
from bec_widgets.widgets.control.buttons.stop_button.stop_button import StopButton
|
21
|
-
from bec_widgets.widgets.control.device_control.positioner_group.positioner_group import (
|
22
|
-
PositionerGroup,
|
23
|
-
)
|
24
|
-
from bec_widgets.widgets.dap.lmfit_dialog.lmfit_dialog import LMFitDialog
|
25
|
-
from bec_widgets.widgets.plots.waveform.waveform_widget import BECWaveformWidget
|
26
|
-
from bec_widgets.widgets.progress.bec_progressbar.bec_progressbar import BECProgressBar
|
27
|
-
|
28
|
-
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
29
|
-
logger = bec_logger.logger
|
30
|
-
|
31
|
-
|
32
|
-
class Alignment1D:
|
33
|
-
"""Alignment GUI to perform 1D scans"""
|
34
|
-
|
35
|
-
def __init__(self, client=None, gui_id: Optional[str] = None) -> None:
|
36
|
-
"""Initialization
|
37
|
-
|
38
|
-
Args:
|
39
|
-
config: Configuration of the application.
|
40
|
-
client: BEC client object.
|
41
|
-
gui_id: GUI ID.
|
42
|
-
"""
|
43
|
-
self.bec_dispatcher = BECDispatcher(client=client)
|
44
|
-
self.client = self.bec_dispatcher.client if client is None else client
|
45
|
-
QApplication.instance().aboutToQuit.connect(self.close)
|
46
|
-
self.dev = self.client.device_manager.devices
|
47
|
-
|
48
|
-
self._accent_colors = get_accent_colors()
|
49
|
-
self.ui_file = "alignment_1d.ui"
|
50
|
-
self.ui = None
|
51
|
-
self.progress_bar = None
|
52
|
-
self.waveform = None
|
53
|
-
self.init_ui()
|
54
|
-
|
55
|
-
def init_ui(self):
|
56
|
-
"""Initialise the UI from QT Designer file"""
|
57
|
-
current_path = os.path.dirname(__file__)
|
58
|
-
self.ui = UILoader(None).loader(os.path.join(current_path, self.ui_file))
|
59
|
-
# Customize the plotting widget
|
60
|
-
self.waveform = self.ui.findChild(BECWaveformWidget, "bec_waveform_widget")
|
61
|
-
self._customise_bec_waveform_widget()
|
62
|
-
# Setup comboboxes for motor and signal selection
|
63
|
-
# FIXME after changing the filtering in the combobox
|
64
|
-
self._setup_signal_combobox()
|
65
|
-
# Setup motor indicator
|
66
|
-
self._setup_motor_indicator()
|
67
|
-
# Setup progress bar
|
68
|
-
self._setup_progress_bar()
|
69
|
-
# Add actions buttons
|
70
|
-
self._customise_buttons()
|
71
|
-
# Hook scaninfo updates
|
72
|
-
self.bec_dispatcher.connect_slot(self.scan_status_callback, MessageEndpoints.scan_status())
|
73
|
-
|
74
|
-
def show(self):
|
75
|
-
return self.ui.show()
|
76
|
-
|
77
|
-
##############################
|
78
|
-
############ SLOTS ###########
|
79
|
-
##############################
|
80
|
-
|
81
|
-
@Slot(dict, dict)
|
82
|
-
def scan_status_callback(self, content: dict, _) -> None:
|
83
|
-
"""This slot allows to enable/disable the UI critical components when a scan is running"""
|
84
|
-
if content["status"] in ["open"]:
|
85
|
-
self.enable_ui(False)
|
86
|
-
elif content["status"] in ["aborted", "halted", "closed"]:
|
87
|
-
self.enable_ui(True)
|
88
|
-
|
89
|
-
@Slot(tuple)
|
90
|
-
def move_to_center(self, move_request: tuple) -> None:
|
91
|
-
"""Move the selected motor to the center"""
|
92
|
-
motor = self.ui.device_combobox.currentText()
|
93
|
-
if move_request[0] in ["center", "center1", "center2"]:
|
94
|
-
pos = move_request[1]
|
95
|
-
self.dev.get(motor).move(float(pos), relative=False)
|
96
|
-
|
97
|
-
@Slot()
|
98
|
-
def reset_progress_bar(self) -> None:
|
99
|
-
"""Reset the progress bar"""
|
100
|
-
self.progress_bar.set_value(0)
|
101
|
-
self.progress_bar.set_minimum(0)
|
102
|
-
|
103
|
-
@Slot(dict, dict)
|
104
|
-
def update_progress_bar(self, content: dict, _) -> None:
|
105
|
-
"""Hook to update the progress bar
|
106
|
-
|
107
|
-
Args:
|
108
|
-
content: Content of the scan progress message.
|
109
|
-
metadata: Metadata of the message.
|
110
|
-
"""
|
111
|
-
if content["max_value"] == 0:
|
112
|
-
self.progress_bar.set_value(0)
|
113
|
-
return
|
114
|
-
self.progress_bar.set_maximum(content["max_value"])
|
115
|
-
self.progress_bar.set_value(content["value"])
|
116
|
-
|
117
|
-
@Slot()
|
118
|
-
def clear_queue(self) -> None:
|
119
|
-
"""Clear the scan queue"""
|
120
|
-
self.queue.request_queue_reset()
|
121
|
-
|
122
|
-
##############################
|
123
|
-
######## END OF SLOTS ########
|
124
|
-
##############################
|
125
|
-
|
126
|
-
def enable_ui(self, enable: bool) -> None:
|
127
|
-
"""Enable or disable the UI components"""
|
128
|
-
# Enable/disable motor and signal selection
|
129
|
-
self.ui.device_combobox_2.setEnabled(enable)
|
130
|
-
# Enable/disable DAP selection
|
131
|
-
self.ui.dap_combo_box.setEnabled(enable)
|
132
|
-
# Enable/disable Scan Button
|
133
|
-
# self.ui.scan_button.setEnabled(enable)
|
134
|
-
# Disable move to buttons in LMFitDialog
|
135
|
-
self.ui.findChild(LMFitDialog).set_actions_enabled(enable)
|
136
|
-
|
137
|
-
def _customise_buttons(self) -> None:
|
138
|
-
"""Add action buttons for the Action Control.
|
139
|
-
In addition, we are adding a callback to also clear the queue to the stop button
|
140
|
-
to ensure that upon clicking the button, no scans from another client may be queued
|
141
|
-
which would be confusing without the queue widget.
|
142
|
-
"""
|
143
|
-
fit_dialog = self.ui.findChild(LMFitDialog)
|
144
|
-
fit_dialog.active_action_list = ["center", "center1", "center2"]
|
145
|
-
fit_dialog.move_action.connect(self.move_to_center)
|
146
|
-
stop_button = self.ui.findChild(StopButton)
|
147
|
-
stop_button.button.setText("Stop and Clear Queue")
|
148
|
-
stop_button.button.clicked.connect(self.clear_queue)
|
149
|
-
|
150
|
-
def _customise_bec_waveform_widget(self) -> None:
|
151
|
-
"""Customise the BEC Waveform Widget, i.e. clear the toolbar"""
|
152
|
-
self.waveform.toolbar.clear()
|
153
|
-
|
154
|
-
def _setup_motor_indicator(self) -> None:
|
155
|
-
"""Setup the arrow item"""
|
156
|
-
self.waveform.waveform.tick_item.add_to_plot()
|
157
|
-
positioner_box = self.ui.findChild(PositionerGroup)
|
158
|
-
positioner_box.position_update.connect(self.waveform.waveform.tick_item.set_position)
|
159
|
-
self.waveform.waveform.tick_item.set_position(0)
|
160
|
-
|
161
|
-
def _setup_signal_combobox(self) -> None:
|
162
|
-
"""Setup signal selection"""
|
163
|
-
# FIXME after changing the filtering in the combobox
|
164
|
-
signals = [name for name in self.dev if isinstance(self.dev.get(name), BECSignal)]
|
165
|
-
self.ui.device_combobox_2.setCurrentText(signals[0])
|
166
|
-
self.ui.device_combobox_2.set_device_filter("Signal")
|
167
|
-
|
168
|
-
def _setup_progress_bar(self) -> None:
|
169
|
-
"""Setup progress bar"""
|
170
|
-
# FIXME once the BECScanProgressBar is implemented
|
171
|
-
self.progress_bar = self.ui.findChild(BECProgressBar, "bec_progress_bar")
|
172
|
-
self.progress_bar.set_value(0)
|
173
|
-
self.ui.bec_waveform_widget.new_scan.connect(self.reset_progress_bar)
|
174
|
-
self.bec_dispatcher.connect_slot(self.update_progress_bar, MessageEndpoints.scan_progress())
|
175
|
-
|
176
|
-
def close(self):
|
177
|
-
logger.info("Disconnecting", repr(self.bec_dispatcher))
|
178
|
-
self.bec_dispatcher.disconnect_all()
|
179
|
-
logger.info("Shutting down BEC Client", repr(self.client))
|
180
|
-
self.client.shutdown()
|
181
|
-
|
182
|
-
|
183
|
-
def main():
|
184
|
-
import sys
|
185
|
-
|
186
|
-
app = QApplication(sys.argv)
|
187
|
-
icon = QIcon()
|
188
|
-
icon.addFile(
|
189
|
-
os.path.join(MODULE_PATH, "assets", "app_icons", "alignment_1d.png"), size=QSize(48, 48)
|
190
|
-
)
|
191
|
-
app.setWindowIcon(icon)
|
192
|
-
window = Alignment1D()
|
193
|
-
window.show()
|
194
|
-
sys.exit(app.exec_())
|
195
|
-
|
196
|
-
|
197
|
-
if __name__ == "__main__": # pragma: no cover
|
198
|
-
main()
|