From fcc06834bcd56464182abdf4b82593b16488fd80 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 29 Aug 2006 16:29:56 +0200 Subject: [PATCH] Hook up activity activation --- shell/home/HomeGroup.py | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/shell/home/HomeGroup.py b/shell/home/HomeGroup.py index 99a4a0ce..35f83c21 100644 --- a/shell/home/HomeGroup.py +++ b/shell/home/HomeGroup.py @@ -5,8 +5,6 @@ import wnck from sugar.canvas.IconItem import IconItem from sugar.canvas.IconColor import IconColor from home.DonutItem import DonutItem -from home.DonutItem import PieceItem -from home.DonutItem import PieceIcon import sugar.conf import Theme @@ -17,8 +15,9 @@ class TasksItem(DonutItem): self._items = {} - shell.connect('activity_opened', self.__activity_opened_cb) - shell.connect('activity_closed', self.__activity_closed_cb) + self._shell = shell + self._shell.connect('activity_opened', self.__activity_opened_cb) + self._shell.connect('activity_closed', self.__activity_closed_cb) def __activity_opened_cb(self, shell, activity): self._add(activity) @@ -34,17 +33,16 @@ class TasksItem(DonutItem): def _add(self, activity): icon_name = activity.get_icon_name() icon_color = activity.get_icon_color() - item = self.add_piece(100 / 8, icon_name, icon_color) - # FIXME This really sucks. Fix goocanvas event handling. - item.set_data('activity', activity) - item.get_icon().set_data('activity', activity) + item = self.add_piece(100 / 8, icon_name, icon_color) + item.get_icon().connect('clicked', + self.__activity_icon_clicked_cb, + activity) self._items[activity.get_id()] = item -class Background(goocanvas.Group): - def __init__(self): - goocanvas.Group.__init__(self) + def __activity_icon_clicked_cb(self, item, activity): + activity.present() class HomeGroup(goocanvas.Group): WIDTH = 1200.0 @@ -83,17 +81,3 @@ class HomeGroup(goocanvas.Group): def __theme_changed_cb(self, theme): color = self._theme.get_home_activities_color() self._home_rect.set_property("fill-color", color) - - -# def __item_view_created_cb(self, view, item_view, item): -# if isinstance(item, PieceItem) or \ -# isinstance(item, PieceIcon): -# item_view.connect("button_press_event", -# self.__task_button_press_cb) -# -# def __activity_button_press_cb(self, view, target, event, activity_id): -# self._shell.start_activity(activity_id) -# -# def __task_button_press_cb(self, view, target, event): -# activity = view.get_item().get_data('activity') -# activity.present()