bec-widgets 0.99.8__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.
Files changed (155) hide show
  1. CHANGELOG.md +6 -6
  2. PKG-INFO +1 -1
  3. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.9.dist-info}/METADATA +1 -1
  4. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.9.dist-info}/RECORD +8 -155
  5. pyproject.toml +6 -1
  6. docs/Makefile +0 -20
  7. docs/_static/custom.css +0 -170
  8. docs/_templates/custom-class-template.rst +0 -34
  9. docs/_templates/custom-module-template.rst +0 -66
  10. docs/api_reference/api_reference.md +0 -12
  11. docs/assets/apps_48dp.svg +0 -1
  12. docs/assets/display_settings_48dp.svg +0 -1
  13. docs/assets/index_api.svg +0 -97
  14. docs/assets/index_contribute.svg +0 -76
  15. docs/assets/index_getting_started.svg +0 -66
  16. docs/assets/index_user_guide.svg +0 -67
  17. docs/assets/rocket_launch_48dp.svg +0 -1
  18. docs/assets/widget_screenshots/buttons.png +0 -0
  19. docs/assets/widget_screenshots/device_box.png +0 -0
  20. docs/assets/widget_screenshots/device_browser.png +0 -0
  21. docs/assets/widget_screenshots/device_inputs.png +0 -0
  22. docs/assets/widget_screenshots/dock_area.png +0 -0
  23. docs/assets/widget_screenshots/figure.png +0 -0
  24. docs/assets/widget_screenshots/image_widget.png +0 -0
  25. docs/assets/widget_screenshots/motor_map_widget.png +0 -0
  26. docs/assets/widget_screenshots/position_indicator.png +0 -0
  27. docs/assets/widget_screenshots/queue.png +0 -0
  28. docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
  29. docs/assets/widget_screenshots/scan_controller.png +0 -0
  30. docs/assets/widget_screenshots/spinner.gif +0 -0
  31. docs/assets/widget_screenshots/status_box.png +0 -0
  32. docs/assets/widget_screenshots/text_box.png +0 -0
  33. docs/assets/widget_screenshots/toggle.png +0 -0
  34. docs/assets/widget_screenshots/waveform_widget.png +0 -0
  35. docs/assets/widget_screenshots/website.png +0 -0
  36. docs/conf.py +0 -82
  37. docs/developer/developer.md +0 -52
  38. docs/developer/introduction/concepts.md +0 -14
  39. docs/developer/introduction/contributing.md +0 -28
  40. docs/developer/introduction/introduction.md +0 -16
  41. docs/developer/introduction/useful_links.md +0 -23
  42. docs/developer/widget_development/bec_dispatcher.md +0 -143
  43. docs/developer/widget_development/widget_base_class.md +0 -171
  44. docs/developer/widget_development/widget_development.md +0 -14
  45. docs/index.md +0 -74
  46. docs/introduction/introduction.md +0 -18
  47. docs/make.bat +0 -35
  48. docs/requirements.txt +0 -12
  49. docs/user/api_reference/api_reference.md +0 -11
  50. docs/user/applications/applications.md +0 -10
  51. docs/user/customisation.md +0 -123
  52. docs/user/getting_started/BECDockArea.png +0 -0
  53. docs/user/getting_started/auto_updates.md +0 -82
  54. docs/user/getting_started/getting_started.md +0 -15
  55. docs/user/getting_started/gui_complex_gui.gif +0 -0
  56. docs/user/getting_started/installation.md +0 -33
  57. docs/user/getting_started/quick_start.md +0 -110
  58. docs/user/getting_started/video_tutorials.md +0 -17
  59. docs/user/user.md +0 -71
  60. docs/user/widgets/bec_figure/BECFigure.png +0 -0
  61. docs/user/widgets/bec_figure/bec_figure.md +0 -105
  62. docs/user/widgets/bec_status_box/bec_status_box.gif +0 -0
  63. docs/user/widgets/bec_status_box/bec_status_box.md +0 -38
  64. docs/user/widgets/buttons/buttons.md +0 -90
  65. docs/user/widgets/buttons/dark_mode_disabled.png +0 -0
  66. docs/user/widgets/buttons/dark_mode_enabled.png +0 -0
  67. docs/user/widgets/device_browser/device_browser.md +0 -36
  68. docs/user/widgets/device_browser/device_browser.png +0 -0
  69. docs/user/widgets/device_input/device_input.md +0 -100
  70. docs/user/widgets/dock_area/BECDockArea.png +0 -0
  71. docs/user/widgets/dock_area/bec_dock_area.md +0 -109
  72. docs/user/widgets/image/image_plot.gif +0 -0
  73. docs/user/widgets/image/image_widget.md +0 -84
  74. docs/user/widgets/motor_map/motor.gif +0 -0
  75. docs/user/widgets/motor_map/motor_map.md +0 -80
  76. docs/user/widgets/position_indicator/position_indicator.md +0 -69
  77. docs/user/widgets/positioner_box/positioner_box.md +0 -63
  78. docs/user/widgets/progress_bar/progress_bar.gif +0 -0
  79. docs/user/widgets/progress_bar/ring_progress_bar.md +0 -103
  80. docs/user/widgets/queue/queue.md +0 -41
  81. docs/user/widgets/scan_control/hide_scan_control.png +0 -0
  82. docs/user/widgets/scan_control/scan_control.gif +0 -0
  83. docs/user/widgets/scan_control/scan_control.md +0 -54
  84. docs/user/widgets/spinner/spinner.md +0 -68
  85. docs/user/widgets/text_box/text_box.md +0 -74
  86. docs/user/widgets/toggle/toggle.md +0 -66
  87. docs/user/widgets/waveform/bec_figure_dap.gif +0 -0
  88. docs/user/widgets/waveform/scatter_2D.gif +0 -0
  89. docs/user/widgets/waveform/w1D.gif +0 -0
  90. docs/user/widgets/waveform/waveform_widget.md +0 -132
  91. docs/user/widgets/website/website.md +0 -69
  92. docs/user/widgets/widgets.md +0 -220
  93. tests/__init__.py +0 -0
  94. tests/end-2-end/__init__.py +0 -0
  95. tests/end-2-end/conftest.py +0 -53
  96. tests/end-2-end/test_bec_dock_rpc_e2e.py +0 -298
  97. tests/end-2-end/test_bec_figure_rpc_e2e.py +0 -212
  98. tests/end-2-end/test_rpc_register_e2e.py +0 -40
  99. tests/end-2-end/test_scan_control_e2e.py +0 -71
  100. tests/references/SpinnerWidget/SpinnerWidget_darwin.png +0 -0
  101. tests/references/SpinnerWidget/SpinnerWidget_linux.png +0 -0
  102. tests/references/SpinnerWidget/SpinnerWidget_started_darwin.png +0 -0
  103. tests/references/SpinnerWidget/SpinnerWidget_started_linux.png +0 -0
  104. tests/unit_tests/__init__.py +0 -0
  105. tests/unit_tests/client_mocks.py +0 -189
  106. tests/unit_tests/conftest.py +0 -64
  107. tests/unit_tests/test_bec_connector.py +0 -80
  108. tests/unit_tests/test_bec_dispatcher.py +0 -119
  109. tests/unit_tests/test_bec_dock.py +0 -155
  110. tests/unit_tests/test_bec_figure.py +0 -270
  111. tests/unit_tests/test_bec_image.py +0 -63
  112. tests/unit_tests/test_bec_image_widget.py +0 -217
  113. tests/unit_tests/test_bec_motor_map.py +0 -282
  114. tests/unit_tests/test_bec_queue.py +0 -111
  115. tests/unit_tests/test_bec_status_box.py +0 -123
  116. tests/unit_tests/test_client_utils.py +0 -76
  117. tests/unit_tests/test_color_map_selector.py +0 -42
  118. tests/unit_tests/test_color_validation.py +0 -75
  119. tests/unit_tests/test_configs/config_device.yaml +0 -33
  120. tests/unit_tests/test_configs/config_device_no_entry.yaml +0 -27
  121. tests/unit_tests/test_configs/config_scan.yaml +0 -82
  122. tests/unit_tests/test_crosshair.py +0 -143
  123. tests/unit_tests/test_dark_mode_button.py +0 -70
  124. tests/unit_tests/test_device_browser.py +0 -83
  125. tests/unit_tests/test_device_input_base.py +0 -76
  126. tests/unit_tests/test_device_input_widgets.py +0 -178
  127. tests/unit_tests/test_error_utils.py +0 -63
  128. tests/unit_tests/test_generate_cli_client.py +0 -123
  129. tests/unit_tests/test_generate_plugin.py +0 -155
  130. tests/unit_tests/test_motor_map_widget.py +0 -194
  131. tests/unit_tests/test_msgs/__init__.py +0 -0
  132. tests/unit_tests/test_msgs/available_scans_message.py +0 -989
  133. tests/unit_tests/test_plot_base.py +0 -95
  134. tests/unit_tests/test_plugin_utils.py +0 -13
  135. tests/unit_tests/test_positioner_box.py +0 -130
  136. tests/unit_tests/test_ring_progress_bar.py +0 -337
  137. tests/unit_tests/test_rpc_register.py +0 -52
  138. tests/unit_tests/test_rpc_server.py +0 -42
  139. tests/unit_tests/test_rpc_widget_handler.py +0 -7
  140. tests/unit_tests/test_scan_control.py +0 -324
  141. tests/unit_tests/test_scan_control_group_box.py +0 -160
  142. tests/unit_tests/test_setting_dialog.py +0 -96
  143. tests/unit_tests/test_spinner.py +0 -31
  144. tests/unit_tests/test_stop_button.py +0 -27
  145. tests/unit_tests/test_text_box_widget.py +0 -54
  146. tests/unit_tests/test_toggle.py +0 -38
  147. tests/unit_tests/test_vscode_widget.py +0 -75
  148. tests/unit_tests/test_waveform1d.py +0 -712
  149. tests/unit_tests/test_waveform_widget.py +0 -462
  150. tests/unit_tests/test_website_widget.py +0 -25
  151. tests/unit_tests/test_widget_io.py +0 -90
  152. tests/unit_tests/test_yaml_dialog.py +0 -163
  153. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.9.dist-info}/WHEEL +0 -0
  154. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.9.dist-info}/entry_points.txt +0 -0
  155. {bec_widgets-0.99.8.dist-info → bec_widgets-0.99.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,82 +0,0 @@
1
- (user.auto_updates)=
2
- # Auto updates
3
- BEC Widgets provides a simple way to update the entire GUI configuration based on events. These events can be of different types, such as a new scan being started or completed, a button being pressed, a device reporting an error or the existence of a specific metadata key. This allows the users to streamline the experience of the GUI and to focus on the data and the analysis, rather than on the GUI itself.
4
-
5
- The default auto update only takes control over a single `BECFigure` widget, which is automatically added to the GUI instance. The update instance is accessible via the `bec.gui.auto_updates` object. The user can disable / enable the auto updates by setting the `enabled` attribute of the `bec.gui.auto_updates` object, e.g.
6
-
7
- ```python
8
- bec.gui.auto_updates.enabled = False
9
- ```
10
-
11
- Without further customization, the auto update will automatically update the `BECFigure` widget based on the currently performed scan. The behaviour is determined by the `handler` method of the `AutoUpdate` class:
12
-
13
- ````{dropdown} Auto Updates Handler
14
- :icon: code-square
15
- :animate: fade-in-slide-down
16
- :open:
17
- ```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
18
- :pyobject: AutoUpdates.handler
19
- ```
20
- ````
21
-
22
- As shown, the default handler switches between different scan names and updates the `BECFigure` widget accordingly. If the scan is a line scan, the `simple_line_scan` update method is executed.
23
-
24
- ````{dropdown} Auto Updates Simple Line Scan
25
- :icon: code-square
26
- :animate: fade-in-slide-down
27
- :open:
28
- ```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
29
- :pyobject: AutoUpdates.simple_line_scan
30
- ```
31
- ````
32
-
33
- As it can be seen from the above snippet, the update method gets the default figure by calling the `get_default_figure` method. If the figure is not found, maybe because the user has deleted or closed it, no update is performed. If the figure is found, the scan info is used to extract the first reported device for the x axis and the first device of the monitored devices for the y axis. The y axis can also be set by the user using the `selected_device` attribute:
34
-
35
- ```python
36
- bec.gui.auto_updates.selected_device = 'bpm4i'
37
- ```
38
-
39
-
40
- ````{dropdown} Auto Updates Code
41
- :icon: code-square
42
- :animate: fade-in-slide-down
43
- ```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
44
- ```
45
- ````
46
-
47
- ## Custom Auto Updates
48
- The beamline can customize their default behaviour through customized auto update classes. This can be achieved by modifying the class located in the beamline plugin repository: `<beamline_plugin>/bec_widgets/auto_updates.py`. The class should inherit from the `AutoUpdates` class and overwrite the `handler` method.
49
-
50
- ```python
51
- from bec_widgets.cli.auto_updates import AutoUpdates, ScanInfo
52
-
53
-
54
- class PlotUpdate(AutoUpdates):
55
- create_default_dock = True
56
- enabled = True
57
-
58
- # def simple_line_scan(self, info: ScanInfo) -> None:
59
- # """
60
- # Simple line scan.
61
- # """
62
- # fig = self.get_default_figure()
63
- # if not fig:
64
- # return
65
- # dev_x = info.scan_report_devices[0]
66
- # dev_y = self.get_selected_device(info.monitored_devices, self.gui.selected_device)
67
- # if not dev_y:
68
- # return
69
- # fig.clear_all()
70
- # plt = fig.plot(x_name=dev_x, y_name=dev_y)
71
- # plt.set(title=f"Custom Plot {info.scan_number}", x_label=dev_x, y_label=dev_y)
72
-
73
- def handler(self, info: ScanInfo) -> None:
74
- # EXAMPLES:
75
- # if info.scan_name == "line_scan" and info.scan_report_devices:
76
- # self.simple_line_scan(info)
77
- # return
78
- # if info.scan_name == "grid_scan" and info.scan_report_devices:
79
- # self.run_grid_scan_update(info)
80
- # return
81
- super().handler(info)
82
- ```
@@ -1,15 +0,0 @@
1
- (user.getting_started)=
2
- # Getting Started
3
- This section provides a comprehensive guide to getting started with BEC Widgets. Whether you are new to BEC Widgets or looking to refresh your knowledge, this guide will help you set up and navigate the framework with ease.
4
-
5
- ```{toctree}
6
- ---
7
- maxdepth: 2
8
- hidden: true
9
- ---
10
-
11
- installation/
12
- quick_start/
13
- auto_updates/
14
- video_tutorials/
15
- ```
@@ -1,33 +0,0 @@
1
- (user.installation)=
2
- # Installation
3
- **Prerequisites**
4
-
5
- Before installing BEC Widgets, please ensure the following requirements are met:
6
-
7
- 1. **Python Version:** BEC Widgets requires Python version 3.10 or higher. Verify your Python version to ensure compatibility.
8
- 2. **BEC Installation:** BEC Widgets works in conjunction with BEC. While BEC is a dependency and will be installed automatically, you can find more information about BEC and its installation process in the [BEC documentation](https://beamline-experiment-control.readthedocs.io/en/latest/).
9
-
10
- **Standard Installation**
11
-
12
- To install BEC Widgets using the pip package manager, execute the following command in your terminal for getting the default PyQT6 version into your python environment for BEC:
13
-
14
-
15
- ```bash
16
- pip install 'bec_widgets[pyqt6]'
17
- ```
18
-
19
- In case you want to use Pyside6, you can install it by using the following command:
20
-
21
- ```bash
22
- pip install 'bec_widgets[pyside6]'
23
- ```
24
-
25
- **Troubleshooting**
26
-
27
- If you encounter issues during installation, particularly with PyQt, try purging the pip cache:
28
-
29
- ```bash
30
- pip cache purge
31
- ```
32
-
33
- This can resolve conflicts or issues with package installations.
@@ -1,110 +0,0 @@
1
- (user.command_line_introduction)=
2
- # Quick start
3
- In order to use BEC Widgets as a plotting tool for BEC, it needs to be [installed](#user.installation) in the same Python environment as the BEC IPython client (please refer to the [BEC documentation](https://bec.readthedocs.io/en/latest/user/command_line_interface.html#start-up) for more details). Upon startup, the client will automatically launch a GUI and store it as a `bec.gui` object in the client. The GUI backend will also be automatically connect to the BEC server, giving access to all information on the server and allowing the user to visualize the data in real-time.
4
-
5
- ## BECDockArea
6
- The `bec.gui` object is your entry point to BEC Widgets. It is a [`BECDockArea`](/api_reference/_autosummary/bec_widgets.cli.client.BECDockArea) instance that can be composed of multiple [`BECDock`](/api_reference/_autosummary/bec_widgets.cli.client.BECDock)s that can be attached / detached to the main area. These docks allow users to freely arrange and customize the widgets they add to the gui, providing a flexible and customizable interface to visualize data.
7
-
8
- **Schema of the BECDockArea**
9
-
10
- ![BECDockArea.png](BECDockArea.png)
11
-
12
- ## Widgets
13
- Widgets are the building blocks of the BEC Widgets framework. They are the visual components that allow users to interact with the data and control the behavior of the application. Each dock can contain multiple widgets, albeit we recommend for most use cases a single widget per dock. BEC Widgets provides a set of core widgets (cf. [widgets](#user.widgets)). More widgets can be added by the users, and we invite you to explore the [developer documentation](developer.widgets) to learn how to create custom widgets.
14
- For the introduction given here, we will focus on the `BECFigure` widget, as it is the most commonly used widget for visualizing data from BEC. The same access pattern can be used for all other widgets.
15
-
16
- **BECFigure**
17
-
18
- The [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) widget is one of the core widgets developed for BEC and can be used to visualize different plot types, such as [1D waveforms](user.widgets.waveform_1d), [2D scatter plots](user.widgets.scatter_2d), [position maps](user.widgets.motor_map) and [2D images](user.widgets.image_2d).
19
- If BEC Widgets is installed, the default behaviour of BEC is to automatically add a BECFigure Widget to the existing GUI instance. This widget is directly accessible via the `fig` object from the client. Moreover, a best-effort attempt is made to automatically determine the best plot type based on the currently performed scan. This behaviour can be changed or disabled by the user. For more details, please refer to the [auto update](user.auto_updates) section.
20
-
21
- <!-- We also provide two methods [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot), [`image()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.image) and [`motor_map()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.motor_map) as shortcuts to add a plot, image or motor map to the BECFigure. -->
22
-
23
- **Waveform Plot**
24
-
25
- The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform) is a widget that can be used to visualize 1D waveform data, i.e. to plot data of a monitor against a motor position. The method [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot) of BECFigure adds a BECWaveForm widget to the figure, and returns the plot object.
26
-
27
- ```python
28
- plt = fig.plot(x_name='samx', y_name='bpm4i')
29
- ```
30
- Here, we create a new plot with a subscription to the devices `samx` and `bpm4i` and assign the plot to the object `plt`. We can now use this object to further customize the plot, e.g. changing the title ([`set_title()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_title)), axis labels ([`set_x_label()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_label)) or limits ([`set_x_lim()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_lim)). We invite you to explore the API of the BECWaveForm in the [documentation](user.widgets.waveform_1d) or directly in the command line.
31
-
32
- To plot custom data, i.e. data that is not directly available through a scan in BEC, we can use the same method, but provide the data directly to the plot.
33
-
34
- ```python
35
- plt = fig.plot([1,2,3,4], [1,4,9,16])
36
- # or
37
- plt = fig.plot(x=[1,2,3,4], y=[1,4,9,16])
38
- # or
39
- plt = fig.plot(x=np.array([1,2,3,4]), y=np.array([1,4,9,16]))
40
- # or
41
- plt = fig.plot(np.random.rand(10,2))
42
- ```
43
-
44
- **Scatter Plot**
45
-
46
- The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveForm) widget can also be used to visualize 2D scatter plots. More details on setting up the scatter plot are available in the widget documentation of the [scatter plot](user.widgets.scatter_2d).
47
-
48
- **Motor Map**
49
-
50
- The [`BECMotorMap`](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap) widget can be used to visualize the position of motors. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans. More details on setting up the motor map are available in the widget documentation of the [motor map](user.widgets.motor_map).
51
-
52
- **Image Plot**
53
-
54
- The [`BECImageItem`](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem) widget can be used to visualize 2D image data for example a camera. More details on setting up the image plot are available in the widget documentation of the [image plot](user.widgets.image).
55
-
56
- ### Useful Commands
57
- We recommend users to explore the API of the widgets by themselves since we assume that the user interface is supposed to be intuitive and self-explanatory. We appreciate feedback from user in order to constantly improve the experience and allow easy access to the gui, widgets and their functionality. We recommend checking the [API documentation](user.api_reference), but also by using BEC Widgets, exploring the available functions and check their dockstrings.
58
- ```python
59
- gui.add_dock? # shows the dockstring of the add_dock method
60
- ```
61
-
62
- In addition, we list below a few useful commands that can be used to interface with the widgets:
63
-
64
- ```python
65
- gui.panels # returns a dictionary of all docks in the gui
66
- gui.add_dock() # adds a new dock to the gui
67
-
68
- dock = gui.panels['dock_2']
69
- dock.add_widget('BECFigure') # adds a new widget of BECFigure to the dock
70
- dock.widget_list # returns a list of all widgets in the dock
71
-
72
- figure = dock.widget_list[0] # assigns the created BECFigure to figure
73
- plt = figure.plot(x_name='samx', y_name='bpm4i') # adds a BECWaveForm plot to the figure
74
- plt.curves # returns a list of all curves in the plot
75
- ```
76
-
77
- We note that commands can also be chained. For example, `gui.add_dock().add_widget('BECFigure')` will add a new dock to the gui and add a new widget of `BECFigure` to the dock.
78
-
79
- ## Composing a larger GUI
80
- The example given above introduces BEC Widgets with its different components, and provides an overview of how to interact with the widgets. Nevertheless, another power aspect of BEC Widgets lies in the ability to compose a larger GUI with multiple docks and widgets. This section aims to provide a tutorial like guide on how to compose a more complex GUI that (A) live-plots a 1D waveform, (B) plots data from a camera, and (C) tracks the positions of two motors.
81
- Let's assume BEC was just started and the `gui` object is available in the client. A single dock is already attached together with a BEC Figure. Let's add the 1D waveform to this dock, change the color of the line to white and add the title *1D Waveform* to the plot.
82
-
83
- ```python
84
- plt = fig.plot(x_name='samx', y_name='bpm4i')
85
- plt.curves[0].set_color(color="white")
86
- plt.set_title('1D Waveform')
87
- ```
88
-
89
- Next, we add 2 new docks to the gui, one to plot the data of a camera and one to track the positions of two motors.
90
- ```ipython
91
- cam_widget= gui.add_dock(name="cam_dock").add_widget('BECFigure').image("eiger")
92
- motor_widget = gui.add_dock(name="mot_dock").add_widget('BECFigure').motor_map("samx", "samy")
93
- ```
94
- Note, we chain commands here which is possible since the `add_dock` and `add_widget` methods return the dock and the widget respectively. We can now further customize the widgets by changing the title, axis labels, etc.
95
-
96
- ```python
97
- cam_widget.set_title("Camera Image Eiger")
98
- cam_widget.set_vrange(vmin=0, vmax=100)
99
- ```
100
- As a final step, we can now add also a RingProgressBar to a new dock, and perform a grid_scan with the motors *samx* and *samy*.
101
- As you see in the example below, all docks are arranged below each other. This is the default behavior of the `add_dock` method. However, the docks can be freely arranged by drag and drop as desired by the user. We invite you to explore this by yourself following the example in the video, and build your custom GUI with BEC Widgets.
102
-
103
- ```python
104
- prog_bar = gui.add_dock(name="prog_dock").add_widget('RingProgressBar')
105
- prog_bar.set_line_widths(15)
106
- scans.grid_scan(dev.samy, -2, 2, 10, dev.samx, -5, 5, 10, exp_time=0.1, relative=False)
107
- ```
108
-
109
- ![gui_complex_gui](./gui_complex_gui.gif)
110
-
@@ -1,17 +0,0 @@
1
- (user.video_tutorials)=
2
-
3
- # Video Tutorials
4
-
5
- This section includes video tutorials that demonstrate various use cases of `bec-widgets`, including video tutorials,
6
- presentations, and conference talks.
7
-
8
- ## BSEG Meeting 24th July 2024
9
-
10
- This video is a presentation of the BEC Widgets project at the BSEG meeting on the 24th July 2024. The presentation
11
- covers the basic interactions, including visualization of live data acquisition and how to steer experiments using
12
- user-friendly tools. Learn how BEC Widgets can enhance your experimental control projects with its intuitive interface
13
- and powerful features.
14
-
15
- Used version of BEC Widgets: 0.91.0
16
-
17
- <iframe width="560" height="315" src="https://www.youtube.com/embed/qZ8fWXRAdHE" frameborder="0" allowfullscreen></iframe>
docs/user/user.md DELETED
@@ -1,71 +0,0 @@
1
- (user)=
2
- # User
3
- Welcome to the User section of the BEC Widgets documentation! BEC Widgets is a versatile GUI framework tailored for beamline scientists, enabling efficient and intuitive interaction with beamline experiments. This section is designed to guide both new and experienced users through the essential aspects of utilizing BEC Widgets.
4
-
5
- ```{toctree}
6
- ---
7
- maxdepth: 2
8
- hidden: true
9
- ---
10
-
11
- getting_started/getting_started.md
12
- applications/applications.md
13
- widgets/widgets.md
14
- api_reference/api_reference.md
15
- ```
16
-
17
-
18
- ***
19
-
20
- ````{grid} 2
21
- :gutter: 5
22
-
23
- ```{grid-item-card}
24
- :link: user.getting_started
25
- :link-type: ref
26
- :img-top: /assets/rocket_launch_48dp.svg
27
- :text-align: center
28
- :class-item: index-card
29
-
30
- ## Getting Started
31
-
32
- Learn how to install BEC Widgets and get started with the framework.
33
- ```
34
-
35
- ```{grid-item-card}
36
- :link: user.applications
37
- :link-type: ref
38
- :img-top: /assets/display_settings_48dp.svg
39
- :text-align: center
40
- :class-item: index-card
41
-
42
- ## Applications
43
-
44
- Learn how to use BEC Widgets Applications, to modify and create new applications.
45
-
46
- ```
47
-
48
- ```{grid-item-card}
49
- :link: user.widgets
50
- :link-type: ref
51
- :img-top: /assets/apps_48dp.svg
52
- :text-align: center
53
- :class-item: index-card
54
-
55
- ## Widgets
56
-
57
- Learn about the building blocks of larger applications: widgets.
58
- ```
59
-
60
- ```{grid-item-card}
61
- :link: user.api_reference
62
- :link-type: ref
63
- :img-top: /assets/index_api.svg
64
- :text-align: center
65
- :class-item: index-card
66
-
67
- ## API reference
68
-
69
- Comprehensive reference of all user-facing classes, functions, and methods.
70
- ```
71
- ````
Binary file
@@ -1,105 +0,0 @@
1
- (user.widgets.bec_figure)=
2
- # BECFigure
3
-
4
- ````{tab} Overview
5
-
6
- [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) is a robust framework that provides a fast, flexible plotting environment, similar to the Matplotlib figure. With BECFigure, users can dynamically change layouts, add or remove subplots, and customize their plotting environment in real-time. This flexibility makes BECFigure an ideal tool for both rapid prototyping and detailed data visualization.
7
-
8
- - **Dynamic Layout Management**: Easily add, remove, and rearrange subplots within `BECFigure`, enabling tailored visualization setups.
9
- - **Widget Integration**: Incorporate various specialized widgets like [`WaveformWidget`](user.widgets.waveform_widget), [`ImageWidget`](user.widgets.image_widget) , and [`MotorMapWidget`](user.widgets.motor_map) into `BECFigure`. Note that these widgets can also be used individually. For more details, please refer to the documentation for each individual widget.
10
- - **Interactive Controls**: Provides interactive tools for zooming, panning, and adjusting plots on the fly, streamlining the data exploration process.
11
-
12
- **Schema of the BECFigure components**
13
-
14
- ![BECFigure.png](BECFigure.png)
15
-
16
- ````
17
-
18
- ````{tab} Examples - CLI
19
- In the following examples, we will use `BECIPythonClient` with a predefined `BECDockArea` as the `gui` object. These tutorials focus on how to work with the `BECFigure` framework, such as changing layouts, adding new elements, and accessing them. For more detailed examples of each individual component, please refer to the example sections of each individual widget: [`WaveformWidget`](user.widgets.waveform_widget), [`MotorMapWidget`](user.widgets.motor_map), [`ImageWidget`](user.widgets.image_widget).
20
-
21
- ## Example 1 - Adding subplots to BECFigure
22
-
23
- In this example, we will demonstrate how to add different subplots to a single `BECFigure` widget.
24
-
25
- ```python
26
- # Add a new dock with BECFigure widget
27
- fig = gui.add_dock().add_widget('BECFigure')
28
-
29
- # Add a WaveformWidget to the BECFigure
30
- plt1 = fig.plot(x_name='samx', y_name='bpm4i')
31
-
32
- # Add a second WaveformWidget to the BECFigure, specifying new=True to add it as a new subplot
33
- plt2 = fig.plot(x_name='samx', y_name='bpm3i', new=True)
34
-
35
- # Add a MotorMapWidget to the BECFigure
36
- mm = fig.motor_map(motor_x='samx', motor_y='samy')
37
-
38
- # Add an ImageWidget to the BECFigure
39
- img = fig.image('eiger')
40
- ```
41
- ```{note}
42
- By default, the [`.plot`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot), [`.image`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.image), and [`.motor_map`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.motor_map) methods always find the first widget of that type in the layout and interact with it. If you want to add a new subplot of the same type, you must either specify the coordinates of the new subplot or use the `new=True` keyword argument, as shown above when adding the second WaveformWidget. Additionally, you can directly add a subplot to a specific, unoccupied position in the layout by specifying the `row` and `col` arguments, such as `fig.plot(x_name='samx', y_name='bpm4i', row=1, col=1)`.
43
- ```
44
-
45
- ## Example 2 - Changing the layout of BECFigure
46
-
47
- The previous example added four subplots into a single `BECFigure` widget. By default, new widgets are always added to the bottom of the BECFigure. However, you can change the layout of the BECFigure by using the [`change_layout`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.change_layout) method, specifying the number of rows and/or columns.
48
-
49
- ```python
50
- # Change the layout of the BECFigure to have 4 columns -> 4x1 matrix layout
51
- fig.change_layout(max_columns=4)
52
-
53
- # Change the layout of the BECFigure to have 2 rows -> 2x2 matrix layout
54
- fig.change_layout(max_rows=2)
55
- ```
56
-
57
- ## Example 3 - Accessing Subplots in BECFigure
58
-
59
- The subplots in BECFigure can be accessed in a similar way to Matplotlib figures using the [`axes`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.axes) property. Each subplot can be accessed by its index coordinates within the layout, specified by the row and column index (starting at 0). In following example, we will access the subplots and modify their titles. The layout is a 2x2 matrix, so the subplots are indexed as follows:
60
-
61
- ```python
62
- # Access the first subplot in the first row and first column (0, 0)
63
- subplot1 = fig.axes(0, 0)
64
-
65
- # Access the second subplot in the first row and second column (0, 1)
66
- subplot2 = fig.axes(0, 1)
67
-
68
- # Access the first subplot in the second row and first column (1, 0)
69
- subplot3 = fig.axes(1, 0)
70
-
71
- # Example: Set title for the first subplot
72
- subplot1.set_title("Waveform 1")
73
-
74
- # Example: Set title for the second subplot
75
- subplot2.set_title("Waveform 2")
76
-
77
- # Example: Set title for the third subplot
78
- subplot3.set_title("Motor Map")
79
- ```
80
-
81
- In this example, we accessed three different subplots based on their row and column positions and modified their titles.
82
-
83
- ## Example 4 - Removing Subplots from BECFigure
84
-
85
- You may want to remove certain subplots from the `BECFigure`. This can be done using the [`remove`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.remove) method, which takes the row and column index of the subplot you want to remove. The [`remove`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.remove) method could be also called on the subplot itself.
86
-
87
- ```python
88
-
89
- # Remove the subplot in the second row and second column (1, 1)
90
- fig.remove(1, 1)
91
-
92
- # Remove the subplot in the first row and first column (0, 0)
93
- fig.remove(0, 0)
94
-
95
- # Remove previously accessed subplot plt2 from Example 1
96
- plt2.remove()
97
- ```
98
-
99
- ````
100
-
101
- ````{tab} API
102
- ```{eval-rst}
103
- .. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst
104
- ```
105
- ````
@@ -1,38 +0,0 @@
1
- (user.widgets.bec_status_box)=
2
- # BEC Status Box
3
-
4
- ````{tab} Overview
5
-
6
- The [`BEC Status Box`](/api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox) widget is designed to monitor the status and health of all running BEC processes. This widget provides a real-time overview of the BEC core services, including DeviceServer, ScanServer, SciHub, ScanBundler, and FileWriter. The top-level display indicates the overall state of the BEC services, while the collapsed view allows users to delve into the status of each individual process. By double-clicking on a specific process, users can access a detailed popup window with live updates of the metrics for that process.
7
-
8
- ## Key Features:
9
- - **Comprehensive Service Monitoring**: Track the state of individual BEC services, including real-time updates on their health and status.
10
- - **Automatic Service Tracking**: Automatically detects and monitors additional clients connecting to the BEC services.
11
- - **Detailed Metrics**: Provides live updates of the metrics for each process, accessible through an interactive popup window.
12
-
13
- ![BECStatus](./bec_status_box.gif)
14
- ````
15
-
16
- ````{tab} Examples
17
-
18
- The `BECStatusBox` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. Below are examples demonstrating how to create and use the `BECStatusBox` widget.
19
-
20
- ## Example 1 - Adding BEC Status Box to BECDockArea
21
-
22
- In this example, we demonstrate how to add a `BECStatusBox` widget to a `BECDockArea`, allowing users to monitor the status of BEC processes directly from the GUI.
23
-
24
- ```python
25
- # Add a new dock with a BECStatusBox widget
26
- bec_status_box = gui.add_dock().add_widget("BECStatusBox")
27
- ```
28
-
29
- ```{hint}
30
- Once the `BECStatusBox` is added, users can interact with it to view the status of individual processes. By expanding the view, you can see the status of each BEC service in detail.
31
- ```
32
- ````
33
-
34
- ````{tab} API
35
- ```{eval-rst}
36
- .. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox.rst
37
- ```
38
- ````
@@ -1,90 +0,0 @@
1
- (user.widgets.buttons)=
2
-
3
- # Buttons
4
-
5
- `````{tab} Overview
6
-
7
- This section consolidates various custom buttons used within the BEC GUIs, providing essential controls for managing operations and processes. These buttons are designed for easy integration into different layouts within the BEC environment, allowing users to embed functional controls into their applications seamlessly.
8
-
9
- ## Stop Button
10
-
11
- The `Stop Button` is a specialized control that provides an immediate interface to halt ongoing operations in the BEC Client. It is essential for scenarios where operations need to be terminated quickly, such as in the case of an error or when an operation needs to be interrupted by the user.
12
-
13
- **Key Features:**
14
- - **Immediate Termination**: Instantly halts the execution of the current script or process.
15
- - **Queue Management**: Clears any pending operations in the scan queue, ensuring the system is reset and ready for new tasks.
16
-
17
- ## Dark Mode Button
18
-
19
- The `Dark Mode Button` is a toggle control that allows users to switch between light and dark themes in the BEC GUI. It provides a convenient way to adjust the interface's appearance based on user preferences or environmental conditions.
20
-
21
- ````{grid} 2
22
- :gutter: 2
23
-
24
- ```{grid-item-card} Dark Mode
25
- :img-top: ./dark_mode_enabled.png
26
- ```
27
-
28
- ```{grid-item-card} Light Mode
29
- :img-top: ./dark_mode_disabled.png
30
- ```
31
- ````
32
-
33
-
34
- **Key Features:**
35
- - **Theme Switching**: Enables users to switch between light and dark themes with a single click.
36
- - **Configurable from BECDesigner**: The defaults for the dark mode can be set in the BECDesigner, allowing users to customize the startup appearance of the GUI.
37
-
38
-
39
- ## Color Button
40
-
41
- The `Color Button` is a user interface element that provides a dialog to select colors. This button, adapted from `pyqtgraph`, is a simple yet powerful tool to integrate color selection functionality into the BEC GUIs.
42
-
43
- **Key Features:**
44
- - **Color Selection**: Opens a dialog for selecting colors, returning the selected color in both RGBA and HEX formats.
45
-
46
- ## Colormap Selector
47
-
48
- The `Colormap Selector` is a specialized combobox that allows users to select a colormap. It includes a preview of the colormap, making it easier for users to choose the appropriate one for their needs.
49
-
50
- **Key Features:**
51
- - **Colormap Selection**: Provides a dropdown to select from all available colormaps in `pyqtgraph`.
52
- - **Visual Preview**: Displays a small preview of the colormap next to its name, enhancing usability.
53
-
54
-
55
-
56
- `````
57
-
58
- ````{tab} Examples
59
-
60
- Integrating the `StopButton` into a BEC GUI layout is straightforward. The following example demonstrates how to embed a `StopButton` within a custom GUI layout using `QtWidgets`.
61
-
62
- ## Example 1 - Embedding a Stop Button in a Custom GUI Layout
63
-
64
- This example shows how to create a simple GUI layout with a `StopButton` integrated, allowing the user to halt processes directly from the interface.
65
-
66
- ```python
67
- from qtpy.QtWidgets import QWidget, QVBoxLayout
68
- from bec_widgets.widgets.buttons import StopButton
69
-
70
- class MyGui(QWidget):
71
- def __init__(self):
72
- super().__init__()
73
- self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
74
-
75
- # Create and add the StopButton to the layout
76
- self.stop_button = StopButton()
77
- self.layout().addWidget(self.stop_button)
78
-
79
- # Example of how this custom GUI might be used:
80
- my_gui = MyGui()
81
- my_gui.show()
82
- ```
83
- ````
84
-
85
- ````{tab} API
86
- ```{eval-rst}
87
- .. include:: /api_reference/_autosummary/bec_widgets.cli.client.StopButton.rst
88
- .. include:: /api_reference/_autosummary/bec_widgets.cli.client.DarkModeButton.rst
89
- ```
90
- ````
@@ -1,36 +0,0 @@
1
- (user.widgets.device_browser)=
2
-
3
- # Device Browser
4
-
5
- ````{tab} Overview
6
-
7
- The `Device Browser` widget provides a user-friendly interface for browsing through all available devices in the current BEC session. As it supports drag functionality, users can easily drag and drop device into other widgets or applications.
8
-
9
- ```{note}
10
- The `Device Browser` widget is currently under development. Other widgets may not support drag and drop functionality yet.
11
- ```
12
-
13
- ## Key Features:
14
- - **Device Search**: Allows users to search for devices using regular expressions.
15
- - **Drag and Drop**: Supports drag and drop functionality for easy transfer of devices to other widgets or applications.
16
-
17
- ```{figure} ./device_browser.png
18
- ```
19
- ````
20
-
21
- ````{tab} Examples
22
-
23
- In this example, we demonstrate how to add a `DeviceBrowser` widget to a `BECDockArea` to visualize the progress of a task.
24
-
25
- ```python
26
- # Add a new dock with a DeviceBrowser widget
27
- browser = gui.add_dock().add_widget("DeviceBrowser")
28
- ```
29
-
30
- ````
31
-
32
- ````{tab} API
33
- ```{eval-rst}
34
- .. include:: /api_reference/_autosummary/bec_widgets.cli.client.DeviceBrowser.rst
35
- ```
36
- ````