bec_widgets.widgets.progress.ring_progress_bar.ring#

Classes#

ProgressbarConfig

Configuration for BECConnector mixin class

Ring

Connection mixin class to handle BEC client and device manager

Module Contents#

class ProgressbarConfig(/, **data: Any)#

Bases: bec_widgets.utils.bec_connector.ConnectionConfig

Configuration for BECConnector mixin class

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

background_color: str | tuple = None#
color: str | tuple = None#
device: str | None = None#
direction: int = None#
line_width: int = None#
max_value: int | float = None#
min_value: int | float = None#
mode: Literal['manual', 'scan', 'device'] = None#
precision: int = None#
signal: str | None = None#
start_position: int = None#
value: int | float = None#
class Ring(parent: bec_widgets.widgets.progress.ring_progress_bar.ring_progress_bar.RingProgressContainerWidget | None = None, client=None, **kwargs)#

Bases: bec_widgets.utils.bec_connector.BECConnector, qtpy.QtWidgets.QWidget

Connection mixin class to handle BEC client and device manager

BECConnector mixin class to handle BEC client and device manager.

Parameters:
  • client (BECClient, optional) – The BEC client.

  • config (ConnectionConfig, optional) – The connection configuration with specific gui id.

  • gui_id (str, optional) – The GUI ID.

  • object_name (str, optional) – The object name.

  • root_widget (bool, optional) – If set to True, the parent_id will be always set to None, thus enforcing that the widget is accessible as a root widget of the BECGuiClient object.

  • rpc_exposed (bool, optional) – If set to False, this instance is excluded from RPC registry broadcast and CLI namespace discovery.

  • rpc_passthrough_children (bool, optional) – Only relevant when rpc_exposed=False. If True, RPC-visible children rebind to the next visible ancestor. If False (default), children stay hidden behind this widget.

  • **kwargs

_auto_set_background_color()#

Automatically set the background color based on the main color and the current theme.

_get_signals_for_device(device: str) dict[str, list[str]]#

Get the signals for the device.

Parameters:

device (str) – Device name for the device

Returns:

Dictionary with the signals for the device

Return type:

dict[str, list[str]]

_update_device_connection(device: str, signal: str | None) str#

Update the device connection for the ring widget.

In general, we support two modes here: - If signal is provided, we use that directly. - If signal is not provided, we try to get the signal from the device manager.

We first check for progress signals, then for hinted signals, and finally for normal signals.

Depending on what type of signal we get (progress or hinted/normal), we subscribe to different endpoints.

Parameters:
  • device (str) – Device name for the device mode

  • signal (str) – Signal name for the device mode

Returns:

The selected signal name for the device mode

Return type:

str

background_color() qtpy.QtGui.QColor#
cleanup()#

Cleanup the ring widget. Disconnect any registered slots.

color() qtpy.QtGui.QColor#
convert_color(color: str | tuple | qtpy.QtGui.QColor) qtpy.QtGui.QColor#

Convert the color to QColor

Parameters:

color (str | tuple | QColor) – Color for the ring widget. Can be HEX code or tuple (R, G, B, A) or QColor.

device() str#
direction() int#
gap() int#
line_width() int#
max_value() float#
min_value() float#
mode() str#
on_device_progress(msg, meta)#

Update the ring widget with the device progress.

Parameters:
  • msg (dict) – Message with the device progress

  • meta (dict) – Metadata for the message

on_device_readback(msg, meta)#

Update the ring widget with the device readback.

Parameters:
  • msg (dict) – Message with the device readback

  • meta (dict) – Metadata for the message

on_scan_progress(msg, meta)#

Update the ring widget with the scan progress.

Parameters:
  • msg (dict) – Message with the scan progress

  • meta (dict) – Metadata for the message

paintEvent(event)#
precision() int#
set_background(color: str | tuple | qtpy.QtGui.QColor)#

Set the background color for the ring widget. The background color is only used when colors are not linked.

Parameters:

color (str | tuple) – Background color for the ring widget. Can be HEX code or tuple (R, G, B, A).

set_color(color: str | tuple)#

Set the color for the ring widget

Parameters:

color (str | tuple) – Color for the ring widget. Can be HEX code or tuple (R, G, B, A).

set_colors_linked(linked: bool)#

Set whether the colors are linked for the ring widget. If colors are linked, changing the main color will also change the background color.

Parameters:

linked (bool) – Whether to link the colors for the ring widget

set_direction(direction: int)#

Set the direction for the ring widget.

Parameters:

direction (int) – Direction for the ring widget. -1 for clockwise, 1 for counter-clockwise.

set_line_width(width: int)#

Set the line width for the ring widget

Parameters:

width (int) – Line width for the ring widget

set_min_max_values(min_value: int | float, max_value: int | float)#

Set the min and max values for the ring widget.

Parameters:
  • min_value (int | float) – Minimum value for the ring widget

  • max_value (int | float) – Maximum value for the ring widget

set_precision(precision: int)#

Set the precision for the ring widget.

Parameters:

precision (int) – Precision for the ring widget

set_start_angle(start_angle: int)#

Set the start angle for the ring widget.

Parameters:

start_angle (int) – Start angle for the ring widget in degrees

set_update(mode: Literal['manual', 'scan', 'device'], device: str = '', signal: str = '')#

Set the update mode for the ring widget. Modes: - “manual”: Manual update mode, the value is set by the user. - “scan”: Update mode for the scan progress. The value is updated by the current scan progress. - “device”: Update mode for the device readback. The value is updated by the device readback. Take into account that user has to set the device name and limits.

Parameters:
  • mode (str) – Update mode for the ring widget. Can be “manual”, “scan” or “device”

  • device (str) – Device name for the device readback mode, only used when mode is “device”

  • signal (str) – Signal name for the device readback mode, only used when mode is “device”

set_value(value: int | float)#

Set the value for the ring widget

Parameters:

value (int | float) – Value for the ring widget

signal() str#
start_position() int#
value() float#
RID = None#
RPC = True#
USER_ACCESS = ['set_value', 'set_color', 'set_background', 'set_colors_linked', 'set_line_width',...#
config: ProgressbarConfig#
progress_container = None#
registered_slot: tuple[Callable, str | bec_lib.endpoints.EndpointInfo] | None = None#