csaxs_bec.bec_widgets.auto_updates.auto_updates.cSAXSUpdateAlignment#

class cSAXSUpdateAlignment(parent=None, gui_id: str = None, window_title='Auto Update', *args, **kwargs)[source]#

Bases: AutoUpdates

Base class for all BEC widgets. This class should be used as a mixin class for all BEC widgets, e.g.:

>>> class MyWidget(BECWidget, QWidget):
>>>     def __init__(self, parent=None, client=None, config=None, gui_id=None):
>>>         super().__init__(parent=parent, client=client, config=config, gui_id=gui_id)
Parameters:
  • client (BECClient, optional) – The BEC client.

  • config (ConnectionConfig, optional) – The connection configuration.

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

  • theme_update (bool, optional) – Whether to subscribe to theme updates. Defaults to False. When set to True, the widget’s apply_theme method will be called when the theme changes.

Methods

acceptDrops

accessibleDescription

accessibleIdentifier

accessibleName

actionEvent

actions

activateWindow

addAction

addActions

addDockWidget

addToolBar

addToolBarBreak

adjustSize

apply_config

Apply the configuration to the widget.

apply_theme

Apply the theme to the widget.

attach

autoFillBackground

backgroundRole

backingStore

baseSize

best_effort

Best effort scan.

blockSignals

centralWidget

changeEvent

change_object_name

Change the object name of the widget.

change_theme

Change the theme of the application and propagate it to widgets.

childAt

childEvent

children

childrenRect

childrenRegion

cleanup

Cleanup procedure to run when the auto updates are disabled.

clearFocus

clearMask

close

closeEvent

Wrap the close even to ensure the rpc_register is cleaned up.

colorCount

connect

connectNotify

contentsMargins

contentsRect

contextMenuEvent

contextMenuPolicy

corner

create

createPopupMenu

createWinId

createWindowContainer

create_busy_state_widget

Method to create a custom busy state widget to be shown in the busy overlay.

cursor

customEvent

deleteLater

depth

destroy

detach

Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.

devType

devicePixelRatio

devicePixelRatioF

devicePixelRatioFScale

disconnect

disconnectNotify

display_app_id

Display the app ID in the status bar.

display_client_message

Display a client message in the status bar.

dockOptions

dockWidgetArea

documentMode

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

dumpObjectInfo

dumpObjectTree

dynamicPropertyNames

effectiveWinId

emit

enable_gui_highlights

Enable or disable GUI highlights.

encodeMetricF

ensurePolished

enterEvent

event

eventFilter

export_settings

Export the settings of the widget as dict.

fetch_theme

find

findChild

findChildren

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPolicy

focusPreviousChild

focusProxy

focusWidget

font

fontInfo

fontMetrics

foregroundRole

frameGeometry

frameSize

geometry

get_bec_shortcuts

Get BEC shortcuts for the widget.

get_config

Get the configuration of the widget.

get_help_md

Method to override in subclasses to provide help text in markdown format.

get_obj_by_id

get_selected_device

Get the selected device for the plot.

grab

grabGesture

grabKeyboard

grabMouse

grabShortcut

graphicsEffect

graphicsProxyWidget

hasFocus

hasHeightForWidth

hasMouseTracking

hasTabletTracking

height

heightForWidth

heightMM

hide

hideEvent

iconSize

inherits

initPainter

inputMethodEvent

inputMethodHints

inputMethodQuery

insertAction

insertActions

insertToolBar

insertToolBarBreak

installEventFilter

internalWinId

isActiveWindow

isAncestorOf

isAnimated

isDockNestingEnabled

isEnabled

isEnabledTo

isFullScreen

isHidden

isLeftToRight

isMaximized

isMinimized

isModal

isQuickItemType

isRightToLeft

isSeparator

isSignalConnected

isTopLevel

isVisible

isVisibleTo

isWidgetType

isWindow

isWindowModified

isWindowType

is_busy

Check if the loading overlay is enabled.

keyPressEvent

keyReleaseEvent

keyboardGrabber

killTimer

layout

layoutDirection

leaveEvent

load_config

Load the configuration of the widget from YAML.

load_settings

Load the settings of the widget from dict.

load_ui

locale

logicalDpiX

logicalDpiY

lower

mapFrom

mapFromGlobal

mapFromParent

mapTo

mapToGlobal

mapToParent

mask

maximumHeight

maximumSize

maximumWidth

menuBar

menuWidget

metaObject

metric

minimumHeight

minimumSize

