# HG changeset patch # User Drew Perttula # Date 1339655173 0 # Node ID b71a01086740f0c340ac677b4ea78e832a9dbdcd # Parent 3497a0adff67dc35e1533a9cb4c6c0d37208ce19 drop selection when a new curve is focused Ignore-this: da79a73fd36ee70cea71ce76e574e46e diff -r 3497a0adff67 -r b71a01086740 light9/curvecalc/curveview.py --- 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):