mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 19:21:50 +02:00
docs(progressbar): added docs
This commit is contained in:
@ -1698,19 +1698,28 @@ class BECProgressBar(RPCBase):
|
||||
@rpc_call
|
||||
def set_value(self, value):
|
||||
"""
|
||||
Smoothly transition the progress bar to the new value.
|
||||
Set the value of the progress bar.
|
||||
|
||||
Args:
|
||||
value (float): The value to set.
|
||||
"""
|
||||
|
||||
@rpc_call
|
||||
def set_maximum(self, maximum: float):
|
||||
"""
|
||||
Set the maximum value of the progress bar.
|
||||
|
||||
Args:
|
||||
maximum (float): The maximum value.
|
||||
"""
|
||||
|
||||
@rpc_call
|
||||
def set_minimum(self, minimum: float):
|
||||
"""
|
||||
None
|
||||
Set the minimum value of the progress bar.
|
||||
|
||||
Args:
|
||||
minimum (float): The minimum value.
|
||||
"""
|
||||
|
||||
@property
|
||||
|
@ -107,7 +107,12 @@ class BECProgressBar(BECWidget, QWidget):
|
||||
@Slot(float)
|
||||
@Slot(int)
|
||||
def set_value(self, value):
|
||||
"""Smoothly transition the progress bar to the new value."""
|
||||
"""
|
||||
Set the value of the progress bar.
|
||||
|
||||
Args:
|
||||
value (float): The value to set.
|
||||
"""
|
||||
if value > self._user_maximum:
|
||||
value = self._user_maximum
|
||||
elif value < self._user_minimum:
|
||||
@ -201,6 +206,9 @@ class BECProgressBar(BECWidget, QWidget):
|
||||
def set_maximum(self, maximum: float):
|
||||
"""
|
||||
Set the maximum value of the progress bar.
|
||||
|
||||
Args:
|
||||
maximum (float): The maximum value.
|
||||
"""
|
||||
self._user_maximum = maximum
|
||||
self.set_value(self._user_value) # Update the value to fit the new range
|
||||
@ -208,6 +216,12 @@ class BECProgressBar(BECWidget, QWidget):
|
||||
|
||||
@Slot(float)
|
||||
def set_minimum(self, minimum: float):
|
||||
"""
|
||||
Set the minimum value of the progress bar.
|
||||
|
||||
Args:
|
||||
minimum (float): The minimum value.
|
||||
"""
|
||||
self._user_minimum = minimum
|
||||
self.set_value(self._user_value) # Update the value to fit the new range
|
||||
self.update()
|
||||
@ -220,12 +234,6 @@ class BECProgressBar(BECWidget, QWidget):
|
||||
(value - self._user_minimum) / (self._user_maximum - self._user_minimum) * self._maximum
|
||||
)
|
||||
|
||||
def sizeHint(self):
|
||||
return self.minimumSizeHint()
|
||||
|
||||
def minimumSizeHint(self):
|
||||
return self.size()
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
app = QApplication(sys.argv)
|
||||
|
BIN
docs/assets/widget_screenshots/bec_progressbar.png
Normal file
BIN
docs/assets/widget_screenshots/bec_progressbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
39
docs/user/widgets/bec_progressbar/bec_progressbar.md
Normal file
39
docs/user/widgets/bec_progressbar/bec_progressbar.md
Normal file
@ -0,0 +1,39 @@
|
||||
(user.widgets.bec_progressbar)=
|
||||
# BEC Progressbar
|
||||
|
||||
```{tab} Overview
|
||||
|
||||
The BEC Progressbar widget is a general purpose progress bar that follows the BEC theme and style. It can be embedded in any application to display the progress of a task or operation.
|
||||
|
||||
## Key Features:
|
||||
- **Modern Design**: The BEC Progressbar widget is designed with a modern and sleek appearance, following the BEC theme.
|
||||
- **Customizable**: Users can customize the appearance and behavior of the progress bar to suit their application.
|
||||
- **Responsive**: The progress bar updates in real-time to reflect the progress of the task or operation.
|
||||
|
||||
## Screenshot
|
||||

|
||||

|
||||
|
||||
```
|
||||
|
||||
````{tab} Examples
|
||||
|
||||
The `BECProgressBar` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `BECDesigner`. Below are examples demonstrating how to create and use the `BECProgressBar` widget.
|
||||
|
||||
## Example 1 - Adding BEC Status Box to BECDockArea
|
||||
|
||||
In this example, we demonstrate how to add a `BECProgressBar` widget to a `BECDockArea`, allowing users to manually set and update the progress states.
|
||||
|
||||
```python
|
||||
# Add a new dock with a BECStatusBox widget
|
||||
pb = gui.add_dock().add_widget("BECProgressBar")
|
||||
pb.set_value(50)
|
||||
```
|
||||
|
||||
````
|
||||
|
||||
````{tab} API
|
||||
```{eval-rst}
|
||||
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECProgressbar.rst
|
||||
```
|
||||
````
|
BIN
docs/user/widgets/bec_progressbar/bec_progressbar_completed.png
Normal file
BIN
docs/user/widgets/bec_progressbar/bec_progressbar_completed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
docs/user/widgets/bec_progressbar/bec_progressbar_running.png
Normal file
BIN
docs/user/widgets/bec_progressbar/bec_progressbar_running.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -15,7 +15,7 @@ The [`BEC Status Box`](/api_reference/_autosummary/bec_widgets.cli.client.BECSta
|
||||
|
||||
````{tab} Examples
|
||||
|
||||
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.
|
||||
The `BECStatusBox` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `BECDesigner`. Below are examples demonstrating how to create and use the `BECStatusBox` widget.
|
||||
|
||||
## Example 1 - Adding BEC Status Box to BECDockArea
|
||||
|
||||
|
@ -191,6 +191,14 @@ Angular like toggle switch.
|
||||
Display spinner widget for loading or device movement.
|
||||
```
|
||||
|
||||
```{grid-item-card} BEC Progressbar
|
||||
:link: user.widgets.bec_progressbar
|
||||
:link-type: ref
|
||||
:img-top: /assets/widget_screenshots/bec_progressbar.png
|
||||
|
||||
Modern progress bar for BEC.
|
||||
```
|
||||
|
||||
```{grid-item-card} Position Indicator
|
||||
:link: user.widgets.position_indicator
|
||||
:link-type: ref
|
||||
@ -239,6 +247,7 @@ text_box/text_box.md
|
||||
website/website.md
|
||||
toggle/toggle.md
|
||||
spinner/spinner.md
|
||||
bec_progressbar/bec_progressbar.md
|
||||
device_input/device_input.md
|
||||
position_indicator/position_indicator.md
|
||||
lmfit_dialog/lmfit_dialog.md
|
||||
|
Reference in New Issue
Block a user