Hook up activity activation
This commit is contained in:
parent
19178464fb
commit
fcc06834bc
@ -5,8 +5,6 @@ import wnck
|
|||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
from sugar.canvas.IconColor import IconColor
|
from sugar.canvas.IconColor import IconColor
|
||||||
from home.DonutItem import DonutItem
|
from home.DonutItem import DonutItem
|
||||||
from home.DonutItem import PieceItem
|
|
||||||
from home.DonutItem import PieceIcon
|
|
||||||
import sugar.conf
|
import sugar.conf
|
||||||
|
|
||||||
import Theme
|
import Theme
|
||||||
@ -17,8 +15,9 @@ class TasksItem(DonutItem):
|
|||||||
|
|
||||||
self._items = {}
|
self._items = {}
|
||||||
|
|
||||||
shell.connect('activity_opened', self.__activity_opened_cb)
|
self._shell = shell
|
||||||
shell.connect('activity_closed', self.__activity_closed_cb)
|
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):
|
def __activity_opened_cb(self, shell, activity):
|
||||||
self._add(activity)
|
self._add(activity)
|
||||||
@ -34,17 +33,16 @@ class TasksItem(DonutItem):
|
|||||||
def _add(self, activity):
|
def _add(self, activity):
|
||||||
icon_name = activity.get_icon_name()
|
icon_name = activity.get_icon_name()
|
||||||
icon_color = activity.get_icon_color()
|
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 = self.add_piece(100 / 8, icon_name, icon_color)
|
||||||
item.set_data('activity', activity)
|
item.get_icon().connect('clicked',
|
||||||
item.get_icon().set_data('activity', activity)
|
self.__activity_icon_clicked_cb,
|
||||||
|
activity)
|
||||||
|
|
||||||
self._items[activity.get_id()] = item
|
self._items[activity.get_id()] = item
|
||||||
|
|
||||||
class Background(goocanvas.Group):
|
def __activity_icon_clicked_cb(self, item, activity):
|
||||||
def __init__(self):
|
activity.present()
|
||||||
goocanvas.Group.__init__(self)
|
|
||||||
|
|
||||||
class HomeGroup(goocanvas.Group):
|
class HomeGroup(goocanvas.Group):
|
||||||
WIDTH = 1200.0
|
WIDTH = 1200.0
|
||||||
@ -83,17 +81,3 @@ class HomeGroup(goocanvas.Group):
|
|||||||
def __theme_changed_cb(self, theme):
|
def __theme_changed_cb(self, theme):
|
||||||
color = self._theme.get_home_activities_color()
|
color = self._theme.get_home_activities_color()
|
||||||
self._home_rect.set_property("fill-color", 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()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user