[sugar] [PATCH] Reset activity icons when clicked/launched (#7273, #7274)

Eben Eliason eben.eliason at gmail.com
Fri Jun 20 19:14:31 EDT 2008


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).

---
 src/view/home/activitieslist.py |   11 ++++++++++-
 src/view/home/favoritesview.py  |    8 +++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/view/home/activitieslist.py b/src/view/home/activitieslist.py
index 5dab09d..8086b7b 100644
--- a/src/view/home/activitieslist.py
+++ b/src/view/home/activitieslist.py
@@ -110,6 +110,9 @@ class ActivityIcon(CanvasIcon):
                             fill_color=style.COLOR_TRANSPARENT.get_svg())
         self._activity_info = activity_info
         self.connect('hovering-changed', self.__hovering_changed_event_cb)
+        self.connect('button-release-event', self.__button_release_event_cb)
+
+        self._palette = None

     def __hovering_changed_event_cb(self, icon, event):
         if event:
@@ -118,8 +121,14 @@ class ActivityIcon(CanvasIcon):
             self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg()
             self.props.fill_color = style.COLOR_TRANSPARENT.get_svg()

+    def __button_release_event_cb(self, icon, event):
+        self._palette.popdown(immediate=True)
+        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)
+        self._palette = ActivityPalette(self._activity_info)
+        return self._palette

 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..6e56db5 100644
--- a/src/view/home/favoritesview.py
+++ b/src/view/home/favoritesview.py
@@ -274,8 +274,11 @@ class ActivityIcon(CanvasIcon):
         self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg()
         self.props.fill_color = style.COLOR_TRANSPARENT.get_svg()

+        self._palette = None
+
     def create_palette(self):
-        return ActivityPalette(self._activity_info)
+        self._palette = ActivityPalette(self._activity_info)
+        return self._palette

     def __hovering_changed_event_cb(self, icon, event):
         if event:
@@ -285,6 +288,9 @@ class ActivityIcon(CanvasIcon):
             self.props.fill_color = style.COLOR_TRANSPARENT.get_svg()

     def __button_release_event_cb(self, icon, event):
+        self._palette.popdown(immediate=True)
+        self.props.stroke_color = style.COLOR_BUTTON_GREY.get_svg()
+        self.props.fill_color = style.COLOR_TRANSPARENT.get_svg()
         view.Shell.get_instance().start_activity(self._activity_info.bundle_id)

     def get_bundle_id(self):
--


More information about the Sugar mailing list