changeset 728:b71a01086740

drop selection when a new curve is focused Ignore-this: da79a73fd36ee70cea71ce76e574e46e
author Drew Perttula <drewp@bigasterisk.com>
date Thu, 14 Jun 2012 06:26:13 +0000
parents 3497a0adff67
children b5efddd80dad
files light9/curvecalc/curveview.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/light9/curvecalc/curveview.py	Thu Jun 14 06:25:46 2012 +0000
+++ b/light9/curvecalc/curveview.py	Thu Jun 14 06:26:13 2012 +0000
@@ -299,6 +299,7 @@
         dispatcher.connect(self.update_curve, "mute changed", 
                            sender=self.curve)
         dispatcher.connect(self.select_between, "select between")
+        dispatcher.connect(self.acls, "all curves lose selection")
         if self.knobEnabled:
             dispatcher.connect(self.knob_in, "knob in")
             dispatcher.connect(self.slider_in, "set key")
@@ -319,6 +320,11 @@
 
         self.dragging_dots = False
         self.selecting = False
+
+    def acls(self, butNot):
+        if butNot is self:
+            return
+        self.unselect()
         
     def rebuild(self):
         """
@@ -371,11 +377,18 @@
         print "   %s on %s" % (event, w)
         
     def onFocusIn(self, *args):
+        dispatcher.send("all curves lose selection", butNot=self)
+
         self.widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red"))
 
     def onFocusOut(self, widget=None, event=None):
         self.widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("gray30"))
 
+        # you'd think i'm unselecting when we lose focus, but we also
+        # lose focus when the user moves off the toplevel window, and
+        # that's not a time to forget the selection. See the 'all
+        # curves lose selection' signal for the fix.
+
     def onKeyPress(self, widget, event):
         if event.string in list('12345'):
             x = int(event.string)
@@ -1052,6 +1065,7 @@
     def takeFocus(self, *args):
         """the whole curveset's eventbox is what gets the focus, currently, so
         keys like 'c' can work in it"""
+        dispatcher.send("all curves lose selection")
         self.curvesVBox.get_parent().grab_focus()
 
     def onKeyPress(self, widget, event):