model.emit(SIGNAL("dataChanged(QModelIndex, QModelIndex)"), hostname_index, hostname_index)
-
class NodeNameDelegate(QStyledItemDelegate):
def __init__(self, parent):
painter.restore()
+
class TreeItem:
def __init__(self, data, parent=None):
self.parentItem = parent
return ret
-
class SliceWidget(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)
self.network_names = []
self.process = SfiProcess(self)
- slicename = QLabel ("Slice : %s"%(config.getSlice() or "None"),self)
- slicename.setScaledContents(False)
+ self.slicename = QLabel("", self)
+ self.updateSliceName()
+ self.slicename.setScaledContents(False)
searchlabel = QLabel ("Search: ", self)
searchlabel.setScaledContents(False)
searchbox = QLineEdit(self)
searchbox.setAttribute(Qt.WA_MacShowFocusRect, 0)
toplayout = QHBoxLayout()
- toplayout.addWidget(slicename, 0, Qt.AlignLeft)
+ toplayout.addWidget(self.slicename, 0, Qt.AlignLeft)
toplayout.addStretch()
toplayout.addWidget(searchlabel, 0, Qt.AlignRight)
toplayout.addWidget(searchbox, 0, Qt.AlignRight)
def refreshFinished(self):
self.setStatus("<font color='green'>Slice data updated.</font>", timeout=5000)
self.updateView()
+ self.parent().signalAll("rspecUpdated")
def readSliceRSpec(self):
rspec_file = config.getSliceRSpecFile()
self.disconnect(self.process, SIGNAL('finished()'), self.submitFinished)
self.connect(self.process, SIGNAL('finished()'), self.refreshFinished)
- self.connect(self.process, SIGNAL('finished()'), self.parent().rspecUpdated)
self.process.getRSpecFromSM()
self.setStatus("Updating slice data. This may take some time...")
self.nodeView.expandAll()
self.nodeView.resizeColumnToContents(1)
+ def updateSliceName(self):
+ self.slicename.setText("Slice : %s" % (config.getSlice() or "None"))
+
class MainScreen(SfaScreen):
def __init__(self, parent):
slice = SliceWidget(self)
self.init(slice, "Main Window", "OneLab Federation GUI")
+
+ def configurationChanged(self):
+ self.widget.updateSliceName()
+ self.widget.updateView()
+
from PyQt4.QtGui import *
class SfaScreen(QWidget):
+ instances = []
+
def __init__(self, parent):
+ SfaScreen.instances.append(self)
QWidget.__init__(self, parent)
self.mainwin = parent
self.name = self.title = self.widget = None
+ def __del__(self):
+ SfaScreen.instances.remove(self)
+
def init(self, widget, name, title):
if self.widget:
sys.stderr.write("Screen is already initialized\n")
def setStatus(self, msg, timeout):
self.mainwin.setStatus(msg, timeout)
+ def signalAll(self, action):
+ for i in SfaScreen.instances:
+ getattr(i, action)()
+
def rspecUpdated(self):
pass
+
+ def configurationChanged(self):
+ pass