[Pkg-sugar-commit] [sugar-toolkit-gtk3] 01/05: Add get_bundle method to activity.py

Jonas Smedegaard dr at jones.dk
Tue Jul 7 01:18:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository sugar-toolkit-gtk3.

commit 04d8f596bc0ffbf9cf77d2b29c0cbc07ac444530
Author: Gonzalo Odiard <godiard at gmail.com>
Date:   Thu Jul 2 16:07:23 2015 -0300

    Add get_bundle method to activity.py
    
    When a programmer need open one activity from other [1]
    usually need display in the user interface information about the activity
    to open, like the name or the icon.
    This method allow get this information, previously only available on jarabe.
    
    [1] http://wiki.sugarlabs.org/go/Features/Start_activity_from_another_activity
---
 src/sugar3/activity/activity.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py
index 33cf251..0506147 100644
--- a/src/sugar3/activity/activity.py
+++ b/src/sugar3/activity/activity.py
@@ -83,6 +83,7 @@ from sugar3.graphics.alert import Alert
 from sugar3.graphics.icon import Icon
 from sugar3.datastore import datastore
 from sugar3.bundle.activitybundle import get_bundle_instance
+from sugar3.bundle.helpers import bundle_from_dir
 from gi.repository import SugarExt
 
 _ = lambda msg: gettext.dgettext('sugar-toolkit-gtk3', msg)
@@ -1166,3 +1167,14 @@ def launch_bundle(bundle_id='', object_id=''):
     obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH)
     bundle_launcher = dbus.Interface(obj, J_DBUS_INTERFACE)
     return bundle_launcher.LaunchBundle(bundle_id, object_id)
+
+
+def get_bundle(bundle_id='', object_id=''):
+    bus = dbus.SessionBus()
+    obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH)
+    journal = dbus.Interface(obj, J_DBUS_INTERFACE)
+    bundle_path = journal.GetBundlePath(bundle_id, object_id)
+    if bundle_path:
+        return bundle_from_dir(bundle_path)
+    else:
+        return None

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit-gtk3.git



More information about the pkg-sugar-commit mailing list