bec-widgets 0.99.8__py3-none-any.whl → 0.99.10__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 (157) hide show
  1. CHANGELOG.md +18 -20
  2. PKG-INFO +1 -1
  3. bec_widgets/widgets/positioner_box/positioner_box.py +23 -11
  4. bec_widgets/widgets/stop_button/stop_button.py +30 -13
  5. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.10.dist-info}/METADATA +1 -1
  6. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.10.dist-info}/RECORD +10 -157
  7. pyproject.toml +6 -1
  8. docs/Makefile +0 -20
  9. docs/_static/custom.css +0 -170
  10. docs/_templates/custom-class-template.rst +0 -34
  11. docs/_templates/custom-module-template.rst +0 -66
  12. docs/api_reference/api_reference.md +0 -12
  13. docs/assets/apps_48dp.svg +0 -1
  14. docs/assets/display_settings_48dp.svg +0 -1
  15. docs/assets/index_api.svg +0 -97
  16. docs/assets/index_contribute.svg +0 -76
  17. docs/assets/index_getting_started.svg +0 -66
  18. docs/assets/index_user_guide.svg +0 -67
  19. docs/assets/rocket_launch_48dp.svg +0 -1
  20. docs/assets/widget_screenshots/buttons.png +0 -0
  21. docs/assets/widget_screenshots/device_box.png +0 -0
  22. docs/assets/widget_screenshots/device_browser.png +0 -0
  23. docs/assets/widget_screenshots/device_inputs.png +0 -0
  24. docs/assets/widget_screenshots/dock_area.png +0 -0
  25. docs/assets/widget_screenshots/figure.png +0 -0
  26. docs/assets/widget_screenshots/image_widget.png +0 -0
  27. docs/assets/widget_screenshots/motor_map_widget.png +0 -0
  28. docs/assets/widget_screenshots/position_indicator.png +0 -0
  29. docs/assets/widget_screenshots/queue.png +0 -0
  30. docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
  31. docs/assets/widget_screenshots/scan_controller.png +0 -0
  32. docs/assets/widget_screenshots/spinner.gif +0 -0
  33. docs/assets/widget_screenshots/status_box.png +0 -0
  34. docs/assets/widget_screenshots/text_box.png +0 -0
  35. docs/assets/widget_screenshots/toggle.png +0 -0
  36. docs/assets/widget_screenshots/waveform_widget.png +0 -0
  37. docs/assets/widget_screenshots/website.png +0 -0
  38. docs/conf.py +0 -82
  39. docs/developer/developer.md +0 -52
  40. docs/developer/introduction/concepts.md +0 -14
  41. docs/developer/introduction/contributing.md +0 -28
  42. docs/developer/introduction/introduction.md +0 -16
  43. docs/developer/introduction/useful_links.md +0 -23
  44. docs/developer/widget_development/bec_dispatcher.md +0 -143
  45. docs/developer/widget_development/widget_base_class.md +0 -171
  46. docs/developer/widget_development/widget_development.md +0 -14
  47. docs/index.md +0 -74
  48. docs/introduction/introduction.md +0 -18
  49. docs/make.bat +0 -35
  50. docs/requirements.txt +0 -12
  51. docs/user/api_reference/api_reference.md +0 -11
  52. docs/user/applications/applications.md +0 -10
  53. docs/user/customisation.md +0 -123
  54. docs/user/getting_started/BECDockArea.png +0 -0
  55. docs/user/getting_started/auto_updates.md +0 -82
  56. docs/user/getting_started/getting_started.md +0 -15
  57. docs/user/getting_started/gui_complex_gui.gif +0 -0
  58. docs/user/getting_started/installation.md +0 -33
  59. docs/user/getting_started/quick_start.md +0 -110
  60. docs/user/getting_started/video_tutorials.md +0 -17
  61. docs/user/user.md +0 -71
  62. docs/user/widgets/bec_figure/BECFigure.png +0 -0
  63. docs/user/widgets/bec_figure/bec_figure.md +0 -105
  64. docs/user/widgets/bec_status_box/bec_status_box.gif +0 -0
  65. docs/user/widgets/bec_status_box/bec_status_box.md +0 -38
  66. docs/user/widgets/buttons/buttons.md +0 -90
  67. docs/user/widgets/buttons/dark_mode_disabled.png +0 -0
  68. docs/user/widgets/buttons/dark_mode_enabled.png +0 -0
  69. docs/user/widgets/device_browser/device_browser.md +0 -36
  70. docs/user/widgets/device_browser/device_browser.png +0 -0
  71. docs/user/widgets/device_input/device_input.md +0 -100
  72. docs/user/widgets/dock_area/BECDockArea.png +0 -0
  73. docs/user/widgets/dock_area/bec_dock_area.md +0 -109
  74. docs/user/widgets/image/image_plot.gif +0 -0
  75. docs/user/widgets/image/image_widget.md +0 -84
  76. docs/user/widgets/motor_map/motor.gif +0 -0
  77. docs/user/widgets/motor_map/motor_map.md +0 -80
  78. docs/user/widgets/position_indicator/position_indicator.md +0 -69
  79. docs/user/widgets/positioner_box/positioner_box.md +0 -63
  80. docs/user/widgets/progress_bar/progress_bar.gif +0 -0
  81. docs/user/widgets/progress_bar/ring_progress_bar.md +0 -103
  82. docs/user/widgets/queue/queue.md +0 -41
  83. docs/user/widgets/scan_control/hide_scan_control.png +0 -0
  84. docs/user/widgets/scan_control/scan_control.gif +0 -0
  85. docs/user/widgets/scan_control/scan_control.md +0 -54
  86. docs/user/widgets/spinner/spinner.md +0 -68
  87. docs/user/widgets/text_box/text_box.md +0 -74
  88. docs/user/widgets/toggle/toggle.md +0 -66
  89. docs/user/widgets/waveform/bec_figure_dap.gif +0 -0
  90. docs/user/widgets/waveform/scatter_2D.gif +0 -0
  91. docs/user/widgets/waveform/w1D.gif +0 -0
  92. docs/user/widgets/waveform/waveform_widget.md +0 -132
  93. docs/user/widgets/website/website.md +0 -69
  94. docs/user/widgets/widgets.md +0 -220
  95. tests/__init__.py +0 -0
  96. tests/end-2-end/__init__.py +0 -0
  97. tests/end-2-end/conftest.py +0 -53
  98. tests/end-2-end/test_bec_dock_rpc_e2e.py +0 -298
  99. tests/end-2-end/test_bec_figure_rpc_e2e.py +0 -212
  100. tests/end-2-end/test_rpc_register_e2e.py +0 -40
  101. tests/end-2-end/test_scan_control_e2e.py +0 -71
  102. tests/references/SpinnerWidget/SpinnerWidget_darwin.png +0 -0
  103. tests/references/SpinnerWidget/SpinnerWidget_linux.png +0 -0
  104. tests/references/SpinnerWidget/SpinnerWidget_started_darwin.png +0 -0
  105. tests/references/SpinnerWidget/SpinnerWidget_started_linux.png +0 -0
  106. tests/unit_tests/__init__.py +0 -0
  107. tests/unit_tests/client_mocks.py +0 -189
  108. tests/unit_tests/conftest.py +0 -64
  109. tests/unit_tests/test_bec_connector.py +0 -80
  110. tests/unit_tests/test_bec_dispatcher.py +0 -119
  111. tests/unit_tests/test_bec_dock.py +0 -155
  112. tests/unit_tests/test_bec_figure.py +0 -270
  113. tests/unit_tests/test_bec_image.py +0 -63
  114. tests/unit_tests/test_bec_image_widget.py +0 -217
  115. tests/unit_tests/test_bec_motor_map.py +0 -282
  116. tests/unit_tests/test_bec_queue.py +0 -111
  117. tests/unit_tests/test_bec_status_box.py +0 -123
  118. tests/unit_tests/test_client_utils.py +0 -76
  119. tests/unit_tests/test_color_map_selector.py +0 -42
  120. tests/unit_tests/test_color_validation.py +0 -75
  121. tests/unit_tests/test_configs/config_device.yaml +0 -33
  122. tests/unit_tests/test_configs/config_device_no_entry.yaml +0 -27
  123. tests/unit_tests/test_configs/config_scan.yaml +0 -82
  124. tests/unit_tests/test_crosshair.py +0 -143
  125. tests/unit_tests/test_dark_mode_button.py +0 -70
  126. tests/unit_tests/test_device_browser.py +0 -83
  127. tests/unit_tests/test_device_input_base.py +0 -76
  128. tests/unit_tests/test_device_input_widgets.py +0 -178
  129. tests/unit_tests/test_error_utils.py +0 -63
  130. tests/unit_tests/test_generate_cli_client.py +0 -123
  131. tests/unit_tests/test_generate_plugin.py +0 -155
  132. tests/unit_tests/test_motor_map_widget.py +0 -194
  133. tests/unit_tests/test_msgs/__init__.py +0 -0
  134. tests/unit_tests/test_msgs/available_scans_message.py +0 -989
  135. tests/unit_tests/test_plot_base.py +0 -95
  136. tests/unit_tests/test_plugin_utils.py +0 -13
  137. tests/unit_tests/test_positioner_box.py +0 -130
  138. tests/unit_tests/test_ring_progress_bar.py +0 -337
  139. tests/unit_tests/test_rpc_register.py +0 -52
  140. tests/unit_tests/test_rpc_server.py +0 -42
  141. tests/unit_tests/test_rpc_widget_handler.py +0 -7
  142. tests/unit_tests/test_scan_control.py +0 -324
  143. tests/unit_tests/test_scan_control_group_box.py +0 -160
  144. tests/unit_tests/test_setting_dialog.py +0 -96
  145. tests/unit_tests/test_spinner.py +0 -31
  146. tests/unit_tests/test_stop_button.py +0 -27
  147. tests/unit_tests/test_text_box_widget.py +0 -54
  148. tests/unit_tests/test_toggle.py +0 -38
  149. tests/unit_tests/test_vscode_widget.py +0 -75
  150. tests/unit_tests/test_waveform1d.py +0 -712
  151. tests/unit_tests/test_waveform_widget.py +0 -462
  152. tests/unit_tests/test_website_widget.py +0 -25
  153. tests/unit_tests/test_widget_io.py +0 -90
  154. tests/unit_tests/test_yaml_dialog.py +0 -163
  155. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.10.dist-info}/WHEEL +0 -0
  156. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.10.dist-info}/entry_points.txt +0 -0
  157. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.10.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