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.
This commit is contained in:
Marco Pesenti Gritti 2008-04-20 04:11:24 +02:00
parent f24bdaa7d7
commit 75e636ef06
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,6 @@ import hippo
import cairo import cairo
from sugar.graphics.xocolor import XoColor from sugar.graphics.xocolor import XoColor
from sugar.graphics.palette import Palette, CanvasInvoker
from sugar.util import LRU from sugar.util import LRU
_BADGE_SIZE = 0.45 _BADGE_SIZE = 0.45
@ -533,6 +532,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
return self._palette return self._palette
def set_palette(self, palette): def set_palette(self, palette):
from sugar.graphics.palette import CanvasInvoker
if self._palette is not None: if self._palette is not None:
self._palette.props.invoker = None self._palette.props.invoker = None
self._palette = palette self._palette = palette
@ -540,6 +541,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
self._palette.props.invoker = CanvasInvoker(self) self._palette.props.invoker = CanvasInvoker(self)
def set_tooltip(self, text): def set_tooltip(self, text):
from sugar.graphics.palette import Palette
self.set_palette(Palette(text)) self.set_palette(Palette(text))
palette = property(get_palette, set_palette) palette = property(get_palette, set_palette)

View File

@ -98,7 +98,7 @@ class MouseSpeedDetector(gobject.GObject):
def _get_mouse_position(self): def _get_mouse_position(self):
display = gtk.gdk.display_get_default() display = gtk.gdk.display_get_default()
return display.get_pointer()[1:2] return display.get_pointer()[1:3]
def _detect_motion(self): def _detect_motion(self):
oldx, oldy = self._mouse_pos oldx, oldy = self._mouse_pos
@ -737,7 +737,7 @@ class Invoker(gobject.GObject):
if self._cursor_x == -1 or self._cursor_y == -1: if self._cursor_x == -1 or self._cursor_y == -1:
display = gtk.gdk.display_get_default() 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_x = x
self._cursor_y = y self._cursor_y = y