Fix a bunch of bugs, more cleanups
This commit is contained in:
@@ -69,8 +69,8 @@ class ActivityRegistry:
|
||||
activity_exec = cp.get('Activity', 'exec')
|
||||
elif cp.has_option('Activity', 'python_module'):
|
||||
python_module = cp.get('Activity', 'python_module')
|
||||
activity_exec = 'python -m sugar/activity/Activity %s %s' \
|
||||
% (activity_id, python_module)
|
||||
activity_exec = '%s %s %s' % (env.get_activity_runner(),
|
||||
activity_id, python_module)
|
||||
env.add_to_python_path(directory)
|
||||
else:
|
||||
logging.error('%s must specifiy exec or python_module' % (path))
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
bin_SCRIPTS = sugar
|
||||
bin_SCRIPTS = sugar sugar-activity
|
||||
|
||||
sugardir = $(pkgdatadir)/shell
|
||||
sugar_PYTHON = \
|
||||
|
||||
+2
-8
@@ -6,18 +6,12 @@ class Process:
|
||||
"""Object representing one of the session processes"""
|
||||
|
||||
def __init__(self, command):
|
||||
self._pid = None
|
||||
self._command = command
|
||||
|
||||
def get_name(self):
|
||||
return self._command
|
||||
|
||||
def start(self):
|
||||
print self._command
|
||||
logging.debug('Start %s' % (self._command))
|
||||
|
||||
args = self._command.split()
|
||||
flags = gobject.SPAWN_SEARCH_PATH or gobject.SPAWN_STDERR_TO_DEV_NULL
|
||||
result = gobject.spawn_async(args, flags=flags, standard_output=True)
|
||||
self._pid = result[0]
|
||||
self._stdout = result[2]
|
||||
flags = gobject.SPAWN_SEARCH_PATH
|
||||
result = gobject.spawn_async(args, flags=flags)
|
||||
|
||||
+12
-7
@@ -1,9 +1,10 @@
|
||||
import os
|
||||
import gtk
|
||||
import sugar.theme
|
||||
import gobject
|
||||
|
||||
from Shell import Shell
|
||||
from Process import Process
|
||||
import sugar.theme
|
||||
|
||||
class ActivityProcess(Process):
|
||||
def __init__(self, module):
|
||||
@@ -21,8 +22,12 @@ class DbusProcess(Process):
|
||||
return 'Dbus'
|
||||
|
||||
def start(self):
|
||||
Process.start(self)
|
||||
|
||||
args = self._command.split()
|
||||
flags = gobject.SPAWN_SEARCH_PATH
|
||||
result = gobject.spawn_async(args, flags=flags, standard_output=True,
|
||||
standard_error=True)
|
||||
self._stdout = result[2]
|
||||
|
||||
dbus_file = os.fdopen(self._stdout)
|
||||
addr = dbus_file.readline()
|
||||
addr = addr.strip()
|
||||
@@ -42,9 +47,6 @@ class Session:
|
||||
def __init__(self):
|
||||
sugar.theme.setup()
|
||||
|
||||
self._shell = Shell()
|
||||
self._shell.start()
|
||||
|
||||
def start(self):
|
||||
"""Start the session"""
|
||||
process = DbusProcess()
|
||||
@@ -52,8 +54,11 @@ class Session:
|
||||
|
||||
process = MatchboxProcess()
|
||||
process.start()
|
||||
|
||||
shell = Shell()
|
||||
shell.start()
|
||||
|
||||
registry = self._shell.get_registry()
|
||||
registry = shell.get_registry()
|
||||
for activity_module in registry.list_activities():
|
||||
process = ActivityProcess(activity_module)
|
||||
process.start()
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import dbus
|
||||
import gtk
|
||||
import wnck
|
||||
import gobject
|
||||
|
||||
from sugar.LogWriter import LogWriter
|
||||
from ConsoleLogger import ConsoleLogger
|
||||
|
||||
+7
-7
@@ -5,8 +5,6 @@ import os
|
||||
import pwd
|
||||
import random
|
||||
|
||||
from Emulator import Emulator
|
||||
|
||||
def add_to_python_path(path):
|
||||
sys.path.insert(0, path)
|
||||
if os.environ.has_key('PYTHONPATH'):
|
||||
@@ -15,10 +13,6 @@ def add_to_python_path(path):
|
||||
else:
|
||||
os.environ['PYTHONPATH'] = path
|
||||
|
||||
# FIXE Don't run the emulator on the OLPC
|
||||
emulator = Emulator()
|
||||
emulator.start()
|
||||
|
||||
i = 0
|
||||
for arg in sys.argv:
|
||||
if arg == '--test-user':
|
||||
@@ -46,8 +40,14 @@ else:
|
||||
import sugar.env
|
||||
add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
|
||||
print 'Running the installed sugar...'
|
||||
|
||||
from Emulator import Emulator
|
||||
|
||||
# FIXE Don't run the emulator on the OLPC
|
||||
emulator = Emulator()
|
||||
emulator.start()
|
||||
|
||||
print 'Redirecting output to the console, press Ctrl+Down to open it.'
|
||||
print 'Redirecting output to the console, press F3 to open it.'
|
||||
|
||||
from Session import Session
|
||||
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
import gobject
|
||||
|
||||
from sugar.activity import Activity
|
||||
from sugar.LogWriter import LogWriter
|
||||
from sugar import theme
|
||||
|
||||
theme.setup()
|
||||
|
||||
lw = LogWriter(sys.argv[1])
|
||||
lw.start()
|
||||
|
||||
Activity.register_factory(sys.argv[1], sys.argv[2])
|
||||
Reference in New Issue
Block a user