else: model.setData(status_index, QString(node_status['out']))
model.emit(SIGNAL("dataChanged(QModelIndex, QModelIndex)"), hostname_index, hostname_index)
-
+
+ def currentChanged(self, current, previous):
+ model = current.model()
+ hostname_index = model.index(current.row(), 1, current.parent())
+ hostname_data = hostname_index.data().toString()
+ self.emit(SIGNAL('hostnameClicked(QString)'), hostname_data)
+
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)
self.connect(refresh, SIGNAL('clicked()'), self.refresh)
self.connect(submit, SIGNAL('clicked()'), self.submit)
self.connect(searchbox, SIGNAL('textChanged(QString)'), self.filter)
- self.connect(self.process, SIGNAL('readyReadStandardOutput()'), self.processOutputReady)
- self.connect(self.process, SIGNAL('readyReadStandardError()'), self.processOutputReady)
+ self.connect(self.nodeView, SIGNAL('hostnameClicked(QString)'),
+ self.nodeSelectionChanged)
self.updateView()
- def processOutputReady(self):
- self.parent().logWindow.setText(self.process.readOutput())
-
def submitFinished(self):
self.setStatus("<font color='green'>Slice data submitted.</font>")
QTimer.singleShot(1000, self.refresh)
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.connect(self.process, SIGNAL('finished()'), self.submitFinished)
self.process.applyRSpec(rspec)
- self.setStatus("Sending slice data (RSpec). This may take some time...")
+ self.setStatus("Sending slice data (RSpec). This will take some time...")
def refresh(self):
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.setStatus("Updating slice data. This will take some time...")
def updateView(self):
global already_in_nodes
self.nodeView.expandAll()
self.nodeView.resizeColumnToContents(1)
+ def updateSliceName(self):
+ self.slicename.setText("Slice : %s" % (config.getSlice() or "None"))
+
+ def nodeSelectionChanged(self, hostname):
+ self.parent().nodeSelectionChanged(hostname)
class MainScreen(SfaScreen):
def __init__(self, parent):
slice = SliceWidget(self)
self.init(slice, "Main Window", "OneLab Federation GUI")
+
+ def rspecUpdated(self):
+ self.mainwin.rspecWindow.updateView()
+
+ def configurationChanged(self):
+ self.widget.updateSliceName()
+ self.widget.updateView()
+ self.mainwin.rspecWindow.updateView()
+
+ def nodeSelectionChanged(self, hostname):
+ self.mainwin.nodeSelectionChanged(hostname)