diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-07-09 21:23:08 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-07-09 21:23:08 (GMT) |
commit | c27ffb837af1c3e16d6be15f3df79e38e96661dd (patch) | |
tree | 75b7dd003a3351dbf7698372d03815e04d593a9e | |
parent | 1203a8db269ed0a4c5c11b858092b8e3531f7f9d (diff) |
cleaned up some event-handling... started working on hover support
-rw-r--r-- | src/jarabe/desktop/favoritesview.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py index 4c48faf..12b9dcf 100644 --- a/src/jarabe/desktop/favoritesview.py +++ b/src/jarabe/desktop/favoritesview.py @@ -132,13 +132,12 @@ class FavoritesContainer(gtk.Container): x = (width - my_icon_width) / 2 y = (height - my_icon_height - style.GRID_CELL_SIZE) / 2 - child_allocation = gtk.gdk.Rectangle(x, y, my_icon_width, my_icon_height) + child_allocation = gtk.gdk.Rectangle(x, y, my_icon_width, + my_icon_height) self._my_icon.size_allocate(child_allocation) # Position the current activity just below the XO icon icon_width, icon_height = self._current_activity.size_request() - logging.debug('CURRENT ACTIVITY SIZE REQUEST: %d %d', - icon_width, icon_height) x = (width - icon_width) / 2 y = (height - my_icon_height - style.GRID_CELL_SIZE) / 2 + \ my_icon_height + style.DEFAULT_PADDING @@ -442,8 +441,8 @@ class ActivityIcon(CanvasIcon): self._hovering = False self._resume_mode = True - self.connect('enter-notify-event', self.__hovering_changed_event_cb) - self.connect('leave-notify-event', self.__hovering_changed_event_cb) + self.connect('enter-notify-event', self.__enter_notify_event_cb) + self.connect('leave-notify-event', self.__leave_notify_event_cb) self.connect('button-release-event', self.__button_release_event_cb) datastore.updated.connect(self.__datastore_listener_updated_cb) @@ -512,9 +511,20 @@ class ActivityIcon(CanvasIcon): def __palette_entry_activate_cb(self, palette, metadata): self._resume(metadata) - def __hovering_changed_event_cb(self, icon, hovering): - self._hovering = hovering - self.emit_paint_needed(0, 0, -1, -1) + # FIXME: Not sure how the hovering was handled in the hippo + # version, but this is an attempt to get hover palettes to work + # but where does self.palette get created? + def __enter_notify_event_cb(self, icon, event): + self._hovering = True + if self.palette is not None: + self.palette.popup() + + # This seems to do the right thing vis-a-vis the palette invoked + # from right-click + def __leave_notify_event_cb(self, icon, event): + self._hovering = False + if self.palette is not None: + self.palette.popdown() def do_paint_above_children(self, cr, damaged_box): if not self._hovering: @@ -659,10 +669,8 @@ class CurrentActivityIcon(CanvasIcon): def _update(self): self.props.file_name = self._home_activity.get_icon_path() - logging.debug('CURRENT_ACTIVITY PATH %s', - self._home_activity.get_icon_path()) self.props.xo_color = self._home_activity.get_icon_color() - # self.props.size = style.STANDARD_ICON_SIZE + self.props.size = style.STANDARD_ICON_SIZE if self.palette is not None: self.palette.destroy() |