csaxs_bec.bec_widgets.auto_updates.auto_updates.cSAXSUpdateScan#
- class cSAXSUpdateScan(parent=None, gui_id: str = None, window_title='Auto Update', *args, **kwargs)[source]#
Bases:
AutoUpdatesBase 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
acceptDropsaccessibleDescriptionaccessibleIdentifieraccessibleNameactionEventactionsactivateWindowaddActionaddActionsaddDockWidgetaddToolBaraddToolBarBreakadjustSizeApply the configuration to the widget.
Apply the theme to the widget.
attachautoFillBackgroundbackgroundRolebackingStorebaseSizeBest effort scan.
blockSignalscentralWidgetchangeEventChange the object name of the widget.
Change the theme of the application and propagate it to widgets.
childAtchildEventchildrenchildrenRectchildrenRegionCleanup procedure to run when the auto updates are disabled.
clearFocusclearMaskcloseWrap the close even to ensure the rpc_register is cleaned up.
colorCountconnectconnectNotifycontentsMarginscontentsRectcontextMenuEventcontextMenuPolicycornercreatecreatePopupMenucreateWinIdcreateWindowContainerMethod to create a custom busy state widget to be shown in the busy overlay.
cursorcustomEventdeleteLaterdepthdestroyDetach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
devTypedevicePixelRatiodevicePixelRatioFdevicePixelRatioFScaledisconnectdisconnectNotifyDisplay the app ID in the status bar.
Display a client message in the status bar.
dockOptionsdockWidgetAreadocumentModedragEnterEventdragLeaveEventdragMoveEventdropEventdumpObjectInfodumpObjectTreedynamicPropertyNameseffectiveWinIdemitEnable or disable GUI highlights.
encodeMetricFensurePolishedenterEventeventeventFilterExport the settings of the widget as dict.
fetch_themefindfindChildfindChildrenfocusInEventfocusNextChildfocusNextPrevChildfocusOutEventfocusPolicyfocusPreviousChildfocusProxyfocusWidgetfontfontInfofontMetricsforegroundRoleframeGeometryframeSizegeometryGet BEC shortcuts for the widget.
Get the configuration of the widget.
Method to override in subclasses to provide help text in markdown format.
get_obj_by_idGet the selected device for the plot.
grabgrabGesturegrabKeyboardgrabMousegrabShortcutgraphicsEffectgraphicsProxyWidgethasFocushasHeightForWidthhasMouseTrackinghasTabletTrackingheightheightForWidthheightMMhidehideEventiconSizeinheritsinitPainterinputMethodEventinputMethodHintsinputMethodQueryinsertActioninsertActionsinsertToolBarinsertToolBarBreakinstallEventFilterinternalWinIdisActiveWindowisAncestorOfisAnimatedisDockNestingEnabledisEnabledisEnabledToisFullScreenisHiddenisLeftToRightisMaximizedisMinimizedisModalisQuickItemTypeisRightToLeftisSeparatorisSignalConnectedisTopLevelisVisibleisVisibleToisWidgetTypeisWindowisWindowModifiedisWindowTypeCheck if the loading overlay is enabled.
keyPressEventkeyReleaseEventkeyboardGrabberkillTimerlayoutlayoutDirectionleaveEventLoad the configuration of the widget from YAML.
Load the settings of the widget from dict.
load_uilocalelogicalDpiXlogicalDpiYlowermapFrommapFromGlobalmapFromParentmapTomapToGlobalmapToParentmaskmaximumHeightmaximumSizemaximumWidthmenuBarmenuWidgetmetaObjectmetricminimumHeightminimumSizeminimumSizeHintminimumWidthmouseDoubleClickEventmouseGrabbermouseMoveEventmousePressEventmouseReleaseEventmovemoveEventmoveToThreadnativeEventnativeParentWidgetnextInFocusChainnormalGeometryobjectNameUpdate the configuration for the widget.
Procedure to run when a scan is aborted.
Procedure to run when a scan ends.
Procedure to run when a scan starts.
Procedure to run when the auto updates are enabled.
Procedure to run when the auto updates are disabled.
overrideWindowFlagsoverrideWindowStatepaintEnginepaintEventpaintingActivepaletteparentparentWidgetphysicalDpiXphysicalDpiYpospreviousInFocusChainpropertyraise_receiversrectredirectedreleaseKeyboardreleaseMousereleaseShortcutCleanup the BECConnector
removeActionremoveDockWidgetremoveEventFilterremoveToolBarremoveToolBarBreakrenderrepaintresizeresizeDocksresizeEventrestoreDockWidgetrestoreGeometryrestoreStatesaveGeometrysaveStateSave the configuration of the widget to YAML.
screenTake a screenshot of the dock area and save it to a file.
Grab this widget, optionally scale to a max size, and return encoded image bytes.
Take a screenshot of the widget and send it to SciLog through BEC messaging services.
scrollsendersenderSignalIndexsetAcceptDropssetAccessibleDescriptionsetAccessibleIdentifiersetAccessibleNamesetAnimatedsetAttributesetAutoFillBackgroundsetBackgroundRolesetBaseSizeRe‑implement QMainWindow.setCentralWidget so that the main content widget always lives on the lower layer of the stacked layout that hosts our notification overlays.
setContentsMarginssetContextMenuPolicysetCornersetCursorsetDisabledsetDockNestingEnabledsetDockOptionssetDocumentModesetEnabledsetFixedHeightsetFixedSizesetFixedWidthsetFocussetFocusPolicysetFocusProxysetFontsetForegroundRolesetGeometrysetGraphicsEffectsetHiddensetIconSizesetInputMethodHintssetLayoutsetLayoutDirectionsetLocalesetMasksetMaximumHeightsetMaximumSizesetMaximumWidthsetMenuBarsetMenuWidgetsetMinimumHeightsetMinimumSizesetMinimumWidthsetMouseTrackingSet the object name of the widget.
setPalettesetParentsetPropertysetScreensetShortcutAutoRepeatsetShortcutEnabledsetSizeIncrementsetSizePolicysetStatusBarsetStatusTipsetStylesetStyleSheetsetTabOrdersetTabPositionsetTabShapesetTabletTrackingsetToolButtonStylesetToolTipsetToolTipDurationsetUnifiedTitleAndToolBarOnMacsetUpdatesEnabledsetVisiblesetWhatsThissetWindowFilePathsetWindowFlagsetWindowFlagssetWindowIconsetWindowIconTextsetWindowModalitysetWindowModifiedsetWindowOpacitysetWindowRolesetWindowStatesetWindowTitleSet the busy state of the widget.
Set the dock to the widget.
sharedPaintershowshowEventshowFullScreenshowMaximizedshowMinimizedshowNormalsignalsBlockedSimple grid scan.
Simple line scan.
sizesizeHintsizeIncrementsizePolicysplitDockWidgetstackUnderstartTimerEstablish all connections for the auto updates.
Create a default dock for the auto updates.
statusBarstatusTipDisconnect all connections for the auto updates.
stylestyleSheetSubmit a task to run in a separate thread.
tabPositiontabShapetabifiedDockWidgetstabifyDockWidgettabletEventtakeCentralWidgettestAttributethreadtimerEventtoolBarAreatoolBarBreaktoolButtonStyletoolTiptoolTipDurationtopLevelWidgettrunderMouseungrabGestureunifiedTitleAndToolBarOnMacunsetCursorunsetLayoutDirectionunsetLocaleupdateupdateGeometryupdateMicroFocusUpdate the client and device manager from BEC and create object for BEC shortcuts.
updatesEnabledvisibleRegionwhatsThiswheelEventwidthwidthMMwinIdwindowwindowFilePathwindowFlagswindowHandlewindowIconwindowIconTextwindowModalitywindowOpacitywindowRolewindowStatewindowTitlewindowTypexyAttributes
EXIT_HANDLERSICON_NAMEPLUGINRPCSCAN_PROGRESS_HEIGHTSCAN_PROGRESS_WIDTHUSER_ACCESScustomContextMenuRequesteddestroyedGet the enabled status of the auto updates.
iconSizeChangedname_establishedobjectNameChangedpaintersparent_idrpc_widget_classGet the selected device from the auto update config.
staticMetaObjecttabifiedDockWidgetActivatedtoolButtonStyleChangedwidget_removedwindowIconChangedwindowIconTextChangedwindowTitleChanged- 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.