use currentChanged slot instead of mouseReleaseEvent
[sface.git] / sface / screens / mainscreen.py
index a47ba3c..96b5728 100644 (file)
@@ -46,6 +46,13 @@ class NodeView(QTreeView):
             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):
@@ -314,14 +321,11 @@ class SliceWidget(QWidget):
         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)
@@ -445,6 +449,8 @@ class SliceWidget(QWidget):
     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):
@@ -457,3 +463,5 @@ class MainScreen(SfaScreen):
         self.widget.updateSliceName()
         self.widget.updateView()
 
+    def nodeSelectionChanged(self, hostname):
+        self.mainwin.nodeSelectionChanged(hostname)