mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
docs: update docs for v2
This commit is contained in:
@ -23,7 +23,7 @@ In this example, we demonstrate how to add a `BECStatusBox` widget to a `BECDock
|
||||
|
||||
```python
|
||||
# Add a new dock with a BECStatusBox widget
|
||||
bec_status_box = gui.add_dock().add_widget("BECStatusBox")
|
||||
sb = gui.bec.new().new(widget=gui.available_widgets.BECStatusBox)
|
||||
```
|
||||
|
||||
```{hint}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Queue Control Buttons
|
||||
|
||||
`````{tab} Overview
|
||||
```{tab} Overview
|
||||
This section consolidates various buttons designed to manage the BEC scan queue, providing essential controls for operations like stopping, resuming, aborting, and resetting the scan queue.
|
||||
|
||||
## Stop Button
|
||||
@ -37,98 +37,41 @@ The `Reset Button` is used to reset the scan queue. It prompts the user for conf
|
||||
- **Queue Reset**: Resets the entire scan queue.
|
||||
- **Confirmation Dialog**: Prompts the user to confirm the reset action to prevent accidental resets.
|
||||
- **Toolbar and Button Options**: Can be configured as a toolbar button or a standard push button.
|
||||
`````
|
||||
```
|
||||
|
||||
````{tab} Examples
|
||||
`````{tab} Examples
|
||||
|
||||
Integrating these buttons into a BEC GUI layout is straightforward. The following examples demonstrate how to embed these buttons within a custom GUI layout using `QtWidgets`.
|
||||
|
||||
### Example 1 - Embedding a Stop Button in a Custom GUI Layout
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
||||
from bec_widgets.widgets.buttons import StopButton
|
||||
import sys
|
||||
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
||||
from bec_widgets.widgets.control.buttons.stop_button.stop_button import StopButton
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self))
|
||||
|
||||
self.setLayout(QVBoxLayout())
|
||||
# Create and add the StopButton to the layout
|
||||
self.stop_button = StopButton()
|
||||
self.layout().addWidget(self.stop_button)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
app = QApplication([])
|
||||
my_gui = MyGui()
|
||||
my_gui.show()
|
||||
app.exec_()
|
||||
```
|
||||
|
||||
### Example 2 - Embedding a Resume Button in a Custom GUI Layout
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
||||
from bec_widgets.widgets.buttons import ResumeButton
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
||||
|
||||
# Create and add the ResumeButton to the layout
|
||||
self.resume_button = ResumeButton()
|
||||
self.layout().addWidget(self.resume_button)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
my_gui = MyGui()
|
||||
my_gui.show()
|
||||
```
|
||||
|
||||
### Example 3 - Adding an Abort Button
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
||||
from bec_widgets.widgets.buttons import AbortButton
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self))
|
||||
|
||||
# Create and add the AbortButton to the layout
|
||||
self.abort_button = AbortButton()
|
||||
self.layout().addWidget(self.abort_button)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
my_gui = MyGui()
|
||||
my_gui.show()
|
||||
```
|
||||
|
||||
### Example 4 - Adding a Reset Queue Button
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
||||
from bec_widgets.widgets.buttons import ResetButton
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self))
|
||||
|
||||
# Create and add the ResetButton to the layout
|
||||
self.reset_button = ResetButton()
|
||||
self.layout().addWidget(self.reset_button)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
my_gui = MyGui()
|
||||
my_gui.show()
|
||||
```
|
||||
````
|
||||
`ResumeButton`, `ResetButton`, and `AbortButton` may be used in an exactly analogous way.
|
||||
|
||||
````{tab} API
|
||||
```{eval-rst}
|
||||
```{eval-rst}
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.StopButton.rst
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.ResumeButton.rst
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.AbortButton.rst
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.ResetButton.rst
|
||||
```
|
||||
````
|
||||
`````
|
||||
|
BIN
docs/user/widgets/image/image.gif
Normal file
BIN
docs/user/widgets/image/image.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 MiB |
Binary file not shown.
Before Width: | Height: | Size: 13 MiB |
@ -1,30 +1,21 @@
|
||||
(user.widgets.image_widget)=
|
||||
|
||||
# Image Widget
|
||||
# Image widget
|
||||
|
||||
````{tab} Overview
|
||||
|
||||
The Image Widget is a versatile tool designed for visualizing both 1D and 2D data, such as camera images or waveform data, in real-time. Directly integrated with the `BEC` framework, it can display live data streams from connected detectors or other data sources within the current `BEC` session. The widget provides advanced customization options for color maps and scale bars, allowing users to tailor the visualization to their specific needs.
|
||||
The Image widget is a versatile tool designed for visualizing both 1D and 2D data, such as camera images or waveform data, in real-time. Directly integrated with the `BEC` framework, it can display live data streams from connected detectors or other data sources within the current `BEC` session. The widget provides advanced customization options for color maps and scale bars, allowing users to tailor the visualization to their specific needs.
|
||||
|
||||
## Key Features:
|
||||
- **Flexible Integration**: The widget can be integrated into [`BECDockArea`](user.widgets.bec_dock_area), or used as an individual component in your application through `BECDesigner`.
|
||||
- **Live Data Visualization**: Real-time plotting of both 1D and 2D data from detectors or other data sources, provided that a data stream is available in the BEC session.
|
||||
- **Support for Multiple Monitor Types**: The Image Widget supports different monitor types (`'1d'` and `'2d'`), allowing visualization of various data dimensions.
|
||||
- **Support for Multiple Monitor Types**: The Image widget supports different monitor types (`'1d'` and `'2d'`), allowing visualization of various data dimensions. It can automatically determine the best way to visualise the data based on the shape of the data source.
|
||||
- **Customizable Color Maps and Scale Bars**: Users can customize the appearance of images with various color maps and adjust scale bars to better interpret the visualized data.
|
||||
- **Real-time Image Processing**: Apply real-time image processing techniques directly within the widget to enhance the quality or analyze specific aspects of the data, such as rotation, logarithmic scaling, and Fast Fourier Transform (FFT).
|
||||
- **Data Export**: Export visualized data to various formats such as PNG, TIFF, or H5 for further analysis or reporting.
|
||||
- **Interactive Controls**: Offers interactive controls for zooming, panning, and adjusting the visual properties of the images on the fly.
|
||||
|
||||
## Monitor Types
|
||||
|
||||
The Image Widget can handle different types of data, specified by the `monitor_type` parameter:
|
||||
|
||||
- **1D Monitor (`monitor_type='1d'`)**: Used for visualizing 1D waveform data. The widget collects incoming 1D data arrays and constructs a 2D image by stacking them, adjusting for varying lengths if necessary.
|
||||
- **2D Monitor (`monitor_type='2d'`)**: Used for visualizing 2D image data directly from detectors like cameras.
|
||||
|
||||
By specifying the appropriate `monitor_type`, you can configure the Image Widget to handle data from different detectors and sources.
|
||||
|
||||

|
||||

|
||||
````
|
||||
|
||||
````{tab} Examples - CLI
|
||||
@ -47,7 +38,7 @@ img_widget.title = "Camera Image - Eiger Detector"
|
||||
|
||||
## Example 2 - Visualizing 1D Waveform Data from a Detector
|
||||
|
||||
This example demonstrates how to set up the Image Widget to visualize 1D waveform data from a detector, such as a line detector or a spectrometer. The widget will stack incoming 1D data arrays to construct a 2D image.
|
||||
This example demonstrates how to set up the Image widget to visualize 1D waveform data from a detector, such as a line detector or a spectrometer. The widget will stack incoming 1D data arrays to construct a 2D image.
|
||||
|
||||
```python
|
||||
# Add a new dock with BECFigure widget
|
||||
@ -65,7 +56,7 @@ img_widget.vrange= [0, 100]
|
||||
|
||||
## Example 3 - Real-time Image Processing
|
||||
|
||||
The `ImageWidget` provides real-time image processing capabilities, such as rotating, scaling, applying logarithmic scaling, and performing FFT on the displayed images. The following example demonstrates how to apply these transformations to an image.
|
||||
The `Image` provides real-time image processing capabilities, such as rotating, scaling, applying logarithmic scaling, and performing FFT on the displayed images. The following example demonstrates how to apply these transformations to an image.
|
||||
|
||||
```python
|
||||
# Rotate the image by 90 degrees (1,2,3,4 are multiplied by 90 degrees)
|
||||
|
@ -7,7 +7,7 @@
|
||||
The Motor Map Widget is a specialized tool for tracking and visualizing the positions of motors in real-time. This widget is crucial for applications requiring precise alignment and movement tracking during scans. It provides an intuitive way to monitor motor trajectories, ensuring accurate positioning throughout the scanning process.
|
||||
|
||||
## Key Features:
|
||||
- **Flexible Integration**: The widget can be integrated into [`BECDockArea`](user.widgets.bec_dock_area), or used as an individual component in your application through `BECDesigner`.
|
||||
- **Flexible Integration**: The widget can be integrated into a [`BECDockArea`](user.widgets.bec_dock_area), or used as an individual component in your application through `BECDesigner`.
|
||||
- **Real-time Motor Position Visualization**: Tracks motor positions in real-time and visually represents motor trajectories.
|
||||
- **Customizable Visual Elements**: The appearance of all widget components is fully customizable, including scatter size and background values.
|
||||
- **Interactive Controls**: Interactive controls for zooming, panning, and adjusting the visual properties of motor trajectories on the fly.
|
||||
|
@ -38,16 +38,15 @@ Note, not specifying signal_filter will include all signals.
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
||||
from bec_widgets.widgets.signal_line_edit.signal_line_edit import SignalLineEdit
|
||||
from bec_widgets.widgets.base_classes.device_signal_input_base import BECSignalFilter
|
||||
from bec_widgets.widgets.control.device_input.signal_line_edit.signal_line_edit import SignalLineEdit
|
||||
from ophyd import Kind
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
||||
|
||||
# Create and add the DeviceLineEdit to the layout
|
||||
self.signal_line_edit = SignalLineEdit(device="samx", signal_filter=[BECSignalFilter.NORMAL, BECSignalFilter.HINTED])
|
||||
# Create and add the SignalLineEdit to the layout
|
||||
self.signal_line_edit = SignalLineEdit(device="samx", signal_filter=[Kind.normal, Kind.hinted])
|
||||
self.layout().addWidget(self.signal_line_edit)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
@ -57,28 +56,27 @@ my_gui.show()
|
||||
app.exec_()
|
||||
```
|
||||
|
||||
## Example 2 - Creating a DeviceComboBox in Code
|
||||
## Example 2 - Creating a SignalComboBox in Code
|
||||
|
||||
Similarly, here is an example of creating a `DeviceComboBox` widget in code and customizing its behavior.
|
||||
A
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
||||
from bec_widgets.widgets.signal_combobox.signal_combobox import SignalComboBox
|
||||
from bec_widgets.widgets.base_classes.device_signal_input_base import BECSignalFilter
|
||||
from bec_widgets.widgets.control.device_input.signal_combobox.signal_combobox import SignalComboBox
|
||||
from ophyd import Kind
|
||||
|
||||
class MyGui(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
||||
|
||||
# Create and add the DeviceLineEdit to the layout
|
||||
self.signal_combobox = SignalComboBox(device="samx", signal_filter=[BECSignalFilter.NORMAL, BECSignalFilter.HINTED])
|
||||
# Create and add the SignalComboBox to the layout
|
||||
self.signal_combobox = SignalComboBox(device="samx", signal_filter=[Kind.normal, Kind.hinted])
|
||||
self.layout().addWidget(self.signal_combobox)
|
||||
|
||||
# Example of how this custom GUI might be used:
|
||||
app = QApplication([])
|
||||
my_gui = MyGui()
|
||||
my_gui.show()
|
||||
my_gui.show()
|
||||
app.exec_()
|
||||
```
|
||||
|
||||
@ -108,12 +106,12 @@ The following Qt properties are also included:
|
||||
|
||||
````{tab} API - ComboBox
|
||||
```{eval-rst}
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.SignalComboBox.rst
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.control.device_input.signal_combobox.SignalComboBox.rst
|
||||
```
|
||||
````
|
||||
|
||||
````{tab} API - LineEdit
|
||||
```{eval-rst}
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.SignalLineEdit.rst
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.control.device_input.signal_line_edit.SignalLineEdit.rst
|
||||
```
|
||||
````
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
````{tab} Overview
|
||||
|
||||
The [`SpinnerWidget`](/api_reference/_autosummary/bec_widgets.cli.client.SpinnerWidget) is a simple and versatile widget designed to indicate loading or movement within an application. It is commonly used to show that a device is in motion or that an operation is ongoing. The `SpinnerWidget` can be easily integrated into your GUI application either through direct code instantiation or by using `QtDesigner`.
|
||||
The [`SpinnerWidget`](/api_reference/_autosummary/bec_widgets.utility.spinner.spinner.SpinnerWidget) is a simple and versatile widget designed to indicate loading or movement within an application. It is commonly used to show that a device is in motion or that an operation is ongoing. The `SpinnerWidget` can be easily integrated into your GUI application either through direct code instantiation or by using `QtDesigner`.
|
||||
|
||||
## Key Features:
|
||||
- **Loading Indicator**: Provides a visual indication of ongoing operations or device movement.
|
||||
@ -24,7 +24,7 @@ In this example, we demonstrate how to create a `SpinnerWidget` in code and star
|
||||
|
||||
```python
|
||||
from qtpy.QtWidgets import QApplication, QMainWindow
|
||||
from bec_widgets.widgets.spinner_widget import SpinnerWidget
|
||||
from bec_widgets.widgets.utility.spinner.spinner import SpinnerWidget
|
||||
|
||||
app = QApplication([])
|
||||
|
||||
@ -55,7 +55,7 @@ spinner.stop()
|
||||
|
||||
## Example 3 - Integrating the Spinner Widget in QtDesigner
|
||||
|
||||
The `SpinnerWidget` can be added to your GUI layout using `QtDesigner`. Once added, you can control the spinner using the `start` and `stop` methods, similar to the code examples above.
|
||||
The `SpinnerWidget` can be added to your GUI layout using `QtDesigner`. Once added, you can assign the spinner to an attribute of your application, and then control the spinner using the `start` and `stop` methods, similar to the code examples above.
|
||||
|
||||
```python
|
||||
# Example: Start the spinner in a QtDesigner-based application
|
||||
|
@ -11,7 +11,7 @@ The [`Text Box Widget`](/api_reference/_autosummary/bec_widgets.cli.client.TextB
|
||||
- **Automatic styling**: The widget automatically adheres to BEC's style guides. No need to worry about background colors, font sizes, or other appearance settings.
|
||||
|
||||
## BEC Designer Properties
|
||||
```{figure} ../../assets/widget_screenshots/text_box_properties.png
|
||||
```{figure} ../../../assets/widget_screenshots/text_box_properties.png
|
||||
```
|
||||
|
||||
````
|
||||
@ -26,7 +26,7 @@ In this example, we demonstrate how to add a `TextBox` widget to a `BECDockArea`
|
||||
|
||||
```python
|
||||
# Add a new dock with a TextBox widget
|
||||
text_box = gui.add_dock().add_widget("TextBox")
|
||||
text_box = gui.bec.new().new(widget=gui.available_widgets.TextBox)
|
||||
|
||||
# Set the text to display
|
||||
text_box.set_plain_text("Hello, World!")
|
||||
|
@ -45,7 +45,7 @@ Display 1D detector signals.
|
||||
Display multiple 1D waveforms.
|
||||
```
|
||||
|
||||
```{grid-item-card} Image Widget
|
||||
```{grid-item-card} Image widget
|
||||
:link: user.widgets.image_widget
|
||||
:link-type: ref
|
||||
:img-top: /assets/widget_screenshots/image_widget.png
|
||||
@ -238,6 +238,14 @@ Display DAP summaries of LMFit models in a window.
|
||||
|
||||
Select DAP model from a list of DAP processes.
|
||||
```
|
||||
|
||||
```{grid-item-card} Log panel widget
|
||||
:link: user.widgets.log_panel
|
||||
:link-type: ref
|
||||
:img-top: /user/widgets/log_panel/logpanel.png
|
||||
|
||||
Show and filter logs from the BEC Redis server.
|
||||
```
|
||||
````
|
||||
|
||||
```{toctree}
|
||||
@ -247,7 +255,6 @@ hidden: true
|
||||
---
|
||||
|
||||
dock_area/bec_dock_area.md
|
||||
bec_figure/bec_figure.md
|
||||
waveform/waveform_widget.md
|
||||
multi_waveform/multi_waveform.md
|
||||
image/image_widget.md
|
||||
@ -272,5 +279,6 @@ position_indicator/position_indicator.md
|
||||
lmfit_dialog/lmfit_dialog.md
|
||||
dap_combo_box/dap_combo_box.md
|
||||
games/games.md
|
||||
log_panel/log_panel.md
|
||||
|
||||
```
|
Reference in New Issue
Block a user