diff --git a/grouping.py b/grouping.py
index fae046b..3ca0cfe 100644
--- a/grouping.py
+++ b/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")
diff --git a/labels.py b/labels.py
index 6855df7..c21be2e 100644
--- a/labels.py
+++ b/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",
diff --git a/mainwindow.py b/mainwindow.py
index 9ffd773..a0aa91c 100644
--- a/mainwindow.py
+++ b/mainwindow.py
@@ -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)
diff --git a/ui/globalwidget.ui b/ui/globalwidget.ui
index 0aca338..0e4c88e 100644
--- a/ui/globalwidget.ui
+++ b/ui/globalwidget.ui
@@ -228,7 +228,7 @@
-
-
+
45
diff --git a/ui/grouping.ui b/ui/grouping.ui
index 9c9cc3f..a95c624 100644
--- a/ui/grouping.ui
+++ b/ui/grouping.ui
@@ -13,34 +13,54 @@
FOFB: Libera Grouping
-
-
-
-
-
- Grouping timeout
+
+
-
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
- -
-
+
-
+
- 16
+ 12
75
true
-
- color:orange
-
- ⚠
+ SFP3
Qt::AlignCenter
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Grouping timeout
+
+
+
-
@@ -49,6 +69,9 @@
0
+
+ 10000
+
-
@@ -65,25 +88,49 @@
-
-
-
- Qt::Horizontal
+
+
+
+ 16
+ 75
+ true
+
-
-
- 40
- 20
-
+
+ The parameter value is not consistent across instruments!
-
+
+ color:orange
+
+
+ ⚠
+
+
+ Qt::AlignCenter
+
+
- -
-
-
- QFrame::StyledPanel
+
-
+
+
+
+ 12
+ 75
+ true
+
-
- QFrame::Raised
+
+ SFP4
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 0
diff --git a/ui/groupingwidget.ui b/ui/groupingwidget.ui
index 1de13bd..568aa4d 100644
--- a/ui/groupingwidget.ui
+++ b/ui/groupingwidget.ui
@@ -53,7 +53,7 @@
1
-
-
+
0
@@ -73,6 +73,9 @@
false
+
+ Hard error
+
∙
@@ -82,7 +85,7 @@
-
-
+
0
@@ -102,6 +105,9 @@
false
+
+ Soft error
+
∙
@@ -111,7 +117,7 @@
-
-
+
0
@@ -131,6 +137,9 @@
false
+
+ External clock PLL locked
+
∙
@@ -140,7 +149,7 @@
-
-
+
0
@@ -160,6 +169,9 @@
false
+
+ Internal clock PLL locked
+
∙
@@ -169,7 +181,7 @@
-
-
+
0
@@ -189,6 +201,9 @@
false
+
+ Channel up
+
∙
@@ -198,7 +213,7 @@
-
-
+
0
@@ -218,6 +233,9 @@
false
+
+ Lane up
+
∙
@@ -274,7 +292,7 @@
-
-
+
0
@@ -294,6 +312,9 @@
false
+
+ Hard error
+
∙
@@ -303,7 +324,7 @@
-
-
+
0
@@ -323,6 +344,9 @@
false
+
+ Soft error
+
∙
@@ -332,7 +356,7 @@
-
-
+
0
@@ -352,6 +376,9 @@
false
+
+ External clock PLL locked
+
∙
@@ -361,7 +388,7 @@
-
-
+
0
@@ -381,6 +408,9 @@
false
+
+ Internal clock PLL locked
+
∙
@@ -390,7 +420,7 @@
-
-
+
0
@@ -410,6 +440,9 @@
false
+
+ Channel up
+
∙
@@ -419,7 +452,7 @@
-
-
+
0
@@ -439,6 +472,9 @@
false
+
+ Lane up
+
∙
@@ -483,12 +519,12 @@
- OperationLabel
+ TangoLabel
QLabel
- TangoLabel
+ BitLabel
QLabel