0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

docs(user): widget gallery with documentation added

This commit is contained in:
2024-08-14 10:16:03 +02:00
committed by wyzula_j
parent e9ecd268c6
commit 7357f3d2a1
52 changed files with 1502 additions and 367 deletions

View File

@ -0,0 +1,69 @@
(user.widgets.website)=
# Website Widget
````{tab} Overview
The [`Website Widget`](/api_reference/_autosummary/bec_widgets.cli.client.WebsiteWidget) is a versatile tool that allows users to display websites directly within the BEC GUI. This widget is useful for embedding documentation, dashboards, or any web-based tools within the application interface. It is designed to be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`.
## Key Features:
- **URL Display**: Set and display any website URL within the widget.
- **Navigation Controls**: Navigate through the websites history with back and forward controls.
- **Reload Functionality**: Reload the currently displayed website to ensure up-to-date content.
````
````{tab} Examples - CLI
The `WebsiteWidget` can be embedded within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. The following examples demonstrate how to create and use the `WebsiteWidget` in different scenarios.
## Example 1 - Adding Website Widget to BECDockArea
In this example, we demonstrate how to add a `WebsiteWidget` to a `BECDockArea` and set the URL of the website to be displayed.
```python
# Add a new dock with a WebsiteWidget
web = gui.add_dock().add_widget("WebsiteWidget")
# Set the URL of the website to display
web.set_url("https://bec.readthedocs.io/en/latest/")
```
## Example 2 - Navigating within the Website Widget
The `WebsiteWidget` allows users to navigate back and forward through the websites history. This example shows how to implement these navigation controls.
```python
# Go back in the website history
web.back()
# Go forward in the website history
web.forward()
```
## Example 3 - Reloading the Website
To ensure that the displayed website content is up-to-date, you can use the reload functionality.
```python
# Reload the current website
web.reload()
```
## Example 4 - Retrieving the Current URL
You may want to retrieve the current URL being displayed in the `WebsiteWidget`. The following example demonstrates how to access the current URL.
```python
# Get the current URL of the WebsiteWidget
current_url = web.get_url()
print(f"The current URL is: {current_url}")
```
````
````{tab} API
```{eval-rst}
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.WebsiteWidget.rst
```
````