diff options
author | Tony Anderson <tony@traveler.(none)> | 2011-04-14 13:37:58 (GMT) |
---|---|---|
committer | Tony Anderson <tony@traveler.(none)> | 2011-04-14 13:37:58 (GMT) |
commit | 71a191cee29afc6381131eb5277fdc59152e9e9f (patch) | |
tree | 138c9183dc42c3f59699492cfa96e9969c28b3e7 | |
parent | f529dd16585b703c58b4371e45ad1ec082da0ad6 (diff) |
version 14.03
-rwxr-xr-x | activity/activity.info | 2 | ||||
-rwxr-xr-x | cgi-bin/activities.py | 9 | ||||
-rwxr-xr-x | cgi-bin/launch.py | 45 |
3 files changed, 28 insertions, 28 deletions
diff --git a/activity/activity.info b/activity/activity.info index d878e9f..9f40503 100755 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,5 +1,5 @@ [Activity] -#version = 14.03 +#version = 14.04 name = Learn service_name = rw.olpc.Learn icon = activity-learn diff --git a/cgi-bin/activities.py b/cgi-bin/activities.py index 9dd8346..43b5a0d 100755 --- a/cgi-bin/activities.py +++ b/cgi-bin/activities.py @@ -245,3 +245,12 @@ def _getParam(txt): value = value.replace("'","") return(key,value) +def copyFile(src,dst): + log = open('/tmp/logcopy','w') + cmd = 'cp ' + src + ' ' + dst + print >> log, cmd + try: + subprocess.call(cmd,shell=True) + except: + print >> log, 'cp failed', sys.exc_info()[:2] + log.close() diff --git a/cgi-bin/launch.py b/cgi-bin/launch.py index f0c8ef7..05e7a8b 100755 --- a/cgi-bin/launch.py +++ b/cgi-bin/launch.py @@ -1,40 +1,31 @@ #!/usr/bin/python -temp = open('/tmp/logx','w') -print >> temp,'launch entered' -temp.close() - import sys import cgi, cgitb import subprocess from sugar.activity import activity +from activities import copyFile sys.stderr = sys.stdout cgitb.enable(display=True) print 'Content-Type:text/html\n\n' log = open('/tmp/logl','w') -try: - print >>log,'launch log opened' - bundle_dir = activity.get_bundle_path() - bundle_dir = activity.get_bundle_path() - form = cgi.FieldStorage() - activity = form.getfirst('activity', default='') - print >> log, 'activity', len(activity), activity - if len(activity)>0: - bundle = form.getfirst('bundle', default='') - bundle_pth = bundle_dir + '/' + bundle - print >>log,'launch', activity, bundle_dir, bundle, bundle_pth - fout = open('/tmp/'+activity,'w') - fout.write(bundle_pth) - fout.close() - try: - subprocess.call('sugar-launch '+activity,shell=True) - except: - print >> log, 'sugar launch failed',sys.exc_info()[:2] - else: - print >> log, 'no activity' - print >>log,'sugar activity launched', activity -except: - print >>log, 'launch.py failed', sys.exc_info()[:2] +print >>log,'launch log opened' +bundle_dir = activity.get_bundle_path() +form = cgi.FieldStorage() +activity = form.getfirst('activity', default='') +print >> log, 'activity', len(activity), activity +if len(activity)>0: + bundle = form.getfirst('bundle', default='') + bundle_pth = bundle_dir + '/' + bundle + #perform actions based on which activity + if activity == 'Wordsearch': + copyFile(bundle_pth,'/home/olpc/Activities/Wordsearch.activity/wordlist/sample.txt') + service_name = 'ch.tea.Wordsearch' + print >>log,'launch', activity, bundle + subprocess.call('sugar-launch '+service_name,shell=True) + print >>log,'sugar-launch' +else: + print >> log, 'no activity' log.close() |