full grouping support
This commit is contained in:
parent
5a38f67e60
commit
74bcc44775
54
grouping.py
54
grouping.py
@ -19,6 +19,9 @@ class GroupingWindow(QtGui.QWidget):
|
||||
self.list_layout = QtGui.QVBoxLayout()
|
||||
self.ContentFrame.setLayout(self.list_layout)
|
||||
self.liberas = {}
|
||||
self.timeouts = []
|
||||
|
||||
self.connect(self.TimeoutSpinBox, QtCore.SIGNAL("editingFinished()"), self.setTimeout)
|
||||
|
||||
def addLibera(self, dev):
|
||||
print "[ INFO]: grouping: add Libera %s" % dev
|
||||
@ -26,6 +29,7 @@ class GroupingWindow(QtGui.QWidget):
|
||||
self.connect(self, QtCore.SIGNAL("update"), libera.update)
|
||||
self.liberas[dev] = libera
|
||||
self.list_layout.addWidget(libera)
|
||||
self.addAttribute(dev, "GdxGroupingTimeout")
|
||||
|
||||
def addGlobal(self, orbit, magnet):
|
||||
print "[ INFO]: grouping: global: orbit %s; magnet %s" % (orbit, magnet)
|
||||
@ -36,6 +40,18 @@ class GroupingWindow(QtGui.QWidget):
|
||||
def update(self, cache):
|
||||
self.emit(QtCore.SIGNAL("update"), cache)
|
||||
|
||||
self.timeouts = []
|
||||
for dev in self.liberas.keys():
|
||||
self.timeouts.append(cache[dev]["GdxGroupingTimeout"])
|
||||
to_set = set(self.timeouts)
|
||||
common_to = max(to_set, key=self.timeouts.count)
|
||||
|
||||
self.TimeoutLabel.setText(str(common_to))
|
||||
if len(to_set) > 1:
|
||||
self.WarningLabel.show()
|
||||
else:
|
||||
self.WarningLabel.hide()
|
||||
|
||||
def showEvent(self, evt):
|
||||
self.emit(QtCore.SIGNAL("show"))
|
||||
evt.accept()
|
||||
@ -44,6 +60,10 @@ class GroupingWindow(QtGui.QWidget):
|
||||
self.emit(QtCore.SIGNAL("hide"))
|
||||
evt.accept()
|
||||
|
||||
def setTimeout(self):
|
||||
for dev in self.liberas.keys():
|
||||
self.main_window.devices[dev].write_attribute("GdxGroupingTimeout", self.TimeoutSpinBox.value())
|
||||
|
||||
|
||||
class GroupingWidget(QtGui.QWidget):
|
||||
def __init__(self, main_window, device, parent=None):
|
||||
@ -60,9 +80,34 @@ class GroupingWidget(QtGui.QWidget):
|
||||
self.SFP3StatusLabel.setModel(device, "GdxSFP3Status")
|
||||
self.SFP4StatusLabel.setModel(device, "GdxSFP4Status")
|
||||
|
||||
self.SFP3LaneUpFlag.setModel(device, "GdxSFP3Status", 0)
|
||||
self.SFP3ChannelUpFlag.setModel(device, "GdxSFP3Status", 1)
|
||||
self.SFP3IPLLFlag.setModel(device, "GdxSFP3Status", 2)
|
||||
self.SFP3EPLLFlag.setModel(device, "GdxSFP3Status", 3)
|
||||
self.SFP3SoftErrorFlag.setModel(device, "GdxSFP3Status", 4)
|
||||
self.SFP3HardErrorFlag.setModel(device, "GdxSFP3Status", 5)
|
||||
|
||||
self.SFP4LaneUpFlag.setModel(device, "GdxSFP4Status", 0)
|
||||
self.SFP4ChannelUpFlag.setModel(device, "GdxSFP4Status", 1)
|
||||
self.SFP4IPLLFlag.setModel(device, "GdxSFP4Status", 2)
|
||||
self.SFP4EPLLFlag.setModel(device, "GdxSFP4Status", 3)
|
||||
self.SFP4SoftErrorFlag.setModel(device, "GdxSFP4Status", 4)
|
||||
self.SFP4HardErrorFlag.setModel(device, "GdxSFP4Status", 5)
|
||||
|
||||
self.SFP3SoftErrorFlag.setColorMap(cm.RED_BOOL)
|
||||
self.SFP3HardErrorFlag.setColorMap(cm.RED_BOOL)
|
||||
self.SFP4SoftErrorFlag.setColorMap(cm.RED_BOOL)
|
||||
self.SFP4HardErrorFlag.setColorMap(cm.RED_BOOL)
|
||||
|
||||
self.connect(self.ClearSFP3Button, QtCore.SIGNAL("clicked()"), lambda: self.clearStatus(3))
|
||||
self.connect(self.ClearSFP4Button, QtCore.SIGNAL("clicked()"), lambda: self.clearStatus(4))
|
||||
|
||||
def update(self, cache):
|
||||
self.emit(QtCore.SIGNAL("update"), cache)
|
||||
|
||||
def clearStatus(self, sfp):
|
||||
self.main_window.execute_ireg_command(self.device, "GdxSFP%dStatusClear" % sfp)
|
||||
|
||||
|
||||
class GlobalWidget(QtGui.QWidget):
|
||||
def __init__(self, main_window, orbit, magnet, parent=None):
|
||||
@ -84,5 +129,14 @@ class GlobalWidget(QtGui.QWidget):
|
||||
self.GlobalMagnetStateLabel.setModel(orbit, "GdxMagnetStatus")
|
||||
self.GlobalMagnetStateLabel.setColorMap(cm.GREEN_BOOL)
|
||||
|
||||
self.connect(self.GlobalOrbitResetButton, QtCore.SIGNAL("clicked()"), self.resetGlobalOrbit)
|
||||
self.connect(self.GlobalMagnetResetButton, QtCore.SIGNAL("clicked()"), self.resetGlobalMagnet)
|
||||
|
||||
def update(self, cache):
|
||||
self.emit(QtCore.SIGNAL("update"), cache)
|
||||
|
||||
def resetGlobalOrbit(self):
|
||||
self.main_window.execute_ireg_command(self.orbit, "GdxOrbitReconnect")
|
||||
|
||||
def resetGlobalMagnet(self):
|
||||
self.main_window.execute_ireg_command(self.magnet, "GdxMagnetReconnect")
|
||||
|
||||
22
labels.py
22
labels.py
@ -201,6 +201,28 @@ class ArrayElementLabel(TangoLabel):
|
||||
self.setStyleSheet("color: %s" % self.ColorMap[value])
|
||||
|
||||
|
||||
class BitLabel(TangoLabel):
|
||||
ColorMap = {
|
||||
0: "#000000",
|
||||
1: "#7CFC00"
|
||||
}
|
||||
|
||||
def __init__(self, parent=None):
|
||||
TangoLabel.__init__(self, parent)
|
||||
|
||||
def setModel(self, device, attr, i):
|
||||
self.i = i
|
||||
TangoLabel.setModel(self, device, attr)
|
||||
|
||||
def setColorMap(self, cm):
|
||||
self.ColorMap = cm
|
||||
|
||||
def update(self, cache):
|
||||
value = cache[self.device][self.attr]
|
||||
bits = bin(value).split("b")[1][::-1].ljust(self.i + 1, "0")
|
||||
self.setStyleSheet("color: %s" % self.ColorMap[int(bits[self.i])])
|
||||
|
||||
|
||||
class EnumStateLabel(TangoLabel):
|
||||
ColorMap = {
|
||||
0: "#000000",
|
||||
|
||||
@ -131,7 +131,7 @@ class MainWindow(QtGui.QWidget):
|
||||
# show all startup windows
|
||||
self.show()
|
||||
# fill grouping and magnets
|
||||
for dev in self.devices.keys():
|
||||
for dev in sorted(self.devices.keys()):
|
||||
if dev.upper() != "EVG":
|
||||
self.grouping.addLibera(dev)
|
||||
self.ser_output.addLibera(dev)
|
||||
|
||||
@ -228,7 +228,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<widget class="QPushButton" name="GlobaMagnetResetButton">
|
||||
<widget class="QPushButton" name="GlobalMagnetResetButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
|
||||
101
ui/grouping.ui
101
ui/grouping.ui
@ -13,34 +13,54 @@
|
||||
<property name="windowTitle">
|
||||
<string>FOFB: Libera Grouping</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Grouping timeout</string>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,1">
|
||||
<item row="2" column="0" colspan="6">
|
||||
<widget class="QFrame" name="ContentFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="WarningLabel">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:orange</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>⚠</string>
|
||||
<string>SFP3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Grouping timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="TimeoutSpinBox">
|
||||
<property name="minimumSize">
|
||||
@ -49,6 +69,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@ -65,25 +88,49 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QLabel" name="WarningLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="toolTip">
|
||||
<string>The parameter value is not consistent across instruments!</string>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:orange</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>⚠</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QFrame" name="ContentFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<property name="text">
|
||||
<string>SFP4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="TimeoutLabel">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel">
|
||||
<widget class="BitLabel" name="SFP3HardErrorFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -73,6 +73,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Hard error</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -82,7 +85,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_2">
|
||||
<widget class="BitLabel" name="SFP3SoftErrorFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -102,6 +105,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Soft error</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -111,7 +117,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_4">
|
||||
<widget class="BitLabel" name="SFP3EPLLFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -131,6 +137,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>External clock PLL locked</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -140,7 +149,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_3">
|
||||
<widget class="BitLabel" name="SFP3IPLLFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -160,6 +169,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Internal clock PLL locked</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -169,7 +181,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_5">
|
||||
<widget class="BitLabel" name="SFP3ChannelUpFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -189,6 +201,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -198,7 +213,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_6">
|
||||
<widget class="BitLabel" name="SFP3LaneUpFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -218,6 +233,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Lane up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -274,7 +292,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_7">
|
||||
<widget class="BitLabel" name="SFP4HardErrorFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -294,6 +312,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Hard error</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -303,7 +324,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_8">
|
||||
<widget class="BitLabel" name="SFP4SoftErrorFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -323,6 +344,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Soft error</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -332,7 +356,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_9">
|
||||
<widget class="BitLabel" name="SFP4EPLLFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -352,6 +376,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>External clock PLL locked</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -361,7 +388,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_10">
|
||||
<widget class="BitLabel" name="SFP4IPLLFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -381,6 +408,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Internal clock PLL locked</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -390,7 +420,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_11">
|
||||
<widget class="BitLabel" name="SFP4ChannelUpFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -410,6 +440,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -419,7 +452,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OperationLabel" name="MovePlungersLabel_12">
|
||||
<widget class="BitLabel" name="SFP4LaneUpFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -439,6 +472,9 @@
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Lane up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∙</string>
|
||||
</property>
|
||||
@ -483,12 +519,12 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>OperationLabel</class>
|
||||
<class>TangoLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>labels</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TangoLabel</class>
|
||||
<class>BitLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>labels</header>
|
||||
</customwidget>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user