diff --git a/config/solaris.json b/config/solaris.json
index 8789e3c..f615a2f 100644
--- a/config/solaris.json
+++ b/config/solaris.json
@@ -18,8 +18,8 @@
"units": {
},
"settings": {
- "x": "01",
- "y": "07",
+ "x": ["01", "03", "05", "07", "09", "11"],
+ "y": ["02", "04", "06", "08", "10", "12"],
"global_orbit": "10",
"global_magnet": "10"
}
diff --git a/mainwindow.py b/mainwindow.py
index 704906b..5b4021f 100644
--- a/mainwindow.py
+++ b/mainwindow.py
@@ -12,6 +12,7 @@ from threads import ThreadWrapper
from grouping import GroupingWindow
from seroutput import SERWindow
+from statuswidget import StatusWidget
base_dir = os.path.dirname(os.path.realpath(__file__))
@@ -35,6 +36,12 @@ class MainWindow(QtGui.QWidget):
self.grouping = GroupingWindow(self)
self.ser_output = SERWindow(self)
+ self.x_list_layout = QtGui.QVBoxLayout()
+ self.XFrame.setLayout(self.x_list_layout)
+
+ self.y_list_layout = QtGui.QVBoxLayout()
+ self.YFrame.setLayout(self.y_list_layout)
+
self.connect(self.FOFBONButton, QtCore.SIGNAL("clicked()"),
lambda: self.send_tim_event("EVG", magic_numbers.EventID.FOFB_ON)
)
@@ -54,32 +61,6 @@ class MainWindow(QtGui.QWidget):
self.connect(self.GroupingButton, QtCore.SIGNAL("clicked()"), self.grouping.show)
self.connect(self.SERButton, QtCore.SIGNAL("clicked()"), self.ser_output.show)
- self.connect(self.XInterlockResetButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("x", "FOFBIlkReset")
- )
- self.connect(self.XReconnectButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("x", "FOFBReconnect")
- )
- self.connect(self.XResetPIButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("x", "FOFBPIReset")
- )
- self.connect(self.XSaturationResetButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("x", "FOFBSaturationReset")
- )
-
- self.connect(self.YInterlockResetButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("y", "FOFBIlkReset")
- )
- self.connect(self.YReconnectButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("y", "FOFBReconnect")
- )
- self.connect(self.YResetPIButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("y", "FOFBPIReset")
- )
- self.connect(self.YSaturationResetButton, QtCore.SIGNAL("clicked()"),
- lambda: self.execute_ireg_command_on_axis("y", "FOFBSaturationReset")
- )
-
self.update_timer = QtCore.QTimer()
self.connect(self.update_timer, QtCore.SIGNAL("timeout()"), self.update)
@@ -92,38 +73,6 @@ class MainWindow(QtGui.QWidget):
def setModel(self):
self.EVGStateLabel.setModel("EVG")
- self.XStateLabel.setModel(self.settings["x"])
- self.XInterlockLabel.setModel(self.settings["x"], "FOFBIlk")
- self.XIDLabel.setText(self.settings["x"])
- self.XFOFBStateLabel.setModel(self.settings["x"], "FOFBState")
- self.XFOFBStateLabel.setColorMap(cm.FOFB_STATE)
- # self.XBuffersLabel.setModel()
-
- self.XS1Label.setModel(self.settings["x"], "FOFBSaturation", 0)
- self.XS1Label.setColorMap(cm.RED_BOOL)
- self.XS2Label.setModel(self.settings["x"], "FOFBSaturation", 1)
- self.XS2Label.setColorMap(cm.RED_BOOL)
- self.XS3Label.setModel(self.settings["x"], "FOFBSaturation", 2)
- self.XS3Label.setColorMap(cm.RED_BOOL)
- self.XS4Label.setModel(self.settings["x"], "FOFBSaturation", 3)
- self.XS4Label.setColorMap(cm.RED_BOOL)
-
- self.YStateLabel.setModel(self.settings["y"])
- self.YInterlockLabel.setModel(self.settings["y"], "FOFBIlk")
- self.YIDLabel.setText(self.settings["y"])
- self.YFOFBStateLabel.setModel(self.settings["y"], "FOFBState")
- self.YFOFBStateLabel.setColorMap(cm.FOFB_STATE)
- # self.YBuffersLabel.setModel()
-
- self.YS1Label.setModel(self.settings["y"], "FOFBSaturation", 0)
- self.YS1Label.setColorMap(cm.RED_BOOL)
- self.YS2Label.setModel(self.settings["y"], "FOFBSaturation", 1)
- self.YS2Label.setColorMap(cm.RED_BOOL)
- self.YS3Label.setModel(self.settings["y"], "FOFBSaturation", 2)
- self.YS3Label.setColorMap(cm.RED_BOOL)
- self.YS4Label.setModel(self.settings["y"], "FOFBSaturation", 3)
- self.YS4Label.setColorMap(cm.RED_BOOL)
-
def start(self, fn, config=None):
ThreadWrapper(self.load, args=(fn, config)).start()
@@ -133,6 +82,7 @@ class MainWindow(QtGui.QWidget):
# fill grouping and magnets
for dev in sorted(self.devices.keys()):
if dev.upper() != "EVG":
+ self.addLibera(dev)
self.grouping.addLibera(dev)
self.ser_output.addLibera(dev)
self.grouping.addGlobal(self.settings["global_orbit"], self.settings["global_magnet"])
@@ -177,6 +127,16 @@ class MainWindow(QtGui.QWidget):
self.cache[dev] = {}
self.cache[dev][attr] = None
+ def addLibera(self, dev):
+ print "[ INFO]: Status: add Libera %s" % dev
+ libera = StatusWidget(self, dev)
+ self.connect(self, QtCore.SIGNAL("update"), libera.update)
+ # self.liberas[dev] = libera
+ if dev in self.settings["x"]:
+ self.x_list_layout.addWidget(libera)
+ elif dev in self.settings["y"]:
+ self.y_list_layout.addWidget(libera)
+
def update(self):
print "[ INFO]: update"
try:
@@ -251,8 +211,8 @@ class MainWindow(QtGui.QWidget):
except Exception as e:
print str(e)
- def execute_ireg_command_on_axis(self, axis, cmd):
- self.execute_ireg_command(self.settings[axis], cmd)
+ # def execute_ireg_command_on_axis(self, axis, cmd):
+ # self.execute_ireg_command(self.settings[axis], cmd)
def send_tim_event(self, dev, evt):
print "[ INFO]: sw event %s/%d" % (dev, evt)
diff --git a/statuswidget.py b/statuswidget.py
new file mode 100644
index 0000000..b847a7c
--- /dev/null
+++ b/statuswidget.py
@@ -0,0 +1,53 @@
+import os
+
+from PyQt4 import QtGui, QtCore, uic
+
+from labels import cm
+
+base_dir = os.path.dirname(os.path.realpath(__file__))
+
+
+class StatusWidget(QtGui.QWidget):
+ def __init__(self, main_window, device, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ uic.loadUi("%s/ui/status.ui" % base_dir, self)
+
+ self.main_window = main_window
+ self.units = self.main_window.units
+ self.addAttribute = lambda dev, attr: self.main_window.addAttribute(dev, attr)
+
+ self.device = device
+
+ self.IDLabel.setText(device)
+
+ self.StateLabel.setModel(device)
+ self.InterlockLabel.setModel(device, "FOFBIlk")
+ self.IDLabel.setText(device)
+ self.FOFBStateLabel.setModel(device, "FOFBState")
+ self.FOFBStateLabel.setColorMap(cm.FOFB_STATE)
+ # self.BuffersLabel.setModel()
+
+ self.S1Label.setModel(device, "FOFBSaturation", 0)
+ self.S1Label.setColorMap(cm.RED_BOOL)
+ self.S2Label.setModel(device, "FOFBSaturation", 1)
+ self.S2Label.setColorMap(cm.RED_BOOL)
+ self.S3Label.setModel(device, "FOFBSaturation", 2)
+ self.S3Label.setColorMap(cm.RED_BOOL)
+ self.S4Label.setModel(device, "FOFBSaturation", 3)
+ self.S4Label.setColorMap(cm.RED_BOOL)
+
+ self.connect(self.InterlockResetButton, QtCore.SIGNAL("clicked()"),
+ lambda: self.main_window.execute_ireg_command(device, "FOFBIlkReset")
+ )
+ self.connect(self.ReconnectButton, QtCore.SIGNAL("clicked()"),
+ lambda: self.main_window.execute_ireg_command(device, "FOFBReconnect")
+ )
+ self.connect(self.ResetPIButton, QtCore.SIGNAL("clicked()"),
+ lambda: self.main_window.execute_ireg_command(device, "FOFBPIReset")
+ )
+ self.connect(self.SaturationResetButton, QtCore.SIGNAL("clicked()"),
+ lambda: self.main_window.execute_ireg_command(device, "FOFBSaturationReset")
+ )
+
+ def update(self, cache):
+ self.emit(QtCore.SIGNAL("update"), cache)
diff --git a/ui/main.ui b/ui/main.ui
index 97f0086..4698ab5 100644
--- a/ui/main.ui
+++ b/ui/main.ui
@@ -7,7 +7,7 @@
0
0
742
- 383
+ 540
@@ -308,7 +308,7 @@
QFrame::Raised
-
+
2
@@ -347,35 +347,6 @@
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
@@ -392,200 +363,13 @@
-
-
+
- QFrame::Box
+ QFrame::StyledPanel
- QFrame::Plain
+ QFrame::Raised
-
-
- 2
-
-
- 3
-
-
-
-
-
- 0
-
-
-
-
-
-
- 7
-
-
-
- Buffers
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 20
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- 7
-
-
-
- FOFB
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 20
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
-
- 13
- 75
- true
-
-
-
- 00
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Reconnect
-
-
-
- -
-
-
- Reset
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 10
- 75
- true
-
-
-
-
-
-
- QFrame::Box
-
-
- INTERLOCK
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 10
- 75
- true
-
-
-
- Status
-
-
- Qt::AlignCenter
-
-
-
-
-
@@ -603,13 +387,6 @@
2
-
-
-
-
- Reset PI
-
-
-
-
@@ -670,7 +447,7 @@
- -
+
-
@@ -690,182 +467,6 @@
- -
-
-
- QFrame::Box
-
-
- QFrame::Plain
-
-
-
- 3
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- PI controller
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Multiplication V.PI[SU.dP]
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Global orbit data P
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Multiplication SU.dP
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Reset
-
-
-
- -
-
-
-
- 10
- 75
- true
-
-
-
- Saturation
-
-
- Qt::AlignCenter
-
-
-
-
-
-
@@ -877,7 +478,7 @@
QFrame::Raised
-
+
2
@@ -916,35 +517,6 @@
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
@@ -961,200 +533,13 @@
-
-
+
- QFrame::Box
+ QFrame::StyledPanel
- QFrame::Plain
+ QFrame::Raised
-
-
- 2
-
-
- 3
-
-
-
-
-
- 0
-
-
-
-
-
-
- 7
-
-
-
- Buffers
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 20
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- 7
-
-
-
- FOFB
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 20
-
-
-
-
- 24
- 50
- false
-
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
-
- 13
- 75
- true
-
-
-
- 00
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Reconnect
-
-
-
- -
-
-
- Reset
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 10
- 75
- true
-
-
-
-
-
-
- QFrame::Box
-
-
- INTERLOCK
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 10
- 75
- true
-
-
-
- Status
-
-
- Qt::AlignCenter
-
-
-
-
-
@@ -1172,13 +557,6 @@
2
-
-
-
-
- Reset PI
-
-
-
-
@@ -1191,23 +569,6 @@
- -
-
-
-
- 10
- 75
- true
-
-
-
- Parameters
-
-
- Qt::AlignCenter
-
-
-
-
@@ -1256,167 +617,8 @@
-
-
-
- -
-
-
- QFrame::Box
-
-
- QFrame::Plain
-
-
-
- 3
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- PI controller
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Multiplication V.PI[SU.dP]
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Global orbit data P
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 41
- 25
-
-
-
-
- 24
- 50
- false
-
-
-
- Multiplication SU.dP
-
-
- ∙
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Reset
-
-
-
- -
-
+
-
+
10
@@ -1425,7 +627,7 @@
- Saturation
+ Parameters
Qt::AlignCenter
@@ -1446,21 +648,6 @@
QLabel
-
- InterlockLabel
- QLabel
-
-
-
- ArrayElementLabel
- QLabel
-
-
-
- EnumStateLabel
- QLabel
-
-
diff --git a/ui/status.ui b/ui/status.ui
new file mode 100644
index 0000000..f095302
--- /dev/null
+++ b/ui/status.ui
@@ -0,0 +1,453 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 292
+ 107
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ QFrame::Box
+
+
+ QFrame::Plain
+
+
+
+ 2
+
+
+ 2
+
+
-
+
+
+
+ 13
+ 75
+ true
+
+
+
+ 00
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Reset
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+
+ 7
+
+
+
+ FOFB
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 20
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+
+ 7
+
+
+
+ Buffers
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 20
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ -
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Reconnect
+
+
+
+ -
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Reset PI
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Reset
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 25
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ QFrame::Box
+
+
+ QFrame::Plain
+
+
+
+ 3
+
+
+ 2
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 41
+ 25
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ PI controller
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 41
+ 25
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ Global orbit data P
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 41
+ 25
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ Multiplication SU.dP
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 41
+ 25
+
+
+
+
+ 24
+ 50
+ false
+
+
+
+ Multiplication V.PI[SU.dP]
+
+
+ ∙
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 10
+ 75
+ true
+
+
+
+ Saturation
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+ 75
+ true
+
+
+
+
+
+
+ QFrame::Box
+
+
+ INTERLOCK
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+
+
+ StateLabel
+ QLabel
+
+
+
+ InterlockLabel
+ QLabel
+
+
+
+ ArrayElementLabel
+ QLabel
+
+
+
+ EnumStateLabel
+ QLabel
+
+
+
+
+
+