diff options
author | Eben Eliason <eben@sugar.(none)> | 2008-06-22 02:00:17 (GMT) |
---|---|---|
committer | Eben Eliason <eben@sugar.(none)> | 2008-06-22 02:00:17 (GMT) |
commit | 7be22bf803e12dd9c18fcdfcc5cfd641b3c77e24 (patch) | |
tree | 7b6f2a02c9a3db00c70ce0a2da2dd572e6edd660 /src | |
parent | 5e6a4a5a5f73f0dba24e7b390ec781d799280d8a (diff) |
Reset activity icons when clicked/launched (#7273, #7274)
The act of clicking on an activity icon in Home to launch it
switches the view to the launcher, eliminating the expected
hovering-changed event (leave). This commit hides the palette
instantly (it used to remain visible in the launcher) and
un-colors the icon (which used to remain colored when returning
to Home).
Diffstat (limited to 'src')
-rw-r--r-- | src/view/home/activitieslist.py | 31 | ||||
-rw-r--r-- | src/view/home/favoritesview.py | 22 |
2 files changed, 35 insertions, 18 deletions
diff --git a/src/view/home/activitieslist.py b/src/view/home/activitieslist.py index 5dab09d..e542859 100644 --- a/src/view/home/activitieslist.py +++ b/src/view/home/activitieslist.py @@ -105,22 +105,33 @@ class ActivitiesList(gtk.ScrolledWindow): class ActivityIcon(CanvasIcon): def __init__(self, activity_info): CanvasIcon.__init__(self, size=style.STANDARD_ICON_SIZE, cache=True, - file_name=activity_info.icon, - stroke_color=style.COLOR_BUTTON_GREY.get_svg(), - fill_color=style.COLOR_TRANSPARENT.get_svg()) + file_name=activity_info.icon) self._activity_info = activity_info + self._uncolor() self.connect('hovering-changed', self.__hovering_changed_event_cb) - - def __hovering_changed_event_cb(self, icon, event): - if event: - self.props.xo_color = profile.get_color() - else: - self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg() - self.props.fill_color = style.COLOR_TRANSPARENT.get_svg() + self.connect('button-release-event', self.__button_release_event_cb) def create_palette(self): return ActivityPalette(self._activity_info) + def _color(self): + self.props.xo_color = profile.get_color() + + def _uncolor(self): + self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg() + self.props.fill_color = style.COLOR_TRANSPARENT.get_svg() + + def __hovering_changed_event_cb(self, icon, hovering): + if hovering: + self._color() + else: + self._uncolor() + + def __button_release_event_cb(self, icon, event): + self.palette.popdown(immediate=True) + self._uncolor() + + class ActivityEntry(hippo.CanvasBox, hippo.CanvasItem): __gtype_name__ = 'SugarActivityEntry' diff --git a/src/view/home/favoritesview.py b/src/view/home/favoritesview.py index a6e2268..1c948e8 100644 --- a/src/view/home/favoritesview.py +++ b/src/view/home/favoritesview.py @@ -268,23 +268,29 @@ class ActivityIcon(CanvasIcon): def __init__(self, activity_info): CanvasIcon.__init__(self, cache=True, file_name=activity_info.icon) self._activity_info = activity_info + self._uncolor() self.connect('hovering-changed', self.__hovering_changed_event_cb) self.connect('button-release-event', self.__button_release_event_cb) - self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg() - self.props.fill_color = style.COLOR_TRANSPARENT.get_svg() - def create_palette(self): return ActivityPalette(self._activity_info) - def __hovering_changed_event_cb(self, icon, event): - if event: - self.props.xo_color = get_profile().color + def _color(self): + self.props.xo_color = get_profile().color + + def _uncolor(self): + self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg() + self.props.fill_color = style.COLOR_TRANSPARENT.get_svg() + + def __hovering_changed_event_cb(self, icon, hovering): + if hovering: + self._color() else: - self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg() - self.props.fill_color = style.COLOR_TRANSPARENT.get_svg() + self._uncolor() def __button_release_event_cb(self, icon, event): + self.palette.popdown(immediate=True) + self._uncolor() view.Shell.get_instance().start_activity(self._activity_info.bundle_id) def get_bundle_id(self): |