minimumSizeHint

minimumWidth

mouseDoubleClickEvent

mouseGrabber

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

move

moveEvent

moveToThread

nativeEvent

nativeParentWidget

nextInFocusChain

normalGeometry

objectName

on_config_update

Update the configuration for the widget.

on_scan_abort

Procedure to run when a scan is aborted.

on_scan_closed

Procedure to run when a scan ends.

on_scan_open

Procedure to run when a scan starts.

on_start

Procedure to run when the auto updates are enabled.

on_stop

Procedure to run when the auto updates are disabled.

overrideWindowFlags

overrideWindowState

paintEngine

paintEvent

paintingActive

palette

parent

parentWidget

physicalDpiX

physicalDpiY

pos

previousInFocusChain

property

raise_

receivers

rect

redirected

releaseKeyboard

releaseMouse

releaseShortcut

remove

Cleanup the BECConnector

removeAction

removeDockWidget

removeEventFilter

removeToolBar

removeToolBarBreak

render

repaint

resize

resizeDocks

resizeEvent

restoreDockWidget

restoreGeometry

restoreState

saveGeometry

saveState

save_config

Save the configuration of the widget to YAML.

screen

screenshot

Take a screenshot of the dock area and save it to a file.

screenshot_bytes

Grab this widget, optionally scale to a max size, and return encoded image bytes.

screenshot_to_scilog

Take a screenshot of the widget and send it to SciLog through BEC messaging services.

scroll

sender

senderSignalIndex

setAcceptDrops

setAccessibleDescription

setAccessibleIdentifier

setAccessibleName

setAnimated

setAttribute

setAutoFillBackground

setBackgroundRole

setBaseSize

setCentralWidget

Re‑implement QMainWindow.setCentralWidget so that the main content widget always lives on the lower layer of the stacked layout that hosts our notification overlays.

setContentsMargins

setContextMenuPolicy

setCorner

setCursor

setDisabled

setDockNestingEnabled

setDockOptions

setDocumentMode

setEnabled

setFixedHeight

setFixedSize

setFixedWidth

setFocus

setFocusPolicy

setFocusProxy

setFont

setForegroundRole

setGeometry

setGraphicsEffect

setHidden

setIconSize

setInputMethodHints

setLayout

setLayoutDirection

setLocale

setMask

setMaximumHeight

setMaximumSize

setMaximumWidth

setMenuBar

setMenuWidget

setMinimumHeight

setMinimumSize

setMinimumWidth

setMouseTracking

setObjectName

Set the object name of the widget.

setPalette

setParent

setProperty

setScreen

setShortcutAutoRepeat

setShortcutEnabled

setSizeIncrement

setSizePolicy

setStatusBar

setStatusTip

setStyle

setStyleSheet

setTabOrder

setTabPosition

setTabShape

setTabletTracking

setToolButtonStyle

setToolTip

setToolTipDuration

setUnifiedTitleAndToolBarOnMac

setUpdatesEnabled

setVisible

setWhatsThis

setWindowFilePath

setWindowFlag

setWindowFlags

setWindowIcon

setWindowIconText

setWindowModality

setWindowModified

setWindowOpacity

setWindowRole

setWindowState

setWindowTitle

set_busy

Set the busy state of the widget.

set_dock_to_widget

Set the dock to the widget.

sharedPainter

show

showEvent

showFullScreen

showMaximized

showMinimized

showNormal

signalsBlocked

simple_grid_scan

Simple grid scan.

simple_line_scan

Simple line scan.

size

sizeHint

sizeIncrement

sizePolicy

splitDockWidget

stackUnder

startTimer

start_auto_update

Establish all connections for the auto updates.

start_default_dock

Create a default dock for the auto updates.

statusBar

statusTip

stop_auto_update

Disconnect all connections for the auto updates.

style

styleSheet

submit_task

Submit a task to run in a separate thread.

tabPosition

tabShape

tabifiedDockWidgets

tabifyDockWidget

tabletEvent

takeCentralWidget

testAttribute

thread

timerEvent

toolBarArea

toolBarBreak

toolButtonStyle

toolTip

toolTipDuration

topLevelWidget

tr

underMouse

ungrabGesture

unifiedTitleAndToolBarOnMac

unsetCursor

unsetLayoutDirection

unsetLocale

update

updateGeometry

updateMicroFocus

update_client

Update the client and device manager from BEC and create object for BEC shortcuts.

updatesEnabled

visibleRegion

whatsThis

wheelEvent

