2006-05-16 22:32:08 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2006-05-18 06:24:32 +02:00
|
|
|
from ConfigParser import ConfigParser
|
2006-05-16 22:32:08 +02:00
|
|
|
|
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
from sugar.shell import shell
|
2006-05-18 06:24:32 +02:00
|
|
|
from sugar import env
|
2006-05-16 22:32:08 +02:00
|
|
|
|
2006-05-17 06:12:01 +02:00
|
|
|
def start(console):
|
2006-05-16 22:32:08 +02:00
|
|
|
shell.main()
|
2006-05-17 06:23:00 +02:00
|
|
|
|
2006-05-18 06:24:32 +02:00
|
|
|
activities = []
|
|
|
|
|
2006-05-18 07:17:40 +02:00
|
|
|
activities_dirs = []
|
|
|
|
|
2006-05-18 06:24:32 +02:00
|
|
|
for data_dir in env.get_data_dirs():
|
2006-05-18 07:17:40 +02:00
|
|
|
act_dir = os.path.join(data_dir, env.get_activities_dir())
|
|
|
|
activities_dirs.append(act_dir)
|
|
|
|
|
|
|
|
activities_dirs.append(os.path.expanduser('~/.sugar/activities'))
|
|
|
|
|
|
|
|
for activities_dir in activities_dirs:
|
2006-05-18 18:17:25 +02:00
|
|
|
if os.path.isdir(activities_dir):
|
|
|
|
for filename in os.listdir(activities_dir):
|
|
|
|
if filename.endswith(".activity"):
|
|
|
|
path = os.path.join(activities_dir, filename)
|
|
|
|
cp = ConfigParser()
|
|
|
|
cp.read([path])
|
|
|
|
python_class = cp.get('Activity', "python_class")
|
|
|
|
activities.append(python_class)
|
2006-05-16 22:32:08 +02:00
|
|
|
|
|
|
|
for activity in activities:
|
2006-05-17 06:12:01 +02:00
|
|
|
args = [ 'python', '-m', activity ]
|
|
|
|
if console:
|
|
|
|
args.append('--console')
|
|
|
|
os.spawnvp(os.P_NOWAIT, 'python', args)
|
2006-05-16 22:32:08 +02:00
|
|
|
|
|
|
|
gtk.main()
|