Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-03-09 15:35:53 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-03-09 15:35:53 (GMT)
commitd3493aea9ef4ccc79df397580c37283f2bfe9fcf (patch)
tree80d6f198941e286d05904a90d15e51d1ba0d6cc1 /sugar
parent1587218e9eca0fab2af3bb5e758b7103a9b6b066 (diff)
Smarter sugar-activity which can make itself the factory and open
one instance.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/activityfactory.py11
-rw-r--r--sugar/activity/activityfactoryservice.py15
-rw-r--r--sugar/activity/bundle.py6
3 files changed, 18 insertions, 14 deletions
diff --git a/sugar/activity/activityfactory.py b/sugar/activity/activityfactory.py
index 695d149..cd632ca 100644
--- a/sugar/activity/activityfactory.py
+++ b/sugar/activity/activityfactory.py
@@ -53,16 +53,16 @@ def _find_activity_id():
return act_id
class ActivityCreationHandler(gobject.GObject):
-
__gsignals__ = {
- 'error': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- ([gobject.TYPE_PYOBJECT])),
+ 'success': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, ([])),
+ 'error': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ ([gobject.TYPE_PYOBJECT]))
}
def __init__(self, service_name, activity_handle):
gobject.GObject.__init__(self)
-
self._service_name = service_name
self._activity_handle = activity_handle
@@ -83,6 +83,7 @@ class ActivityCreationHandler(gobject.GObject):
def _reply_handler(self, xid):
logging.debug("Activity created %s (%s)." %
(self._activity_handle.activity_id, self._service_name))
+ self.emit('success')
def _error_handler(self, err):
logging.debug("Couldn't create activity %s (%s): %s" %
diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py
index 548ff33..723c31e 100644
--- a/sugar/activity/activityfactoryservice.py
+++ b/sugar/activity/activityfactoryservice.py
@@ -77,22 +77,25 @@ class ActivityFactoryService(dbus.service.Object):
if len(self._activities) == 0:
gtk.main_quit()
-def run(args):
+def run_with_args(args):
"""Start the activity factory."""
parser = OptionParser()
parser.add_option("-p", "--bundle-path", dest="bundle_path",
help="path to the activity bundle")
(options, args) = parser.parse_args()
- sys.path.insert(0, options.bundle_path)
+ run(options.bundle_path)
- bundle = Bundle(options.bundle_path)
+def run(bundle_path):
+ sys.path.insert(0, bundle_path)
+
+ bundle = Bundle(bundle_path)
logger.start(bundle.get_name())
- os.environ['SUGAR_BUNDLE_PATH'] = options.bundle_path
+ os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
os.environ['SUGAR_BUNDLE_SERVICE_NAME'] = bundle.get_service_name()
os.environ['SUGAR_BUNDLE_DEFAULT_TYPE'] = bundle.get_default_type()
- factory = ActivityFactoryService(bundle.get_service_name(), args[0])
- gtk.main()
+ factory = ActivityFactoryService(bundle.get_service_name(),
+ bundle.get_class())
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py
index 8980a11..c4f8503 100644
--- a/sugar/activity/bundle.py
+++ b/sugar/activity/bundle.py
@@ -43,8 +43,8 @@ class Bundle:
if cp.has_option(section, 'class'):
self._class = cp.get(section, 'class')
- self._exec = '%s %s --bundle-path="%s"' % (
- env.get_bin_path(_PYTHON_FACTORY), self._class, self.get_path())
+ self._exec = '%s --bundle-path="%s"' % (
+ env.get_bin_path(_PYTHON_FACTORY), self.get_path())
elif cp.has_option(section, 'exec'):
self._class = None
self._exec = cp.get(section, 'exec')
@@ -105,7 +105,7 @@ class Bundle:
def get_class(self):
"""Get the main Activity class"""
- return self._exec
+ return self._class
def get_show_launcher(self):
"""Get whether there should be a visible launcher for the activity"""