width

widthMM

winId

window

windowFilePath

windowFlags

windowHandle

windowIcon

windowIconText

windowModality

windowOpacity

windowRole

windowState

windowTitle

windowType

x

y

Attributes

EXIT_HANDLERS

ICON_NAME

PLUGIN

RPC

SCAN_PROGRESS_HEIGHT

SCAN_PROGRESS_WIDTH

USER_ACCESS

customContextMenuRequested

destroyed

enabled

Get the enabled status of the auto updates.

iconSizeChanged

name_established

objectNameChanged

painters

parent_id

rpc_widget_class

selected_device

Get the selected device from the auto update config.

staticMetaObject

tabifiedDockWidgetActivated

toolButtonStyleChanged

widget_removed

windowIconChanged

windowIconTextChanged

windowTitleChanged

class DockOption(*values)#

Bases: Flag

class PaintDeviceMetric(*values)#

Bases: Enum

class RenderFlag(*values)#

Bases: Flag

apply_config(config: dict, generate_new_id: bool = True) None#

Apply the configuration to the widget.

Parameters:
  • config (dict) – Configuration settings.

  • generate_new_id (bool) – If True, generate a new GUI ID for the widget.

apply_theme(theme: str)#

Apply the theme to the widget.

Parameters:

theme (str, optional) – The theme to be applied.

best_effort(info: ScanStatusMessage) None#

Best effort scan.

Parameters:

info (ScanStatusMessage) – The scan status message.

change_object_name(name: str) None#

Change the object name of the widget. Unregister old name and register the new one.

Parameters:

name (str) – The new object name.

change_theme(theme: str)#

Change the theme of the application and propagate it to widgets.

Parameters:

theme (str) – Either “light” or “dark”.

cleanup() None#

Cleanup procedure to run when the auto updates are disabled.

closeEvent(event)#

Wrap the close even to ensure the rpc_register is cleaned up.

create_busy_state_widget() QWidget#

Method to create a custom busy state widget to be shown in the busy overlay. Child classes should overrid this method to provide a custom widget if desired.

Returns:

The custom busy state widget.

Return type:

QWidget

Note

The implementation here is a SpinnerWidget with a “Loading…” label. This is the default busy state widget for all BECWidgets. However, child classes with specific needs for the busy state can easily overrite this method to provide a custom widget. The signature of the method must be preserved to ensure compatibility with the busy overlay system. If the widget provides a ‘cleanup’ method, it will be called when the overlay is cleaned up.

The widget may connect to the _busy_overlay signals foreground_color_changed and scrim_color_changed to update its colors when the theme changes.

detach()#

Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.

display_app_id()#

Display the app ID in the status bar.

display_client_message(msg: dict, meta: dict)#

Display a client message in the status bar.

Parameters:
  • msg (dict) – The message to display, should contain:

  • meta (dict) – Metadata about the message, usually empty.

enable_gui_highlights(enable: bool) None#

Enable or disable GUI highlights.

Parameters:

enable (bool) – Whether to enable or disable the highlights.

property enabled: bool#

Get the enabled status of the auto updates.

export_settings() dict#

Export the settings of the widget as dict.

Returns:

The exported settings of the widget.

Return type:

dict

get_bec_shortcuts()#

Get BEC shortcuts for the widget.

get_config(dict_output: bool = True) dict | BaseModel#

Get the configuration of the widget.

Parameters:

dict_output (bool) – If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.

Returns:

The configuration of the widget.

Return type:

dict | BaseModel

get_help_md() str#

Method to override in subclasses to provide help text in markdown format.

Returns:

The help text in markdown format.

Return type:

str

get_selected_device(monitored_devices, selected_device: str | None = None) str | None#

Get the selected device for the plot. If no device is selected, the first device in the monitored devices list is selected.

is_busy() bool#

Check if the loading overlay is enabled.

Returns:

True if the loading overlay is enabled, False otherwise.

Return type:

bool

load_config(path: str | None = None, gui: bool = False)#

Load the configuration of the widget from YAML.

Parameters:
  • path (str | None) – Path to the configuration file for non-GUI dialog mode.

  • gui (bool) – If True, use the GUI dialog to load the configuration file.

load_settings(settings: dict) None#

Load the settings of the widget from dict.

Parameters:

settings (dict) – The settings to load into the widget.

on_config_update(config: ConnectionConfig | dict) None#

Update the configuration for the widget.

Parameters:

config (ConnectionConfig | dict) – Configuration settings.

