diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-22 21:51:24 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-22 21:51:24 (GMT) |
commit | 6756c00917fec4892444fa8dfd70dee99c99f291 (patch) | |
tree | 5c2b077f3064bf4e27bc8d250b5e067f64121d56 /sugar/graphics/popup.py | |
parent | 7ef6283ac4b7833982d864a92992efa188546238 (diff) |
Added tooltips to CanvasIcon and implement popup positioning in the Frame.
Diffstat (limited to 'sugar/graphics/popup.py')
-rw-r--r-- | sugar/graphics/popup.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sugar/graphics/popup.py b/sugar/graphics/popup.py index 09a1fe2..5c63b6e 100644 --- a/sugar/graphics/popup.py +++ b/sugar/graphics/popup.py @@ -30,20 +30,21 @@ class Popup(hippo.CanvasBox, hippo.CanvasItem): def __init__(self): hippo.CanvasBox.__init__(self) - self._window = None + self._visible = False + self._window = hippo.CanvasWindow(gtk.WINDOW_POPUP) + self._window.set_root(self) self.connect('button-press-event', self._button_press_event_cb) def popup(self, x, y): - if not self._window: - self._window = hippo.CanvasWindow(gtk.WINDOW_POPUP) + if not self._visible: self._window.move(x, y) - self._window.set_root(self) self._window.show() + self._visible = True def popdown(self): - if self._window: - self._window.destroy() - self._window = None + if self._visible: + self._window.hide() + self._visible = False def _button_press_event_cb(self, menu, event): self.emit('action-completed') |