diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2008-04-20 02:11:24 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2008-04-20 02:11:24 (GMT) |
commit | 75e636ef0605c9a86af64e302934330ff00f9aed (patch) | |
tree | 67c82faab674f154491d9d3ccb2bdc12034697f4 /sugar | |
parent | f24bdaa7d7a21a30cf561a817a0c50f0708a55b8 (diff) |
Work around circular dep between Icon and Palette. I don't
like it though, we should get rid of the dep.
Fix palette bug which I introduced with the pylint changes.
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/graphics/icon.py | 5 | ||||
-rw-r--r-- | sugar/graphics/palette.py | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sugar/graphics/icon.py b/sugar/graphics/icon.py index 93c8bf7..2bd73c8 100644 --- a/sugar/graphics/icon.py +++ b/sugar/graphics/icon.py @@ -25,7 +25,6 @@ import hippo import cairo from sugar.graphics.xocolor import XoColor -from sugar.graphics.palette import Palette, CanvasInvoker from sugar.util import LRU _BADGE_SIZE = 0.45 @@ -533,6 +532,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): return self._palette def set_palette(self, palette): + from sugar.graphics.palette import CanvasInvoker + if self._palette is not None: self._palette.props.invoker = None self._palette = palette @@ -540,6 +541,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): self._palette.props.invoker = CanvasInvoker(self) def set_tooltip(self, text): + from sugar.graphics.palette import Palette + self.set_palette(Palette(text)) palette = property(get_palette, set_palette) diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index bcc93be..e2dfd21 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -98,7 +98,7 @@ class MouseSpeedDetector(gobject.GObject): def _get_mouse_position(self): display = gtk.gdk.display_get_default() - return display.get_pointer()[1:2] + return display.get_pointer()[1:3] def _detect_motion(self): oldx, oldy = self._mouse_pos @@ -737,7 +737,7 @@ class Invoker(gobject.GObject): if self._cursor_x == -1 or self._cursor_y == -1: display = gtk.gdk.display_get_default() - x, y = display.get_pointer()[1:2] + x, y = display.get_pointer()[1:3] self._cursor_x = x self._cursor_y = y |