Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Williams <dcbw@localhost.localdomain>2006-08-23 14:41:12 (GMT)
committer Dan Williams <dcbw@localhost.localdomain>2006-08-23 14:41:12 (GMT)
commite366753ab0b3c2f21109859745fd60b927b9504c (patch)
tree8a6f0281f64ab425bca8cb0f29a184df7c1d67cf /shell
parent4eb5a6127621c727372e111a2d9450afc438caca (diff)
Make theme color accessors more descriptive; add mesh view zoom rects
Diffstat (limited to 'shell')
-rw-r--r--shell/home/FriendsView.py14
-rw-r--r--shell/home/HomeView.py10
-rw-r--r--shell/home/MeshView.py26
-rw-r--r--shell/home/Theme.py11
4 files changed, 44 insertions, 17 deletions
diff --git a/shell/home/FriendsView.py b/shell/home/FriendsView.py
index 29418b7..2d6fb47 100644
--- a/shell/home/FriendsView.py
+++ b/shell/home/FriendsView.py
@@ -15,18 +15,18 @@ class Model(goocanvas.CanvasModelSimple):
root = self.get_root_item()
- color = self._theme.get_home_colors()[2]
+ color = self._theme.get_home_mesh_color()
self._mesh_rect = goocanvas.Rect(width=1200, height=900,
fill_color=color)
root.add_child(self._mesh_rect)
- color = self._theme.get_home_colors()[1]
+ color = self._theme.get_home_friends_color()
self._friends_rect = goocanvas.Rect(x=100, y=100, width=1000, height=700,
line_width=0, fill_color=color,
radius_x=30, radius_y=30)
root.add_child(self._friends_rect)
- color = self._theme.get_home_colors()[0]
+ color = self._theme.get_home_activities_color()
self._home_rect = goocanvas.Rect(x=400, y=300, width=400, height=300,
line_width=0, fill_color=color,
radius_x=30, radius_y=30)
@@ -37,12 +37,12 @@ class Model(goocanvas.CanvasModelSimple):
data_model.connect('friend-added', self.__friend_added_cb)
- def __theme_changed_cb(self, theme, colors):
- color = self._theme.get_home_colors()[0]
+ def __theme_changed_cb(self, theme):
+ color = self._theme.get_home_activities_color()
self._home_rect.set_property("fill-color", color)
- color = self._theme.get_home_colors()[1]
+ color = self._theme.get_home_friends_color()
self._friends_rect.set_property("fill-color", color)
- color = self._theme.get_home_colors()[2]
+ color = self._theme.get_home_mesh_color()
self._mesh_rect.set_property("fill-color", color)
def add_friend(self, friend):
diff --git a/shell/home/HomeView.py b/shell/home/HomeView.py
index a84b4f6..7894368 100644
--- a/shell/home/HomeView.py
+++ b/shell/home/HomeView.py
@@ -46,12 +46,12 @@ class Background(goocanvas.Group):
self._theme = Theme.get_instance()
self._theme.connect("theme-changed", self.__theme_changed_cb)
- color = self._theme.get_home_colors()[1]
+ color = self._theme.get_home_friends_color()
self._friends_rect = goocanvas.Rect(width=1200, height=900,
fill_color=color)
self.add_child(self._friends_rect)
- color = self._theme.get_home_colors()[0]
+ color = self._theme.get_home_activities_color()
self._home_rect = goocanvas.Rect(x=100, y=100, width=1000, height=700,
line_width=0, fill_color=color,
radius_x=30, radius_y=30)
@@ -62,10 +62,10 @@ class Background(goocanvas.Group):
font="Sans 21")
self.add_child(item)
- def __theme_changed_cb(self, theme, colors):
- color = self._theme.get_home_colors()[0]
+ def __theme_changed_cb(self, theme):
+ color = self._theme.get_home_activities_color()
self._home_rect.set_property("fill-color", color)
- color = self._theme.get_home_colors()[1]
+ color = self._theme.get_friends_colors()
self._friends_rect.set_property("fill-color", color)
class Model(goocanvas.CanvasModelSimple):
diff --git a/shell/home/MeshView.py b/shell/home/MeshView.py
index a2694be..533fb7e 100644
--- a/shell/home/MeshView.py
+++ b/shell/home/MeshView.py
@@ -6,6 +6,8 @@ from sugar.canvas.IconItem import IconItem
from sugar.canvas.IconItem import IconColor
from sugar import conf
+import Theme
+
class ActivityItem(IconItem):
def __init__(self, activity):
registry = conf.get_activity_registry()
@@ -22,18 +24,36 @@ class ActivityItem(IconItem):
class Model(goocanvas.CanvasModelSimple):
def __init__(self, data_model):
goocanvas.CanvasModelSimple.__init__(self)
+ self._theme = Theme.get_instance()
+ self._theme.connect("theme-changed", self.__theme_changed_cb)
root = self.get_root_item()
- item = goocanvas.Rect(width=1200, height=900,
- fill_color="#d8d8d8")
- root.add_child(item)
+ color = self._theme.get_home_mesh_color()
+ self._mesh_rect = goocanvas.Rect(width=1200, height=900,
+ fill_color=color)
+ root.add_child(self._mesh_rect)
+
+ color = self._theme.get_home_friends_color()
+ self._friends_rect = goocanvas.Rect(x=350, y=280, width=500, height=340,
+ line_width=0, fill_color=color,
+ radius_x=30, radius_y=30)
+ root.add_child(self._friends_rect)
+
+ color = self._theme.get_home_activities_color()
+ self._home_rect = goocanvas.Rect(x=480, y=360, width=240, height=180,
+ line_width=0, fill_color=color,
+ radius_x=30, radius_y=30)
+ root.add_child(self._home_rect)
for activity in data_model:
self.add_activity(activity)
data_model.connect('activity-added', self.__activity_added_cb)
+ def __theme_changed_cb(self, theme):
+ pass
+
def add_activity(self, activity):
root = self.get_root_item()
diff --git a/shell/home/Theme.py b/shell/home/Theme.py
index 259d772..f0a4cbc 100644
--- a/shell/home/Theme.py
+++ b/shell/home/Theme.py
@@ -1,5 +1,7 @@
import gobject
+
+
class Theme(gobject.GObject):
__gsignals__ = {
'theme-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
@@ -37,9 +39,14 @@ class Theme(gobject.GObject):
if updated:
self.emit('theme-changed')
- def get_home_colors(self):
- return self.__colors[self._cur_theme]
+ def get_home_activities_color(self):
+ return self.__colors[self._cur_theme][0]
+
+ def get_home_friends_color(self):
+ return self.__colors[self._cur_theme][1]
+ def get_home_mesh_color(self):
+ return self.__colors[self._cur_theme][2]
# Use this accessor, don't create more than one theme object
_theme = None