migrated secop_psi drivers to new syntax

- includes all changes up to 'fix inheritance order' from git_mlz
  6a32ecf342

Change-Id: Ie3ceee3dbd0a9284b47b1d5b5dbe262eebe8f283
This commit is contained in:
2021-02-24 16:15:23 +01:00
parent bc5edec06f
commit 41baf5805f
79 changed files with 2610 additions and 3952 deletions

View File

@@ -23,12 +23,13 @@
from secop.datatypes import ArrayOf, BLOBType, BoolType, EnumType, \
FloatRange, IntRange, StringType, StructOf, TupleOf, TextType
from secop.gui.qt import QCheckBox, QComboBox, QDialog, QDoubleSpinBox, \
QFrame, QGridLayout, QGroupBox, QLabel, QLineEdit, QSpinBox, QVBoxLayout, \
QTextEdit
FloatRange, IntRange, StringType, StructOf, TextType, TupleOf
from secop.gui.qt import QCheckBox, QComboBox, QDialog, \
QDoubleSpinBox, QFrame, QGridLayout, QGroupBox, \
QLabel, QLineEdit, QSpinBox, QTextEdit, QVBoxLayout
from secop.gui.util import loadUi
# XXX: implement live validators !!!!
# XXX: signals upon change of value
# XXX: honor readonly in all cases!
@@ -171,12 +172,12 @@ class StructWidget(QGroupBox):
self._labels = []
for idx, name in enumerate(sorted(datatype.members)):
dt = datatype.members[name]
w = get_widget(dt, readonly=readonly, parent=self)
l = QLabel(name)
self.layout.addWidget(l, idx, 0)
self.layout.addWidget(w, idx, 1)
self._labels.append(l)
self.subwidgets[name] = (w, dt)
widget = get_widget(dt, readonly=readonly, parent=self)
label = QLabel(name)
self.layout.addWidget(label, idx, 0)
self.layout.addWidget(widget, idx, 1)
self._labels.append(label)
self.subwidgets[name] = (widget, dt)
self.datatypes.append(dt)
self.setLayout(self.layout)
@@ -215,21 +216,22 @@ class ArrayWidget(QGroupBox):
w.set_value(v)
def get_widget(datatype, readonly=False, parent=None):
return {FloatRange: FloatWidget,
IntRange: IntWidget,
StringType: StringWidget,
TextType: TextWidget,
BLOBType: BlobWidget,
EnumType: EnumWidget,
BoolType: BoolWidget,
TupleOf: TupleWidget,
StructOf: StructWidget,
ArrayOf: ArrayWidget,
return {
FloatRange: FloatWidget,
IntRange: IntWidget,
StringType: StringWidget,
TextType: TextWidget,
BLOBType: BlobWidget,
EnumType: EnumWidget,
BoolType: BoolWidget,
TupleOf: TupleWidget,
StructOf: StructWidget,
ArrayOf: ArrayWidget,
}.get(datatype.__class__)(datatype, readonly, parent)
# TODO: handle NoneOr
class msg(QDialog):
def __init__(self, stuff, parent=None):
super(msg, self).__init__(parent)
@@ -242,7 +244,7 @@ class msg(QDialog):
dt = StructOf(i=IntRange(0, 10), f=FloatRange(), b=BoolType())
w = StructWidget(dt)
self.gridLayout.addWidget(w, row, 1)
row+=1
row += 1
self.gridLayout.addWidget(QLabel('stuff'), row, 0, 1, 0)
row += 1 # at pos (0,0) span 2 cols, 1 row