Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-03-20 02:00:58 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-03-20 02:00:58 (GMT)
commitab01dcc791db18e9e3d8f275ce561d16dc93e199 (patch)
treeac03d0966c6c755ef83bbef1082853b8ae694d46 /utils.py
parent548d58e859e017b0d32cbb03ee6a0172e9917aaf (diff)
Use activitybundle for install .xos
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/utils.py b/utils.py
index 4752983..3cacab5 100644
--- a/utils.py
+++ b/utils.py
@@ -25,6 +25,7 @@ import json
import urllib
from sugar.activity import activity
+from sugar.bundle.activitybundle import ActivityBundle
LIST_DOWNLOAD = "https://sites.google.com/site/agustinzubiaga/archivos/store.lst"
LIST_PATH = os.path.join(activity.get_activity_root(), 'data', 'store.lst')
@@ -32,7 +33,7 @@ TMP_DIR = os.path.join(activity.get_activity_root(), "tmp")
def update_list():
- """Download the last list version"""
+ """Download the latest list version"""
remote_file = urllib.urlopen(LIST_DOWNLOAD)
file = open(LIST_PATH, 'w')
file.write(remote_file.read())
@@ -90,7 +91,15 @@ def download_activity(id, progress_function):
def install_activity(xofile, progress_function):
"""Install an downloaded activity"""
+ # Show "Installing..." message
progress_function(150)
- os.system('sugar-install-bundle %s' % xofile)
+
+ # Install the .xo
+ bundle = ActivityBundle(xofile)
+ bundle.install()
+
+ # Remove the .xo
os.remove(xofile)
+
+ # Show "Installed..." message
progress_function(200)