Fix tooltip popup.

This commit is contained in:
Tomeu Vizoso 2007-03-16 12:20:03 +01:00
parent e8a21bf6a0
commit 8a88de864b

View File

@ -355,8 +355,9 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
return None return None
def show_popup(self): def show_popup(self):
popup = self.get_popup() if not self._popup:
if not popup: self._popup = self.get_popup()
if not self._popup:
return return
popup_context = self.get_popup_context() popup_context = self.get_popup_context()
@ -364,7 +365,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
[x, y] = [None, None] [x, y] = [None, None]
if popup_context: if popup_context:
try: try:
[x, y] = popup_context.get_position(self, popup) [x, y] = popup_context.get_position(self, self._popup)
except NotImplementedError: except NotImplementedError:
pass pass
@ -374,23 +375,21 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
# TODO: Any better place to do this? # TODO: Any better place to do this?
[min_width, natural_width] = self.get_width_request() [min_width, natural_width] = self.get_width_request()
[pop_min_width, pop_natural_width] = popup.get_width_request() [pop_min_width, pop_natural_width] = self._popup.get_width_request()
popup.props.box_width = max(pop_min_width, min_width) self._popup.props.box_width = max(pop_min_width, min_width)
[width, height] = self.get_allocation() [width, height] = self.get_allocation()
y += height y += height
position = [x, y] position = [x, y]
popup.popup(x, y) self._popup.popup(x, y)
popup.connect('motion-notify-event', self._popup.connect('motion-notify-event',
self.popup_motion_notify_event_cb) self.popup_motion_notify_event_cb)
popup.connect('action-completed', self._popup.connect('action-completed',
self._popup_action_completed_cb) self._popup_action_completed_cb)
if popup_context: if popup_context:
popup_context.popped_up(popup) popup_context.popped_up(self._popup)
self._popup = popup
def hide_popup(self): def hide_popup(self):
if self._popup: if self._popup: