1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-11 11:17:49 +01:00

feat(scan_control): plugin added for QtDesigner

This commit is contained in:
2024-06-25 19:11:26 +02:00
parent 167a1e8f00
commit dc9c1ec099
3 changed files with 69 additions and 0 deletions

View File

@@ -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.scan_control.scan_control_plugin import ScanControlPlugin
QPyDesignerCustomWidgetCollection.addCustomWidget(ScanControlPlugin())
if __name__ == "__main__": # pragma: no cover
main()

View File

@@ -0,0 +1,3 @@
{
"files": ["scan_control.py","scan_control_box.py"]
}

View File

@@ -0,0 +1,51 @@
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
from qtpy.QtGui import QIcon
from bec_widgets.widgets.scan_control import ScanControl
DOM_XML = """
<ui language='c++'>
<widget class='ScanControl' name='scan_control'>
</widget>
</ui>
"""
class ScanControlPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
def __init__(self):
super().__init__()
self._form_editor = None
def createWidget(self, parent):
t = ScanControl(parent)
return t
def domXml(self):
return DOM_XML
def group(self):
return ""
def icon(self):
return QIcon()
def includeFile(self):
return "scan_control"
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 "ScanControl"
def toolTip(self):
return "ScanControl widget"
def whatsThis(self):
return self.toolTip()