csaxs_bec.bec_widgets.widgets.xray_eye.x_ray_eye.XRayEye2DControl#
- class XRayEye2DControl(parent=None, step_size: int = 100, *arg, **kwargs)[source]#
Bases:
BECWidget,QWidgetBase 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
acceptDropsaccessibleDescriptionaccessibleIdentifieraccessibleNameactionEventactionsactivateWindowaddActionaddActionsadjustSizeApply the configuration to the widget.
Apply the theme to the widget.
attachautoFillBackgroundbackgroundRolebackingStorebaseSizeblockSignalschangeEventChange the object name of the widget.
childAtchildEventchildrenchildrenRectchildrenRegionCleanup the widget.
clearFocusclearMaskcloseWrap the close even to ensure the rpc_register is cleaned up.
colorCountconnectconnectNotifycontentsMarginscontentsRectcontextMenuEventcontextMenuPolicycreatecreateWinIdcreateWindowContainerMethod 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.
devTypedevicePixelRatiodevicePixelRatioFdevicePixelRatioFScaledisconnectdisconnectNotifydragEnterEventdragLeaveEventdragMoveEventdropEventdumpObjectInfodumpObjectTreedynamicPropertyNameseffectiveWinIdemitenable_controls_horenable_controls_verencodeMetricFensurePolishedenterEventeventeventFilterExport the settings of the widget as dict.
findfindChildfindChildrenfocusInEventfocusNextChildfocusNextPrevChildfocusOutEventfocusPolicyfocusPreviousChildfocusProxyfocusWidgetfontfontInfofontMetricsforegroundRoleframeGeometryframeSizegeometryGet 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_idgrabgrabGesturegrabKeyboardgrabMousegrabShortcutgraphicsEffectgraphicsProxyWidgethasFocushasHeightForWidthhasMouseTrackinghasTabletTrackingheightheightForWidthheightMMhidehideEventinheritsinitPainterinputMethodEventinputMethodHintsinputMethodQueryinsertActioninsertActionsinstallEventFilterinternalWinIdisActiveWindowisAncestorOfisEnabledisEnabledToisFullScreenisHiddenisLeftToRightisMaximizedisMinimizedisModalisQuickItemTypeisRightToLeftisSignalConnectedisTopLevelisVisibleisVisibleToisWidgetTypeisWindowisWindowModifiedisWindowTypeCheck if the loading overlay is enabled.
keyPressEventkeyReleaseEventkeyboardGrabberkillTimerlayoutlayoutDirectionleaveEventLoad the configuration of the widget from YAML.
Load the settings of the widget from dict.
localelogicalDpiXlogicalDpiYlowermapFrommapFromGlobalmapFromParentmapTomapToGlobalmapToParentmaskmaximumHeightmaximumSizemaximumWidthmetaObjectmetricminimumHeightminimumSizeminimumSizeHintminimumWidthmouseDoubleClickEventmouseGrabbermouseMoveEventmousePressEventmouseReleaseEventmovemoveEventmoveToThreadnativeEventnativeParentWidgetnextInFocusChainnormalGeometryobjectNameUpdate the configuration for the widget.
overrideWindowFlagsoverrideWindowStatepaintEnginepaintEventpaintingActivepaletteparentparentWidgetphysicalDpiXphysicalDpiYpospreviousInFocusChainpropertyraise_receiversrectredirectedreleaseKeyboardreleaseMousereleaseShortcutCleanup the BECConnector
removeActionremoveEventFilterrenderrepaintresizeresizeEventrestoreGeometrysaveGeometrySave 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.
scrollsendersenderSignalIndexsetAcceptDropssetAccessibleDescriptionsetAccessibleIdentifiersetAccessibleNamesetAttributesetAutoFillBackgroundsetBackgroundRolesetBaseSizesetContentsMarginssetContextMenuPolicysetCursorsetDisabledsetEnabledsetFixedHeightsetFixedSizesetFixedWidthsetFocussetFocusPolicysetFocusProxysetFontsetForegroundRolesetGeometrysetGraphicsEffectsetHiddensetInputMethodHintssetLayoutsetLayoutDirectionsetLocalesetMasksetMaximumHeightsetMaximumSizesetMaximumWidthsetMinimumHeightsetMinimumSizesetMinimumWidthsetMouseTrackingSet the object name of the widget.
setPalettesetParentsetPropertysetScreensetShortcutAutoRepeatsetShortcutEnabledsetSizeIncrementsetSizePolicysetStatusTipsetStylesetStyleSheetsetTabOrdersetTabletTrackingsetToolTipsetToolTipDurationsetUpdatesEnabledsetVisiblesetWhatsThissetWindowFilePathsetWindowFlagsetWindowFlagssetWindowIconsetWindowIconTextsetWindowModalitysetWindowModifiedsetWindowOpacitysetWindowRolesetWindowStatesetWindowTitleSet the busy state of the widget.
sharedPaintershowshowEventshowFullScreenshowMaximizedshowMinimizedshowNormalsignalsBlockedsizesizeHintsizeIncrementsizePolicystackUnderstartTimerstatusTipstylestyleSheetSubmit a task to run in a separate thread.
tabletEventtestAttributethreadtimerEventtoolTiptoolTipDurationtopLevelWidgettrunderMouseungrabGestureunsetCursorunsetLayoutDirectionunsetLocaleupdateupdateGeometryupdateMicroFocusUpdate the client and device manager from BEC and create object for BEC shortcuts.
updatesEnabledvisibleRegionwhatsThiswheelEventwidthwidthMMwinIdwindowwindowFilePathwindowFlagswindowHandlewindowIconwindowIconTextwindowModalitywindowOpacitywindowRolewindowStatewindowTitlewindowTypexyAttributes
EXIT_HANDLERSICON_NAMEUSER_ACCESScustomContextMenuRequesteddestroyedname_establishedobjectNameChangedpaintersparent_idstaticMetaObjectstep_sizewidget_removedwindowIconChangedwindowIconTextChangedwindowTitleChanged- 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.
- 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.
- cleanup()#
Cleanup the widget.
- 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.
- 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
- 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.
- 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.
- 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.
- 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.