Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-07-12 20:17:57 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-07-12 20:17:57 (GMT)
commit2bbedf988b39c5af35777954444ba54ceba13ecb (patch)
treef3607f074de03e6774a9e8963d485ea4db7dcc1c /shell
parentd12b780074b05b0abcaf6b3877a9a4047c6e0d0e (diff)
Fix a bunch of bugs, more cleanups
Diffstat (limited to 'shell')
-rw-r--r--shell/ActivityRegistry.py4
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/Process.py10
-rw-r--r--shell/Session.py19
-rwxr-xr-xshell/Shell.py1
-rwxr-xr-xshell/sugar14
-rwxr-xr-xshell/sugar-activity16
7 files changed, 41 insertions, 25 deletions
diff --git a/shell/ActivityRegistry.py b/shell/ActivityRegistry.py
index 2ddf767..957d436 100644
--- a/shell/ActivityRegistry.py
+++ b/shell/ActivityRegistry.py
@@ -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))
diff --git a/shell/Makefile.am b/shell/Makefile.am
index ff0a450..c6064b1 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,4 +1,4 @@
-bin_SCRIPTS = sugar
+bin_SCRIPTS = sugar sugar-activity
sugardir = $(pkgdatadir)/shell
sugar_PYTHON = \
diff --git a/shell/Process.py b/shell/Process.py
index 5fee905..ea5dd0c 100644
--- a/shell/Process.py
+++ b/shell/Process.py
@@ -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)
diff --git a/shell/Session.py b/shell/Session.py
index 93f4b1f..2aeb044 100644
--- a/shell/Session.py
+++ b/shell/Session.py
@@ -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()
diff --git a/shell/Shell.py b/shell/Shell.py
index 6b30bad..df75d1f 100755
--- a/shell/Shell.py
+++ b/shell/Shell.py
@@ -3,6 +3,7 @@ import os
import dbus
import gtk
import wnck
+import gobject
from sugar.LogWriter import LogWriter
from ConsoleLogger import ConsoleLogger
diff --git a/shell/sugar b/shell/sugar
index 528aa19..756fe26 100755
--- a/shell/sugar
+++ b/shell/sugar
@@ -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
diff --git a/shell/sugar-activity b/shell/sugar-activity
new file mode 100755
index 0000000..bc6e38a
--- /dev/null
+++ b/shell/sugar-activity
@@ -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])