bec-widgets 0.99.1__py3-none-any.whl → 0.99.9__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 +0 -1
- CHANGELOG.md +76 -70
- PKG-INFO +2 -2
- bec_widgets/cli/client.py +3 -3
- bec_widgets/qt_utils/toolbar.py +11 -5
- bec_widgets/utils/bec_widget.py +11 -2
- bec_widgets/utils/colors.py +18 -2
- bec_widgets/utils/plugin_templates/plugin.template +2 -2
- bec_widgets/widgets/bec_queue/bec_queue.py +2 -0
- bec_widgets/widgets/bec_queue/bec_queue_plugin.py +1 -1
- bec_widgets/widgets/bec_status_box/bec_status_box.py +2 -0
- bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +1 -1
- bec_widgets/widgets/color_button/color_button.py +2 -0
- bec_widgets/widgets/color_button/color_button_plugin.py +1 -1
- bec_widgets/widgets/colormap_selector/colormap_selector.py +1 -0
- bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py +1 -1
- bec_widgets/widgets/dark_mode_button/dark_mode_button.py +12 -3
- bec_widgets/widgets/dark_mode_button/dark_mode_button_plugin.py +1 -1
- bec_widgets/widgets/device_browser/device_browser.py +2 -0
- bec_widgets/widgets/device_browser/device_browser_plugin.py +1 -1
- bec_widgets/widgets/device_combobox/device_combo_box_plugin.py +1 -1
- bec_widgets/widgets/device_combobox/device_combobox.py +2 -0
- bec_widgets/widgets/device_line_edit/device_line_edit.py +2 -0
- bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +1 -1
- bec_widgets/widgets/dock/dock.py +1 -0
- bec_widgets/widgets/dock/dock_area.py +30 -10
- bec_widgets/widgets/dock/dock_area_plugin.py +1 -1
- bec_widgets/widgets/figure/figure.py +1 -1
- bec_widgets/widgets/figure/plots/waveform/waveform.py +12 -7
- bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +3 -3
- bec_widgets/widgets/image/bec_image_widget_plugin.py +1 -1
- bec_widgets/widgets/image/image_widget.py +1 -0
- bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +1 -1
- bec_widgets/widgets/motor_map/motor_map_widget.py +1 -0
- bec_widgets/widgets/position_indicator/position_indicator.py +2 -0
- bec_widgets/widgets/position_indicator/position_indicator_plugin.py +1 -1
- bec_widgets/widgets/positioner_box/positioner_box.py +1 -0
- bec_widgets/widgets/positioner_box/positioner_box_plugin.py +1 -1
- bec_widgets/widgets/positioner_box/positioner_control_line.py +2 -0
- bec_widgets/widgets/positioner_box/positioner_control_line_plugin.py +1 -1
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar.py +1 -0
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +1 -1
- bec_widgets/widgets/scan_control/scan_control.py +2 -0
- bec_widgets/widgets/scan_control/scan_control_plugin.py +1 -4
- bec_widgets/widgets/spinner/spinner.py +2 -0
- bec_widgets/widgets/spinner/spinner_widget_plugin.py +1 -1
- bec_widgets/widgets/stop_button/stop_button.py +2 -0
- bec_widgets/widgets/stop_button/stop_button_plugin.py +1 -1
- bec_widgets/widgets/text_box/text_box.py +1 -0
- bec_widgets/widgets/text_box/text_box_plugin.py +1 -1
- bec_widgets/widgets/toggle/toggle.py +1 -0
- bec_widgets/widgets/toggle/toggle_switch_plugin.py +1 -1
- bec_widgets/widgets/vscode/vs_code_editor_plugin.py +1 -1
- bec_widgets/widgets/vscode/vscode.py +1 -0
- bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +1 -1
- bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +14 -13
- bec_widgets/widgets/waveform/waveform_widget.py +3 -2
- bec_widgets/widgets/website/website.py +42 -10
- bec_widgets/widgets/website/website_widget_plugin.py +1 -1
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/METADATA +2 -2
- bec_widgets-0.99.9.dist-info/RECORD +231 -0
- pyproject.toml +7 -2
- bec_widgets/assets/toolbar_icons/add.svg +0 -3
- bec_widgets/assets/toolbar_icons/attach_all.svg +0 -3
- bec_widgets/assets/toolbar_icons/auto_range.svg +0 -3
- bec_widgets/assets/toolbar_icons/compare.svg +0 -3
- bec_widgets/assets/toolbar_icons/connection.svg +0 -4
- bec_widgets/assets/toolbar_icons/device_line_edit.svg +0 -3
- bec_widgets/assets/toolbar_icons/drag_pan_mode.svg +0 -3
- bec_widgets/assets/toolbar_icons/export.svg +0 -9
- bec_widgets/assets/toolbar_icons/fft.svg +0 -11
- bec_widgets/assets/toolbar_icons/fitting_parameters.svg +0 -3
- bec_widgets/assets/toolbar_icons/history.svg +0 -4
- bec_widgets/assets/toolbar_icons/image.svg +0 -3
- bec_widgets/assets/toolbar_icons/image_autorange.svg +0 -3
- bec_widgets/assets/toolbar_icons/import.svg +0 -9
- bec_widgets/assets/toolbar_icons/line_axis.svg +0 -3
- bec_widgets/assets/toolbar_icons/line_curve.svg +0 -3
- bec_widgets/assets/toolbar_icons/lock_aspect_ratio.svg +0 -3
- bec_widgets/assets/toolbar_icons/log_scale.png +0 -0
- bec_widgets/assets/toolbar_icons/motor_map.svg +0 -3
- bec_widgets/assets/toolbar_icons/photo_library.svg +0 -3
- bec_widgets/assets/toolbar_icons/positioner_box.svg +0 -3
- bec_widgets/assets/toolbar_icons/progress.svg +0 -3
- bec_widgets/assets/toolbar_icons/queue.svg +0 -3
- bec_widgets/assets/toolbar_icons/rectangle_mode.svg +0 -3
- bec_widgets/assets/toolbar_icons/remove.svg +0 -5
- bec_widgets/assets/toolbar_icons/reset_settings.svg +0 -3
- bec_widgets/assets/toolbar_icons/restore_state.svg +0 -3
- bec_widgets/assets/toolbar_icons/ring_progress.svg +0 -3
- bec_widgets/assets/toolbar_icons/rotate_left.svg +0 -3
- bec_widgets/assets/toolbar_icons/rotate_right.svg +0 -3
- bec_widgets/assets/toolbar_icons/save.svg +0 -3
- bec_widgets/assets/toolbar_icons/save_state.svg +0 -3
- bec_widgets/assets/toolbar_icons/scan_control.svg +0 -3
- bec_widgets/assets/toolbar_icons/settings.svg +0 -4
- bec_widgets/assets/toolbar_icons/status.svg +0 -3
- bec_widgets/assets/toolbar_icons/terminal.svg +0 -3
- bec_widgets/assets/toolbar_icons/transform.svg +0 -3
- bec_widgets/assets/toolbar_icons/waveform.svg +0 -3
- bec_widgets-0.99.1.dist-info/RECORD +0 -415
- docs/Makefile +0 -20
- docs/_static/custom.css +0 -170
- docs/_templates/custom-class-template.rst +0 -34
- docs/_templates/custom-module-template.rst +0 -66
- docs/api_reference/api_reference.md +0 -12
- docs/assets/apps_48dp.svg +0 -1
- docs/assets/display_settings_48dp.svg +0 -1
- docs/assets/index_api.svg +0 -97
- docs/assets/index_contribute.svg +0 -76
- docs/assets/index_getting_started.svg +0 -66
- docs/assets/index_user_guide.svg +0 -67
- docs/assets/rocket_launch_48dp.svg +0 -1
- docs/assets/widget_screenshots/buttons.png +0 -0
- docs/assets/widget_screenshots/device_box.png +0 -0
- docs/assets/widget_screenshots/device_browser.png +0 -0
- docs/assets/widget_screenshots/device_inputs.png +0 -0
- docs/assets/widget_screenshots/dock_area.png +0 -0
- docs/assets/widget_screenshots/figure.png +0 -0
- docs/assets/widget_screenshots/image_widget.png +0 -0
- docs/assets/widget_screenshots/motor_map_widget.png +0 -0
- docs/assets/widget_screenshots/position_indicator.png +0 -0
- docs/assets/widget_screenshots/queue.png +0 -0
- docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
- docs/assets/widget_screenshots/scan_controller.png +0 -0
- docs/assets/widget_screenshots/spinner.gif +0 -0
- docs/assets/widget_screenshots/status_box.png +0 -0
- docs/assets/widget_screenshots/text_box.png +0 -0
- docs/assets/widget_screenshots/toggle.png +0 -0
- docs/assets/widget_screenshots/waveform_widget.png +0 -0
- docs/assets/widget_screenshots/website.png +0 -0
- docs/conf.py +0 -82
- docs/developer/developer.md +0 -52
- docs/developer/introduction/concepts.md +0 -14
- docs/developer/introduction/contributing.md +0 -28
- docs/developer/introduction/introduction.md +0 -16
- docs/developer/introduction/useful_links.md +0 -23
- docs/developer/widget_development/bec_dispatcher.md +0 -143
- docs/developer/widget_development/widget_development.md +0 -13
- docs/index.md +0 -74
- docs/introduction/introduction.md +0 -18
- docs/make.bat +0 -35
- docs/requirements.txt +0 -12
- docs/user/api_reference/api_reference.md +0 -11
- docs/user/applications/applications.md +0 -10
- docs/user/customisation.md +0 -123
- docs/user/getting_started/BECDockArea.png +0 -0
- docs/user/getting_started/auto_updates.md +0 -82
- docs/user/getting_started/getting_started.md +0 -15
- docs/user/getting_started/gui_complex_gui.gif +0 -0
- docs/user/getting_started/installation.md +0 -33
- docs/user/getting_started/quick_start.md +0 -110
- docs/user/getting_started/video_tutorials.md +0 -17
- docs/user/user.md +0 -71
- docs/user/widgets/bec_figure/BECFigure.png +0 -0
- docs/user/widgets/bec_figure/bec_figure.md +0 -105
- docs/user/widgets/bec_status_box/bec_status_box.gif +0 -0
- docs/user/widgets/bec_status_box/bec_status_box.md +0 -38
- docs/user/widgets/buttons/buttons.md +0 -63
- docs/user/widgets/buttons/dark_mode_disabled.png +0 -0
- docs/user/widgets/buttons/dark_mode_enabled.png +0 -0
- docs/user/widgets/device_browser/device_browser.md +0 -36
- docs/user/widgets/device_browser/device_browser.png +0 -0
- docs/user/widgets/device_input/device_input.md +0 -100
- docs/user/widgets/dock_area/BECDockArea.png +0 -0
- docs/user/widgets/dock_area/bec_dock_area.md +0 -107
- docs/user/widgets/image/image_plot.gif +0 -0
- docs/user/widgets/image/image_widget.md +0 -84
- docs/user/widgets/motor_map/motor.gif +0 -0
- docs/user/widgets/motor_map/motor_map.md +0 -80
- docs/user/widgets/position_indicator/position_indicator.md +0 -76
- docs/user/widgets/positioner_box/positioner_box.md +0 -63
- docs/user/widgets/progress_bar/progress_bar.gif +0 -0
- docs/user/widgets/progress_bar/ring_progress_bar.md +0 -103
- docs/user/widgets/queue/queue.md +0 -41
- docs/user/widgets/scan_control/hide_scan_control.png +0 -0
- docs/user/widgets/scan_control/scan_control.gif +0 -0
- docs/user/widgets/scan_control/scan_control.md +0 -54
- docs/user/widgets/spinner/spinner.md +0 -75
- docs/user/widgets/text_box/text_box.md +0 -74
- docs/user/widgets/toggle/toggle.md +0 -66
- docs/user/widgets/waveform/bec_figure_dap.gif +0 -0
- docs/user/widgets/waveform/scatter_2D.gif +0 -0
- docs/user/widgets/waveform/w1D.gif +0 -0
- docs/user/widgets/waveform/waveform_widget.md +0 -132
- docs/user/widgets/website/website.md +0 -69
- docs/user/widgets/widgets.md +0 -220
- tests/__init__.py +0 -0
- tests/end-2-end/__init__.py +0 -0
- tests/end-2-end/conftest.py +0 -53
- tests/end-2-end/test_bec_dock_rpc_e2e.py +0 -298
- tests/end-2-end/test_bec_figure_rpc_e2e.py +0 -212
- tests/end-2-end/test_rpc_register_e2e.py +0 -40
- tests/end-2-end/test_scan_control_e2e.py +0 -71
- tests/references/SpinnerWidget/SpinnerWidget_darwin.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_linux.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_started_darwin.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_started_linux.png +0 -0
- tests/unit_tests/__init__.py +0 -0
- tests/unit_tests/client_mocks.py +0 -189
- tests/unit_tests/conftest.py +0 -64
- tests/unit_tests/test_bec_connector.py +0 -80
- tests/unit_tests/test_bec_dispatcher.py +0 -119
- tests/unit_tests/test_bec_dock.py +0 -155
- tests/unit_tests/test_bec_figure.py +0 -270
- tests/unit_tests/test_bec_image.py +0 -63
- tests/unit_tests/test_bec_image_widget.py +0 -217
- tests/unit_tests/test_bec_motor_map.py +0 -282
- tests/unit_tests/test_bec_queue.py +0 -111
- tests/unit_tests/test_bec_status_box.py +0 -123
- tests/unit_tests/test_client_utils.py +0 -76
- tests/unit_tests/test_color_map_selector.py +0 -42
- tests/unit_tests/test_color_validation.py +0 -75
- tests/unit_tests/test_configs/config_device.yaml +0 -33
- tests/unit_tests/test_configs/config_device_no_entry.yaml +0 -27
- tests/unit_tests/test_configs/config_scan.yaml +0 -82
- tests/unit_tests/test_crosshair.py +0 -143
- tests/unit_tests/test_dark_mode_button.py +0 -70
- tests/unit_tests/test_device_browser.py +0 -83
- tests/unit_tests/test_device_input_base.py +0 -76
- tests/unit_tests/test_device_input_widgets.py +0 -178
- tests/unit_tests/test_error_utils.py +0 -63
- tests/unit_tests/test_generate_cli_client.py +0 -123
- tests/unit_tests/test_generate_plugin.py +0 -155
- tests/unit_tests/test_motor_map_widget.py +0 -194
- tests/unit_tests/test_msgs/__init__.py +0 -0
- tests/unit_tests/test_msgs/available_scans_message.py +0 -989
- tests/unit_tests/test_plot_base.py +0 -95
- tests/unit_tests/test_plugin_utils.py +0 -13
- tests/unit_tests/test_positioner_box.py +0 -130
- tests/unit_tests/test_ring_progress_bar.py +0 -337
- tests/unit_tests/test_rpc_register.py +0 -52
- tests/unit_tests/test_rpc_server.py +0 -42
- tests/unit_tests/test_rpc_widget_handler.py +0 -7
- tests/unit_tests/test_scan_control.py +0 -324
- tests/unit_tests/test_scan_control_group_box.py +0 -160
- tests/unit_tests/test_setting_dialog.py +0 -96
- tests/unit_tests/test_spinner.py +0 -31
- tests/unit_tests/test_stop_button.py +0 -27
- tests/unit_tests/test_text_box_widget.py +0 -54
- tests/unit_tests/test_toggle.py +0 -38
- tests/unit_tests/test_vscode_widget.py +0 -75
- tests/unit_tests/test_waveform1d.py +0 -712
- tests/unit_tests/test_waveform_widget.py +0 -462
- tests/unit_tests/test_website_widget.py +0 -25
- tests/unit_tests/test_widget_io.py +0 -90
- tests/unit_tests/test_yaml_dialog.py +0 -163
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/WHEEL +0 -0
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,163 +0,0 @@
|
|
1
|
-
# pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
|
2
|
-
import os
|
3
|
-
import tempfile
|
4
|
-
from unittest.mock import patch
|
5
|
-
|
6
|
-
import pytest
|
7
|
-
import yaml
|
8
|
-
from qtpy.QtWidgets import QPushButton, QVBoxLayout, QWidget
|
9
|
-
|
10
|
-
from bec_widgets.utils.yaml_dialog import load_yaml_gui, save_yaml_gui
|
11
|
-
|
12
|
-
|
13
|
-
@pytest.fixture(scope="function")
|
14
|
-
def example_widget(qtbot):
|
15
|
-
main_widget = QWidget()
|
16
|
-
layout = QVBoxLayout(main_widget)
|
17
|
-
main_widget.import_button = QPushButton("Import", main_widget)
|
18
|
-
main_widget.export_button = QPushButton("Export", main_widget)
|
19
|
-
layout.addWidget(main_widget.import_button)
|
20
|
-
layout.addWidget(main_widget.export_button)
|
21
|
-
|
22
|
-
main_widget.config = {} # Dictionary to store the loaded configuration
|
23
|
-
main_widget.saved_config = None # To store the saved configuration
|
24
|
-
|
25
|
-
qtbot.addWidget(main_widget)
|
26
|
-
qtbot.waitExposed(main_widget)
|
27
|
-
yield main_widget
|
28
|
-
|
29
|
-
|
30
|
-
def test_load_yaml(qtbot, example_widget):
|
31
|
-
# Create a temporary file with YAML content
|
32
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".yaml") as temp_file:
|
33
|
-
temp_file.write(b"name: test\nvalue: 42")
|
34
|
-
|
35
|
-
def load_yaml_wrapper():
|
36
|
-
config = load_yaml_gui(example_widget)
|
37
|
-
if config:
|
38
|
-
example_widget.config.update(config)
|
39
|
-
|
40
|
-
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
41
|
-
|
42
|
-
# Mock user selecting the file in the dialog
|
43
|
-
with patch("qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=(temp_file.name, "")):
|
44
|
-
example_widget.import_button.click()
|
45
|
-
|
46
|
-
assert example_widget.config == {"name": "test", "value": 42}
|
47
|
-
os.remove(temp_file.name) # Clean up
|
48
|
-
|
49
|
-
|
50
|
-
def test_load_yaml_file_not_found(qtbot, example_widget, capsys):
|
51
|
-
def load_yaml_wrapper():
|
52
|
-
config = load_yaml_gui(example_widget)
|
53
|
-
if config:
|
54
|
-
example_widget.config.update(config)
|
55
|
-
|
56
|
-
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
57
|
-
|
58
|
-
# Mock user selecting a non-existent file in the dialog
|
59
|
-
with patch(
|
60
|
-
"qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=("non_existent_file.yaml", "")
|
61
|
-
):
|
62
|
-
example_widget.import_button.click()
|
63
|
-
|
64
|
-
# Catch the print output
|
65
|
-
captured = capsys.readouterr()
|
66
|
-
assert "The file non_existent_file.yaml was not found." in captured.out
|
67
|
-
|
68
|
-
assert example_widget.config == {} # No update should happen
|
69
|
-
|
70
|
-
|
71
|
-
def test_load_yaml_general_exception(qtbot, example_widget, capsys, monkeypatch):
|
72
|
-
# Mock the open function to raise a general exception
|
73
|
-
def mock_open(*args, **kwargs):
|
74
|
-
raise Exception("General error")
|
75
|
-
|
76
|
-
monkeypatch.setattr("builtins.open", mock_open)
|
77
|
-
|
78
|
-
def load_yaml_wrapper():
|
79
|
-
config = load_yaml_gui(example_widget)
|
80
|
-
if config:
|
81
|
-
example_widget.config.update(config)
|
82
|
-
|
83
|
-
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
84
|
-
|
85
|
-
# Mock user selecting a file in the dialog
|
86
|
-
with patch("qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=("somefile.yaml", "")):
|
87
|
-
example_widget.import_button.click()
|
88
|
-
|
89
|
-
assert example_widget.config == {}
|
90
|
-
|
91
|
-
|
92
|
-
def test_load_yaml_permission_error(qtbot, example_widget, monkeypatch, capsys):
|
93
|
-
# Create a temporary file and remove read permissions
|
94
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".yaml") as temp_file:
|
95
|
-
temp_file_path = temp_file.name
|
96
|
-
os.chmod(temp_file_path, 0o000) # Remove permissions
|
97
|
-
|
98
|
-
def load_yaml_wrapper():
|
99
|
-
config = load_yaml_gui(example_widget)
|
100
|
-
if config:
|
101
|
-
example_widget.config.update(config)
|
102
|
-
|
103
|
-
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
104
|
-
|
105
|
-
# Mock user selecting the file in the dialog
|
106
|
-
with patch("qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=(temp_file_path, "")):
|
107
|
-
example_widget.import_button.click()
|
108
|
-
|
109
|
-
# # Catch the print output
|
110
|
-
# captured = capsys.readouterr()
|
111
|
-
# assert "Permission denied for file" in captured.out
|
112
|
-
|
113
|
-
assert example_widget.config == {} # No update should happen
|
114
|
-
os.remove(temp_file_path) # Clean up
|
115
|
-
|
116
|
-
|
117
|
-
def test_load_yaml_invalid_yaml(qtbot, example_widget, capsys):
|
118
|
-
# Create a temporary file with invalid YAML content
|
119
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".yaml") as temp_file:
|
120
|
-
temp_file.write(b"\tinvalid_yaml: [unbalanced_brackets: ]")
|
121
|
-
|
122
|
-
def load_yaml_wrapper():
|
123
|
-
config = load_yaml_gui(example_widget)
|
124
|
-
if config:
|
125
|
-
example_widget.config.update(config)
|
126
|
-
|
127
|
-
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
128
|
-
|
129
|
-
# Mock user selecting the file in the dialog
|
130
|
-
with patch("qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=(temp_file.name, "")):
|
131
|
-
example_widget.import_button.click()
|
132
|
-
|
133
|
-
# Catch the print output
|
134
|
-
captured = capsys.readouterr()
|
135
|
-
assert "Error parsing YAML file" in captured.out
|
136
|
-
|
137
|
-
assert example_widget.config == {} # No update should happen
|
138
|
-
os.remove(temp_file.name) # Clean up
|
139
|
-
|
140
|
-
|
141
|
-
def test_save_yaml(qtbot, example_widget):
|
142
|
-
# Create a temporary file
|
143
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".yaml") as temp_file:
|
144
|
-
temp_file_path = temp_file.name
|
145
|
-
|
146
|
-
# Prepare data to be saved
|
147
|
-
example_widget.saved_config = {"name": "test", "value": 42}
|
148
|
-
|
149
|
-
def save_yaml_wrapper():
|
150
|
-
save_yaml_gui(example_widget, example_widget.saved_config)
|
151
|
-
|
152
|
-
example_widget.export_button.clicked.connect(save_yaml_wrapper)
|
153
|
-
|
154
|
-
# Mock user selecting the file in the dialog
|
155
|
-
with patch("qtpy.QtWidgets.QFileDialog.getSaveFileName", return_value=(temp_file_path, "")):
|
156
|
-
example_widget.export_button.click()
|
157
|
-
|
158
|
-
# Check if the data was saved correctly
|
159
|
-
with open(temp_file_path, "r") as file:
|
160
|
-
saved_config = yaml.safe_load(file)
|
161
|
-
assert saved_config == {"name": "test", "value": 42}
|
162
|
-
|
163
|
-
os.remove(temp_file_path) # Clean up
|
File without changes
|
File without changes
|
File without changes
|