mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
docs: update docs for various widgets
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 322 KiB |
@ -9,7 +9,7 @@
|
||||
- **Flexible Dock Management**: Easily add, remove, and rearrange docks within `BECDockArea`, providing a customized layout for different tasks.
|
||||
- **State Persistence**: Save and restore the state of the dock area, enabling consistent user experiences across sessions.
|
||||
- **Dock Customization**: Add docks with customizable positions, names, and behaviors, such as floating or closable docks.
|
||||
- **Integration with Widgets**: Integrate various widgets like [`WaveformWidget`](user.widgets.waveform_widget), [`ImageWidget`](user.widgets.image_widget), and [`MotorMapWidget`](user.widgets.motor_map) into `BECDockArea`, either as standalone tools or as part of a more complex interface.
|
||||
- **Integration with Widgets**: Integrate various widgets like [`WaveformWidget`](user.widgets.waveform_widget), [`ImageWidget`](user.widgets.image_widget), and [`MotorMapWidget`](user.widgets.motor_map) into [`BECDockArea`](/api_reference/_autosummary/bec_widgets.cli.client.BECDockArea), either as standalone tools or as part of a more complex interface.
|
||||
|
||||
**BEC Dock Area Components Schema**
|
||||
|
||||
@ -24,14 +24,18 @@ In the following examples, we will use `BECIPythonClient` as the main object to
|
||||
In this example, we will demonstrate how to add different docks to a single `BECDockArea` widget. New docks are always added to the bottom of the dock area by default; however, you can specify the position of the dock by using the `position` and `relative_to` arguments.
|
||||
|
||||
```python
|
||||
# Add a new dock with a WaveformWidget to the BECDockArea
|
||||
dock1 = gui.add_dock(name="Waveform Dock", widget="BECWaveformWidget")
|
||||
# Create a new dock_area from GUI object
|
||||
dock_area = gui.new()
|
||||
|
||||
# Add a new dock with a Waveform to the BECDockArea
|
||||
dock_area.new(name="waveform_dock", widget="Waveform")
|
||||
dock1 = dock_area.waveform_dock # dynamic namespace was created
|
||||
|
||||
# Add a second dock with a MotorMapWidget to the BECDockArea to the right of the first dock
|
||||
dock2 = gui.add_dock(name="Motor Map Dock", widget="BECMotorMapWidget",relative_to="Waveform Dock", position="right")
|
||||
dock2 = dock_area.new(name="motor_dock", widget="MotorMap",relative_to="Waveform Dock", position="right")
|
||||
|
||||
# Add a third dock with an ImageWidget to the BECDockArea, placing it on bottom of the dock area
|
||||
dock3 = gui.add_dock(name="Image Dock", widget="BECImageWidget")
|
||||
dock3 = dock_area.new(name="image_dock", widget="Image")
|
||||
```
|
||||
|
||||
```{hint}
|
||||
@ -44,18 +48,26 @@ Docks can be accessed by their name or by the dock object. The dock object can b
|
||||
|
||||
```python
|
||||
# All docks can be accessed by their name from the panels dictionary
|
||||
gui.panels
|
||||
dock_area.panels
|
||||
|
||||
# Output
|
||||
{'Waveform Dock': <BECDock object at 0x168b983d0>,
|
||||
'Motor Map Dock': <BECDock object at 0x13a969250>,
|
||||
'Image Dock': <BECDock object at 0x13f267950>}
|
||||
|
||||
# Access the dock by its name
|
||||
dock1 = gui.panels["Waveform Dock"]
|
||||
{'waveform_dock': <BECDock with name: waveform_dock>,
|
||||
'motor_dock': <BECDock with name: motor_dock>,
|
||||
'image_dock': <BECDock with name: image_dock>}
|
||||
# Access all docks from the dock area via list
|
||||
dock_area.panel_list
|
||||
|
||||
# Access the widget object of the dock
|
||||
waveform_widget = dock1.widget_list[0]
|
||||
# Access through dynamic namespace mapping
|
||||
dock_area.waveform_dock
|
||||
dock_area.motor_dock
|
||||
dock_area.image_dock
|
||||
|
||||
# If objects were closed, we will keep a refernce that will indicate that the dock was deleted
|
||||
# Try closing the window with the dock_area via mouse click on x
|
||||
|
||||
dock_area
|
||||
# Output
|
||||
<Deleted widget with gui_id BECDockArea_2025_04_24_14_28_11_742887>
|
||||
```
|
||||
|
||||
## Example 3 - Detaching and Attaching Docks in BECDockArea
|
||||
@ -64,11 +76,10 @@ Docks in `BECDockArea` can be detached (floated) or reattached to the main dock
|
||||
|
||||
```python
|
||||
# Detach the dock named "Waveform Dock"
|
||||
gui.detach_dock(dock_name="Waveform Dock")
|
||||
|
||||
# Docks can be also detached by the dock object
|
||||
dock2.detach()
|
||||
dock3.detach()
|
||||
dock_area.detach_dock("waveform_dock")
|
||||
# Alternatively, you can use the dock object to detach the dock
|
||||
dock1 = dock_area.waveform_dock
|
||||
dock1.detach()
|
||||
|
||||
# Docks can be individually reattached to the main dock area
|
||||
dock2.attach()
|
||||
@ -87,13 +98,13 @@ Docks can be removed from the dock area by their name or by the dock object. The
|
||||
|
||||
```python
|
||||
# Removing docks by their name
|
||||
gui.remove_dock(dock_name="Waveform Dock")
|
||||
|
||||
# Removing docks by the dock object
|
||||
dock2.remove()
|
||||
dock_area.delete("waveform_dock")
|
||||
# Alternatively, you can use the dock object to remove the dock
|
||||
dock1 = dock_area.motor_dock
|
||||
dock1.remove()
|
||||
|
||||
# Removing all docks from the dock area
|
||||
gui.clear_all()
|
||||
gui.delete_all()
|
||||
```
|
||||
|
||||
```{warning}
|
||||
|
Reference in New Issue
Block a user