add current sample widget
This commit was merged in pull request #45.
This commit is contained in:
1 parent
1a63842caf
commit
9b363aad7f
6 files changed
+100
No files matched your search
@@ -15,6 +15,7 @@ logger = bec_logger.logger
|
||||
_Widgets = {
|
||||
"PxIIIActorConfigWidget": "PxIIIActorConfigWidget",
|
||||
"PxIIIAutomationPermissionWidget": "PxIIIAutomationPermissionWidget",
|
||||
"PxIIICurrentSampleWidget": "PxIIICurrentSampleWidget",
|
||||
"PxIIISampleQueueWidget": "PxIIISampleQueueWidget",
|
||||
"PxIIISpreadsheetDisplay": "PxIIISpreadsheetDisplay",
|
||||
"PxIIITaskPanel": "PxIIITaskPanel",
|
||||
@@ -50,6 +51,23 @@ class PxIIIAutomationPermissionWidget(RPCBase):
|
||||
"""
|
||||
|
||||
|
||||
class PxIIICurrentSampleWidget(RPCBase):
|
||||
_IMPORT_MODULE = "pxiii_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 PxIIISampleQueueWidget(RPCBase):
|
||||
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ designer_plugins = {
|
||||
"pxiii_bec.bec_widgets.widgets.imported",
|
||||
"PxIIIAutomationPermissionWidget",
|
||||
),
|
||||
"PxIIICurrentSampleWidget": (
|
||||
"pxiii_bec.bec_widgets.widgets.imported",
|
||||
"PxIIICurrentSampleWidget",
|
||||
),
|
||||
"PxIIISampleQueueWidget": ("pxiii_bec.bec_widgets.widgets.imported", "PxIIISampleQueueWidget"),
|
||||
"PxIIISpreadsheetDisplay": (
|
||||
"pxiii_bec.bec_widgets.widgets.imported",
|
||||
@@ -23,6 +27,7 @@ designer_plugins = {
|
||||
widget_icons = {
|
||||
"PxIIIActorConfigWidget": "format_list_bulleted",
|
||||
"PxIIIAutomationPermissionWidget": "key",
|
||||
"PxIIICurrentSampleWidget": "science",
|
||||
"PxIIISampleQueueWidget": "pending_actions",
|
||||
"PxIIISpreadsheetDisplay": "format_list_bulleted",
|
||||
"PxIIITaskPanel": "play_arrow",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from mx_bec.bec_widgets.widgets.aare_bec import (
|
||||
MxActorConfigWidget,
|
||||
MxAutomationPermissionWidget,
|
||||
MxCurrentSampleWidget,
|
||||
MxTaskPanel,
|
||||
MxTaskQueueWidget,
|
||||
SampleQueueWidget,
|
||||
@@ -24,3 +25,6 @@ class PxIIISpreadsheetDisplay(SampleSpreadsheetDisplay): ...
|
||||
|
||||
|
||||
class PxIIIAutomationPermissionWidget(MxAutomationPermissionWidget): ...
|
||||
|
||||
|
||||
class PxIIICurrentSampleWidget(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 pxiii_bec.bec_widgets.widgets.imported import PxIIICurrentSampleWidget
|
||||
|
||||
DOM_XML = """
|
||||
<ui language='c++'>
|
||||
<widget class='PxIIICurrentSampleWidget' name='px_iii_current_sample_widget'>
|
||||
</widget>
|
||||
</ui>
|
||||
"""
|
||||
|
||||
|
||||
class PxIIICurrentSampleWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._form_editor = None
|
||||
|
||||
def createWidget(self, parent):
|
||||
if parent is None:
|
||||
return QWidget()
|
||||
t = PxIIICurrentSampleWidget(parent)
|
||||
return t
|
||||
|
||||
def domXml(self):
|
||||
return DOM_XML
|
||||
|
||||
def group(self):
|
||||
return ""
|
||||
|
||||
def icon(self):
|
||||
return designer_material_icon(PxIIICurrentSampleWidget.ICON_NAME)
|
||||
|
||||
def includeFile(self):
|
||||
return "px_iii_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 "PxIIICurrentSampleWidget"
|
||||
|
||||
def toolTip(self):
|
||||
return "PxIIICurrentSampleWidget"
|
||||
|
||||
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 pxiii_bec.bec_widgets.widgets.px_iii_current_sample_widget_plugin import PxIIICurrentSampleWidgetPlugin
|
||||
|
||||
QPyDesignerCustomWidgetCollection.addCustomWidget(PxIIICurrentSampleWidgetPlugin())
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
main()
|
||||
Reference in new issue
Block a user