0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

docs(buttons): buttons section of docs split to appearance and queue buttons

This commit is contained in:
2024-09-02 15:58:08 +02:00
committed by wyzula_j
parent 9dd43aa1fd
commit 047aa26a60
8 changed files with 199 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -1,18 +1,9 @@
(user.widgets.buttons)= (user.widgets.buttons_appearance)=
# Buttons # Appearance Buttons
`````{tab} Overview `````{tab} Overview
This section consolidates various buttons designed to manage the appearance of the BEC GUI, allowing users to easily switch themes, select colors, and choose colormaps.
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.
## Stop Button
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.
**Key Features:**
- **Immediate Termination**: Instantly halts the execution of the current script or process.
- **Queue Management**: Clears any pending operations in the scan queue, ensuring the system is reset and ready for new tasks.
## Dark Mode Button ## Dark Mode Button
@ -30,12 +21,10 @@ The `Dark Mode Button` is a toggle control that allows users to switch between l
``` ```
```` ````
**Key Features:** **Key Features:**
- **Theme Switching**: Enables users to switch between light and dark themes with a single click. - **Theme Switching**: Enables users to switch between light and dark themes with a single click.
- **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. - **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.
## Color Button ## Color Button
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. 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.
@ -50,31 +39,66 @@ The `Colormap Selector` is a specialized combobox that allows users to select a
**Key Features:** **Key Features:**
- **Colormap Selection**: Provides a dropdown to select from all available colormaps in `pyqtgraph`. - **Colormap Selection**: Provides a dropdown to select from all available colormaps in `pyqtgraph`.
- **Visual Preview**: Displays a small preview of the colormap next to its name, enhancing usability. - **Visual Preview**: Displays a small preview of the colormap next to its name, enhancing usability.
````` `````
````{tab} Examples ````{tab} Examples
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`. 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 ## Example 1 - Adding a Dark Mode Button
This example shows how to create a simple GUI layout with a `StopButton` integrated, allowing the user to halt processes directly from the interface.
```python ```python
from qtpy.QtWidgets import QWidget, QVBoxLayout from qtpy.QtWidgets import QWidget, QVBoxLayout
from bec_widgets.widgets.buttons import StopButton from bec_widgets.widgets.buttons import DarkModeButton
class MyGui(QWidget): class MyGui(QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget self.setLayout(QVBoxLayout(self))
# Create and add the StopButton to the layout # Create and add the DarkModeButton to the layout
self.stop_button = StopButton() self.dark_mode_button = DarkModeButton()
self.layout().addWidget(self.stop_button) self.layout().addWidget(self.dark_mode_button)
# Example of how this custom GUI might be used:
my_gui = MyGui()
my_gui.show()
```
## Example 2 - Adding a Color Button
```python
from qtpy.QtWidgets import QWidget, QVBoxLayout
from bec_widgets.widgets.buttons import ColorButton
class MyGui(QWidget):
def __init__(self):
super().__init__()
self.setLayout(QVBoxLayout(self))
# Create and add the ColorButton to the layout
self.color_button = ColorButton()
self.layout().addWidget(self.color_button)
# Example of how this custom GUI might be used:
my_gui = MyGui()
my_gui.show()
```
## Example 3 - Adding a Colormap Selector
```python
from qtpy.QtWidgets import QWidget, QVBoxLayout
from bec_widgets.widgets.buttons import ColormapSelector
class MyGui(QWidget):
def __init__(self):
super().__init__()
self.setLayout(QVBoxLayout(self))
# Create and add the ColormapSelector to the layout
self.colormap_selector = ColormapSelector()
self.layout().addWidget(self.colormap_selector)
# Example of how this custom GUI might be used: # Example of how this custom GUI might be used:
my_gui = MyGui() my_gui = MyGui()
@ -84,7 +108,8 @@ my_gui.show()
````{tab} API ````{tab} API
```{eval-rst} ```{eval-rst}
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.StopButton.rst
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.DarkModeButton.rst .. include:: /api_reference/_autosummary/bec_widgets.cli.client.DarkModeButton.rst
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.ColorButton.rst
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.ColormapSelector.rst
``` ```
```` ````

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,134 @@
(user.widgets.buttons_queue)=
# Queue Control Buttons
`````{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
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.
**Key Features:**
- **Immediate Termination**: Instantly halts the execution of the current script or process.
- **Queue Management**: Stops the current scan or the entire scan queue.
## Resume Button
The `Resume Button` allows users to continue the paused scan queue. Its useful in scenarios where the scan queue has been halted and needs to be resumed.
**Key Features:**
- **Queue Continuation**: Resumes the scan queue after a pause.
- **Toolbar and Button Options**: Can be configured as a toolbar button or a standard push button.
## Abort Button
The `Abort Button` provides an interface to abort a specific scan or the entire queue. This is useful for scenarios where an operation needs to be terminated but in a controlled manner.
**Key Features:**
- **Scan Abortion**: Aborts the current scan or a specific scan in the queue.
- **Toolbar and Button Options**: Can be configured as a toolbar button or a standard push button.
## Reset Queue Button
The `Reset Button` is used to reset the scan queue. It prompts the user for confirmation before resetting, ensuring that the action is intentional.
**Key Features:**
- **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
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
class MyGui(QWidget):
def __init__(self):
super().__init__()
self.setLayout(QVBoxLayout(self))
# 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:
my_gui = MyGui()
my_gui.show()
```
### 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()
```
````
````{tab} API
```{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
```
````

View File

@ -135,12 +135,20 @@ Various utility widgets to enhance user experience.
````{grid} 3 ````{grid} 3
:gutter: 2 :gutter: 2
```{grid-item-card} Buttons ```{grid-item-card} Buttons Appearance
:link: user.widgets.buttons :link: user.widgets.buttons_appearance
:link-type: ref :link-type: ref
:img-top: /assets/widget_screenshots/buttons.png :img-top: /assets/widget_screenshots/buttons.png
Various service buttons. Various buttons which manage the appearance of the BEC GUI.
```
```{grid-item-card} Buttons Queue
:link: user.widgets.buttons_queue
:link-type: ref
:img-top: /assets/widget_screenshots/buttons_queue.png
Various buttons which manage the control of the BEC Queue.
``` ```
```{grid-item-card} Device Input Widgets ```{grid-item-card} Device Input Widgets
@ -215,7 +223,8 @@ scan_control/scan_control.md
progress_bar/ring_progress_bar.md progress_bar/ring_progress_bar.md
bec_status_box/bec_status_box.md bec_status_box/bec_status_box.md
queue/queue.md queue/queue.md
buttons/buttons.md buttons_appearance/buttons_appearance.md
buttons_queue/buttons_queue.md
device_browser/device_browser.md device_browser/device_browser.md
positioner_box/positioner_box.md positioner_box/positioner_box.md
text_box/text_box.md text_box/text_box.md