mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix: add designer plugin for ScanMetadata
This commit is contained in:
@ -42,6 +42,7 @@ _Widgets = {
|
|||||||
"ResumeButton": "ResumeButton",
|
"ResumeButton": "ResumeButton",
|
||||||
"RingProgressBar": "RingProgressBar",
|
"RingProgressBar": "RingProgressBar",
|
||||||
"ScanControl": "ScanControl",
|
"ScanControl": "ScanControl",
|
||||||
|
"ScanMetadata": "ScanMetadata",
|
||||||
"ScatterWaveform": "ScatterWaveform",
|
"ScatterWaveform": "ScatterWaveform",
|
||||||
"SignalComboBox": "SignalComboBox",
|
"SignalComboBox": "SignalComboBox",
|
||||||
"SignalLineEdit": "SignalLineEdit",
|
"SignalLineEdit": "SignalLineEdit",
|
||||||
|
@ -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 bec_widgets.widgets.editors.scan_metadata.scan_metadata_plugin import ScanMetadataPlugin
|
||||||
|
|
||||||
|
QPyDesignerCustomWidgetCollection.addCustomWidget(ScanMetadataPlugin())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": # pragma: no cover
|
||||||
|
main()
|
@ -40,6 +40,9 @@ class ScanMetadata(BECWidget, QWidget):
|
|||||||
metadata schema registry supplied in the plugin repo to find pydantic models
|
metadata schema registry supplied in the plugin repo to find pydantic models
|
||||||
associated with the scan type. Sets limits for numerical values if specified."""
|
associated with the scan type. Sets limits for numerical values if specified."""
|
||||||
|
|
||||||
|
PLUGIN = True
|
||||||
|
ICON_NAME = "list_alt"
|
||||||
|
|
||||||
metadata_updated = Signal(dict)
|
metadata_updated = Signal(dict)
|
||||||
metadata_cleared = Signal(NoneType)
|
metadata_cleared = Signal(NoneType)
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
{'files': ['scan_metadata.py']}
|
@ -0,0 +1,54 @@
|
|||||||
|
# Copyright (C) 2022 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
||||||
|
|
||||||
|
from bec_widgets.utils.bec_designer import designer_material_icon
|
||||||
|
from bec_widgets.widgets.editors.scan_metadata.scan_metadata import ScanMetadata
|
||||||
|
|
||||||
|
DOM_XML = """
|
||||||
|
<ui language='c++'>
|
||||||
|
<widget class='ScanMetadata' name='scan_metadata'>
|
||||||
|
</widget>
|
||||||
|
</ui>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class ScanMetadataPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._form_editor = None
|
||||||
|
|
||||||
|
def createWidget(self, parent):
|
||||||
|
t = ScanMetadata(parent)
|
||||||
|
return t
|
||||||
|
|
||||||
|
def domXml(self):
|
||||||
|
return DOM_XML
|
||||||
|
|
||||||
|
def group(self):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def icon(self):
|
||||||
|
return designer_material_icon(ScanMetadata.ICON_NAME)
|
||||||
|
|
||||||
|
def includeFile(self):
|
||||||
|
return "scan_metadata"
|
||||||
|
|
||||||
|
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 "ScanMetadata"
|
||||||
|
|
||||||
|
def toolTip(self):
|
||||||
|
return "Dynamically generates a form for inclusion of metadata for a scan."
|
||||||
|
|
||||||
|
def whatsThis(self):
|
||||||
|
return self.toolTip()
|
Reference in New Issue
Block a user