Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-09-11 13:18:57 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-09-11 13:18:57 (GMT)
commit6a90ef11d3f0b360f9d9eaca64f22a173093d046 (patch)
tree2d1b99a46f1450b27ce0d66253a8685a50b1bd7e
parentd14628fdfa612f4bf84018ebc4d8b3cec934483c (diff)
Export the color in the env and initialize the buddy with it
-rw-r--r--shell/PresenceService/Buddy.py2
-rw-r--r--sugar/env.py4
-rw-r--r--sugar/simulator.py13
3 files changed, 9 insertions, 10 deletions
diff --git a/shell/PresenceService/Buddy.py b/shell/PresenceService/Buddy.py
index 238e0d4..576ee9f 100644
--- a/shell/PresenceService/Buddy.py
+++ b/shell/PresenceService/Buddy.py
@@ -3,6 +3,7 @@ import logging
import gobject
import dbus, dbus.service
+from sugar import env
PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp"
@@ -287,6 +288,7 @@ class Owner(Buddy):
def __init__(self, ps, bus_name, object_id, nick):
Buddy.__init__(self, bus_name, object_id, None)
self._nick_name = nick
+ self._color = env.get_color()
self._ps = ps
def add_service(self, service):
diff --git a/sugar/env.py b/sugar/env.py
index 62dc269..8fc131a 100644
--- a/sugar/env.py
+++ b/sugar/env.py
@@ -11,10 +11,14 @@ import sugar.setup
def setup_user(profile):
os.environ['SUGAR_NICK_NAME'] = profile.get_nick_name()
+ os.environ['SUGAR_COLOR'] = profile.get_color().to_string()
def get_nick_name():
return os.environ['SUGAR_NICK_NAME']
+def get_color():
+ return os.environ['SUGAR_COLOR']
+
def setup_python_path():
for path in sugar_python_path:
sys.path.insert(0, path)
diff --git a/sugar/simulator.py b/sugar/simulator.py
index b304bc4..96fa498 100644
--- a/sugar/simulator.py
+++ b/sugar/simulator.py
@@ -67,7 +67,8 @@ class Bot:
self._color = color
self._timeline = _Timeline(0.01)
- os.environ['SUGAR_NICK_NAME'] = self._nick
+ os.environ['SUGAR_NICK_NAME'] = nick
+ os.environ['SUGAR_COLOR'] = color.to_string()
def start(self):
session = TestSession()
@@ -78,17 +79,9 @@ class Bot:
owner = _ShellOwner(self._nick, self._color)
owner.announce()
- gobject.timeout_add(1000, self._real_start)
+ pservice = PresenceService.get_instance()
gtk.main()
def add_action(self, action, minutes):
self._timeline.add(action, minutes)
-
- def _real_start(self):
- pservice = PresenceService.get_instance()
-
- if not pservice.get_owner().get_color():
- return True
-
- return False