Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/Shell.py
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-08-09 10:57:42 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-08-09 10:57:42 (GMT)
commit7e85c5160ec0a04cb7434cd53368a7c5ba8ce0fa (patch)
tree13a0147daa22113625ce33818b1d938d893970da /shell/Shell.py
parente4c4e866a5c99d81f7fa0a0972311a604c6f1af2 (diff)
Setup the activity from the shell process, through dbus,
this simplifies things a lot...
Diffstat (limited to 'shell/Shell.py')
-rwxr-xr-xshell/Shell.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/shell/Shell.py b/shell/Shell.py
index 2860ed0..f08d724 100755
--- a/shell/Shell.py
+++ b/shell/Shell.py
@@ -1,4 +1,5 @@
import os
+import logging
import dbus
import dbus.glib
@@ -12,9 +13,10 @@ from HomeWindow import HomeWindow
from sugar import env
from ConsoleWindow import ConsoleWindow
from Owner import ShellOwner
-from PresenceService import PresenceService
+from sugar.presence.PresenceService import PresenceService
from ActivityHost import ActivityHost
from ChatListener import ChatListener
+from sugar.activity import ActivityFactory
class ShellDbusService(dbus.service.Object):
def __init__(self, shell, bus_name):
@@ -106,6 +108,30 @@ class Shell:
module = self._registry.get_activity(activity.get_default_type())
console = self.get_console(module.get_id())
activity.show_dialog(console)
+
+ def join_activity(self, service):
+ info = self._registry.get_activity(service.get_type())
+
+ activity_id = service.get_activity_id()
+ pservice = PresenceService()
+ activity_ps = pservice.get_activity(activity_id)
+
+ if activity_ps:
+ activity = ActivityFactory.create(info.get_id())
+ activity.set_default_type(service.get_type())
+ activity.join(activity_ps.object_path())
+ else:
+ logging.error('Cannot start activity.')
+
+ def start_activity(self, activity_name):
+ activity = ActivityFactory.create(activity_name)
+ info = self._registry.get_activity_from_id(activity_name)
+ if info:
+ activity.set_default_type(info.get_default_type())
+ return activity
+ else:
+ logging.error('No such activity in the directory')
+ return None
def log(self, module_id, message):
console = self.get_console(module_id)