Fix that several palettes are not hooked up to the same button #3293

This commit is contained in:
Simon Schampijer 2007-09-17 23:42:17 +02:00
parent 44ffef5f67
commit 8ae1f9aad8
7 changed files with 21 additions and 3 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #3293 Fix that several palettes are not hooked up to the same button (erikos)
* #3514 Remove invite when the activiy disappear from the mesh. (cassidy) * #3514 Remove invite when the activiy disappear from the mesh. (cassidy)
* #3003 Make image drags on the clipboard work consistently. (marco) * #3003 Make image drags on the clipboard work consistently. (marco)

View File

@ -480,6 +480,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
return self._palette return self._palette
def set_palette(self, palette): def set_palette(self, palette):
if self._palette is not None:
self._palette.props.invoker = None
self._palette = palette self._palette = palette
if not self._palette.props.invoker: if not self._palette.props.invoker:
self._palette.props.invoker = CanvasInvoker(self) self._palette.props.invoker = CanvasInvoker(self)

View File

@ -192,9 +192,16 @@ class Palette(gtk.Window):
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'invoker': if pspec.name == 'invoker':
if self._invoker is not None:
self._invoker.disconnect(self._enter_invoker_hid)
self._invoker.disconnect(self._leave_invoker_hid)
self._invoker = value self._invoker = value
self._invoker.connect('mouse-enter', self._invoker_mouse_enter_cb) if value is not None:
self._invoker.connect('mouse-leave', self._invoker_mouse_leave_cb) self._enter_invoker_hid = self._invoker.connect(
'mouse-enter', self._invoker_mouse_enter_cb)
self._leave_invoker_hid = self._invoker.connect(
'mouse-leave', self._invoker_mouse_leave_cb)
else: else:
raise AssertionError raise AssertionError

View File

@ -41,6 +41,8 @@ class RadioToolButton(gtk.RadioToolButton):
return self._palette return self._palette
def set_palette(self, palette): def set_palette(self, palette):
if self._palette is not None:
self._palette.props.invoker = None
self._palette = palette self._palette = palette
self._palette.props.invoker = ToolInvoker(self.child) self._palette.props.invoker = ToolInvoker(self.child)

View File

@ -37,6 +37,8 @@ class ToggleToolButton(gtk.ToggleToolButton):
return self._palette return self._palette
def set_palette(self, palette): def set_palette(self, palette):
if self._palette is not None:
self._palette.props.invoker = None
self._palette = palette self._palette = palette
self._palette.props.invoker = ToolInvoker(self.child) self._palette.props.invoker = ToolInvoker(self.child)

View File

@ -41,6 +41,8 @@ class ToolButton(gtk.ToolButton):
return self._palette return self._palette
def set_palette(self, palette): def set_palette(self, palette):
if self._palette is not None:
self._palette.props.invoker = None
self._palette = palette self._palette = palette
self._palette.props.invoker = ToolInvoker(self.child) self._palette.props.invoker = ToolInvoker(self.child)

View File

@ -216,6 +216,8 @@ class _IconWidget(gtk.EventBox):
gtk.EventBox.do_expose_event(self, event) gtk.EventBox.do_expose_event(self, event)
def set_palette(self, palette): def set_palette(self, palette):
if self._palette is not None:
self._palette.props.invoker = None
self._palette = palette self._palette = palette
self._palette.props.invoker = ToolInvoker(self) self._palette.props.invoker = ToolInvoker(self)