add current sample widget
CI for pxii_bec / test (pull_request) Successful in 1m20s
CI for pxii_bec / test (push) Successful in 1m27s

This commit was merged in pull request #31.
This commit is contained in:
perl_d committed 2026-12-03 11:26:18 +01:00
1 parent 692731c088
commit 0e1bc92e12
6 files changed
+97

No files matched your search

+18
View File
@@ -15,6 +15,7 @@ logger = bec_logger.logger
_Widgets = {
"PxIIActorConfigWiget": "PxIIActorConfigWiget",
"PxIIAutomationPermissionWidget": "PxIIAutomationPermissionWidget",
"PxIICurrentSampleWidget": "PxIICurrentSampleWidget",
"PxIISampleQueueWidget": "PxIISampleQueueWidget",
"PxIISpreadsheetDisplay": "PxIISpreadsheetDisplay",
"PxIITaskPanel": "PxIITaskPanel",
@@ -50,6 +51,23 @@ class PxIIAutomationPermissionWidget(RPCBase):
"""
class PxIICurrentSampleWidget(RPCBase):
_IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
@rpc_call
def refresh(self):
"""
Show the sample which was mounted last, as announced by the AareBec service.
"""
@rpc_call
def show_sample(self, sample_id: "int"):
"""
Fetch the record of the sample with this database id from AareDAQ and show it.
Returns at once; the record, or why it could not be fetched, appears in the widget.
"""
class PxIISampleQueueWidget(RPCBase):
_IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
@@ -10,6 +10,7 @@ designer_plugins = {
"pxii_bec.bec_widgets.widgets.imported",
"PxIIAutomationPermissionWidget",
),
"PxIICurrentSampleWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIICurrentSampleWidget"),
"PxIISampleQueueWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIISampleQueueWidget"),
"PxIISpreadsheetDisplay": ("pxii_bec.bec_widgets.widgets.imported", "PxIISpreadsheetDisplay"),
"PxIITaskPanel": ("pxii_bec.bec_widgets.widgets.imported", "PxIITaskPanel"),
@@ -20,6 +21,7 @@ designer_plugins = {
widget_icons = {
"PxIIActorConfigWiget": "format_list_bulleted",
"PxIIAutomationPermissionWidget": "key",
"PxIICurrentSampleWidget": "science",
"PxIISampleQueueWidget": "pending_actions",
"PxIISpreadsheetDisplay": "format_list_bulleted",
"PxIITaskPanel": "play_arrow",
+4
View File
@@ -1,6 +1,7 @@
from mx_bec.bec_widgets.widgets.aare_bec import (
MxActorConfigWidget,
MxAutomationPermissionWidget,
MxCurrentSampleWidget,
MxTaskPanel,
MxTaskQueueWidget,
SampleQueueWidget,
@@ -24,3 +25,6 @@ class PxIISpreadsheetDisplay(SampleSpreadsheetDisplay): ...
class PxIIAutomationPermissionWidget(MxAutomationPermissionWidget): ...
class PxIICurrentSampleWidget(MxCurrentSampleWidget): ...
@@ -0,0 +1 @@
{'files': ['imported.py']}
@@ -0,0 +1,57 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
from qtpy.QtWidgets import QWidget
from bec_widgets.utils.bec_designer import designer_material_icon
from pxii_bec.bec_widgets.widgets.imported import PxIICurrentSampleWidget
DOM_XML = """
<ui language='c++'>
<widget class='PxIICurrentSampleWidget' name='px_ii_current_sample_widget'>
</widget>
</ui>
"""
class PxIICurrentSampleWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
def __init__(self):
super().__init__()
self._form_editor = None
def createWidget(self, parent):
if parent is None:
return QWidget()
t = PxIICurrentSampleWidget(parent)
return t
def domXml(self):
return DOM_XML
def group(self):
return ""
def icon(self):
return designer_material_icon(PxIICurrentSampleWidget.ICON_NAME)
def includeFile(self):
return "px_ii_current_sample_widget"
def initialize(self, form_editor):
self._form_editor = form_editor
def isContainer(self):
return False
def isInitialized(self):
return self._form_editor is not None
def name(self):
return "PxIICurrentSampleWidget"
def toolTip(self):
return "PxIICurrentSampleWidget"
def whatsThis(self):
return self.toolTip()
@@ -0,0 +1,15 @@
def main(): # pragma: no cover
from qtpy import PYSIDE6
if not PYSIDE6:
print("PYSIDE6 is not available in the environment. Cannot patch designer.")
return
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
from pxii_bec.bec_widgets.widgets.px_ii_current_sample_widget_plugin import PxIICurrentSampleWidgetPlugin
QPyDesignerCustomWidgetCollection.addCustomWidget(PxIICurrentSampleWidgetPlugin())
if __name__ == "__main__": # pragma: no cover
main()