dogtail r370 - in trunk: . sniff



Author: zcerza
Date: Mon Jan 14 22:08:28 2008
New Revision: 370
URL: http://svn.gnome.org/viewvc/dogtail?rev=370&view=rev

Log:
* sniff/sniff, sniff/sniff.glade: Make the relation buttons only
visible when a target exists. Also prepare SniffController.showRelationTarget()
more prepared for when we add more relations to dogtail and sniff.


Modified:
   trunk/ChangeLog
   trunk/sniff/sniff
   trunk/sniff/sniff.glade

Modified: trunk/sniff/sniff
==============================================================================
--- trunk/sniff/sniff	(original)
+++ trunk/sniff/sniff	Mon Jan 14 22:08:28 2008
@@ -162,7 +162,10 @@
         self.view.expand_row(rootPath, False)
 
     def connectSignals(self):
-        self.labelerButton.connect('clicked', self.showRelationTarget)
+        self.labelerButton.connect('clicked', self.showRelationTarget, \
+                'labeler')
+        self.labeleeButton.connect('clicked', self.showRelationTarget, \
+                'labelee')
         self.view.connect('button-press-event', self.buttonPress)
         self.view.connect('row-expanded', self.rowExpanded, self.model)
         self.view.connect('row-collapsed', self.rowCollapsed)
@@ -242,13 +245,13 @@
             menu.show()
             menu.popup(None, None, None, event.button, event.time)
 
-    def showRelationTarget(self, button, *args):
-        if button == self.labelerButton:
-            target = self.getSelectedNode().labeler
-        elif button == self.labeleeButton:
-            target = self.getSelectedNode().labelee
-        else: return
-        if not target.dead: target.blink()
+    def showRelationTarget(self, button, relation, *args):
+        target = getattr(self.getSelectedNode(), relation)
+        if not target: return
+        try: target.blink()
+        except:
+            import traceback
+            traceback.print_exc()
 
     def setUpTable(self, node):
         """Generic code for setting up the table under the TreeView"""
@@ -284,10 +287,20 @@
 
         if node.labeler and not node.labeler.dead: 
             self.labelerButton.set_sensitive(True)
-        else: self.labelerButton.set_sensitive(False)
+            self.labelerButton.show()
+        #elif node.labeler and node.labeler.dead:
+        #    print "labeler is dead", node.labeler
+        else:
+            self.labelerButton.set_sensitive(False)
+            self.labelerButton.hide()
         if node.labelee and not node.labelee.dead: 
             self.labeleeButton.set_sensitive(True)
-        else: self.labeleeButton.set_sensitive(False)
+            self.labeleeButton.show()
+        #elif node.labelee and node.labelee.dead:
+        #    print "labelee is dead", node.labelee
+        else:
+            self.labeleeButton.set_sensitive(False)
+            self.labeleeButton.hide()
 
     def changeText(self, textBuffer, node):
         if node == None: return

Modified: trunk/sniff/sniff.glade
==============================================================================
--- trunk/sniff/sniff.glade	(original)
+++ trunk/sniff/sniff.glade	Mon Jan 14 22:08:28 2008
@@ -554,7 +554,7 @@
 
 		  <child>
 		    <widget class="GtkButton" id="labelerButton">
-		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
 		      <property name="can_default">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="label" translatable="yes">Labeler</property>
@@ -566,7 +566,7 @@
 
 		  <child>
 		    <widget class="GtkButton" id="labeleeButton">
-		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
 		      <property name="can_default">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="label" translatable="yes">Labelee</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]