0
0
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:
2025-04-25 20:08:21 +02:00
parent 2f0d213e32
commit 25bd905cef
14 changed files with 75 additions and 115 deletions

View File

@ -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
```
````
`````