on_scan_abort(msg: ScanStatusMessage) None#

Procedure to run when a scan is aborted.

Parameters:

msg (ScanStatusMessage) – The scan status message.

on_scan_closed(msg: ScanStatusMessage) None#

Procedure to run when a scan ends.

Parameters:

msg (ScanStatusMessage) – The scan status message.

on_scan_open(msg: ScanStatusMessage) None#

Procedure to run when a scan starts.

Parameters:

msg (ScanStatusMessage) – The scan status message.

on_start() None#

Procedure to run when the auto updates are enabled.

on_stop() None#

Procedure to run when the auto updates are disabled.

remove()#

Cleanup the BECConnector

save_config(path: str | None = None, gui: bool = False)#

Save the configuration of the widget to YAML.

Parameters:
  • path (str | None) – Path to save the configuration file for non-GUI dialog mode.

  • gui (bool) – If True, use the GUI dialog to save the configuration file.

screenshot(file_name: str | None = None)#

Take a screenshot of the dock area and save it to a file.

screenshot_bytes(*, max_width: int | None = None, max_height: int | None = None, fmt: str = 'PNG', quality: int = -1) QByteArray#

Grab this widget, optionally scale to a max size, and return encoded image bytes.

If max_width/max_height are omitted (the default), capture at full resolution.

Parameters:
  • max_width (int, optional) – Maximum width of the screenshot.

  • max_height (int, optional) – Maximum height of the screenshot.

  • fmt (str, optional) – Image format (e.g., “PNG”, “JPEG”).

  • quality (int, optional) – Image quality (0-100), -1 for default.

Returns:

The screenshot image bytes.

Return type:

QByteArray

screenshot_to_scilog() None#

Take a screenshot of the widget and send it to SciLog through BEC messaging services.

property selected_device: str | None#

Get the selected device from the auto update config.

Returns:

The selected device. If no device is selected, None is returned.

Return type:

str

setCentralWidget(widget: QWidget, qt_default: bool = False)#

Re‑implement QMainWindow.setCentralWidget so that the main content widget always lives on the lower layer of the stacked layout that hosts our notification overlays.

Parameters:
  • widget – The widget that should become the new central content.

  • qt_default – When True the call is forwarded to the base class so that Qt behaves exactly as the original implementation (used during __init__ when we first install self._full_content).

setObjectName(name: str) None#

Set the object name of the widget.

Parameters:

name (str) – The new object name.

set_busy(enabled: bool) None#

Set the busy state of the widget. This will show or hide the loading overlay, which will block user interaction with the widget and show the busy_state_widget if provided. Per default, the busy state widget is a spinner with “Loading…” text.

Parameters:

enabled (bool) – Whether to enable the busy state.

set_dock_to_widget(widget: Literal['Waveform', 'Image', 'ScatterWaveform', 'MotorMap', 'MultiWaveForm'] | str) BECWidget#

Set the dock to the widget.

Parameters:

widget (str) – The widget to set the dock to. Must be the name of a valid widget class.

Returns:

The widget that was set.

Return type:

BECWidget

simple_grid_scan(info: ScanStatusMessage) None#

Simple grid scan.

Parameters:

info (ScanStatusMessage) – The scan status message.

simple_line_scan(info: ScanStatusMessage) None#

Simple line scan.

Parameters:

info (ScanStatusMessage) – The scan status message.

start_auto_update()#

Establish all connections for the auto updates.

start_default_dock()#

Create a default dock for the auto updates.

stop_auto_update()#

Disconnect all connections for the auto updates.

submit_task(fn, *args, on_complete: SafeSlot = None, **kwargs) Worker#

Submit a task to run in a separate thread. The task will run the specified function with the provided arguments and emit the completed signal when done.

Use this method if you want to wait for a task to complete without blocking the main thread.

Parameters:
  • fn – Function to run in a separate thread.

  • *args – Arguments for the function.

  • on_complete – Slot to run when the task is complete.

  • **kwargs – Keyword arguments for the function.

Returns:

The worker object that will run the task.

Return type:

worker

Examples

>>> def my_function(a, b):
>>>     print(a + b)
>>> self.submit_task(my_function, 1, 2)
>>> def my_function(a, b):
>>>     print(a + b)
>>> def on_complete():
>>>     print("Task complete")
>>> self.submit_task(my_function, 1, 2, on_complete=on_complete)
update_client(client) None#

Update the client and device manager from BEC and create object for BEC shortcuts.

Parameters:

client – BEC client.