Make part of the session public so that it can used by tests

This commit is contained in:
Marco Pesenti Gritti 2006-09-10 02:35:53 +02:00
parent f4f70d22f1
commit 47cc58b1e6
12 changed files with 59 additions and 49 deletions

View File

@ -50,7 +50,6 @@ shell/conf/Makefile
shell/data/Makefile
shell/home/Makefile
shell/frame/Makefile
shell/session/Makefile
shell/PresenceService/Makefile
sugar/Makefile
sugar/__installed__.py
@ -62,6 +61,7 @@ sugar/chat/sketchpad/Makefile
sugar/p2p/Makefile
sugar/p2p/model/Makefile
sugar/presence/Makefile
sugar/session/Makefile
po/Makefile.in
tools/Makefile
tools/sugar-setup-activity

View File

@ -1,4 +1,4 @@
SUBDIRS = conf data session frame home PresenceService
SUBDIRS = conf data frame home PresenceService
bin_SCRIPTS = \
sugar \
@ -17,6 +17,7 @@ sugar_PYTHON = \
Friends.py \
Invites.py \
Owner.py \
Shell.py
Shell.py \
Session.py
EXTRA_DIST = $(bin_SCRIPTS)

View File

@ -1,46 +1,18 @@
import os
import gtk
import gobject
import time
import re
from Shell import Shell
from ConsoleWindow import ConsoleWindow
from session.Process import Process
from FirstTimeDialog import FirstTimeDialog
from sugar import env
from sugar import logger
from sugar.session.Process import Process
from sugar.session.DbusProcess import DbusProcess
from sugar.session.MatchboxProcess import MatchboxProcess
from FirstTimeDialog import FirstTimeDialog
import conf
class DbusProcess(Process):
def __init__(self):
config = env.get_dbus_config()
cmd = "dbus-daemon --print-address --config-file %s" % config
Process.__init__(self, cmd)
def get_name(self):
return 'Dbus'
def start(self):
Process.start(self, True)
dbus_file = os.fdopen(self._stdout)
addr = dbus_file.readline().strip()
dbus_file.close()
os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr
class MatchboxProcess(Process):
def __init__(self):
kbd_config = os.path.join(env.get_data_dir(), 'kbdconfig')
options = '-kbdconfig %s ' % kbd_config
options += '-theme olpc '
command = 'matchbox-window-manager %s ' % options
Process.__init__(self, command)
def get_name(self):
return 'Matchbox'
class DBusMonitorProcess(Process):
def __init__(self):
Process.__init__(self, "dbus-monitor --session")

View File

@ -1,6 +0,0 @@
sugardir = $(pkgdatadir)/shell/session
sugar_PYTHON = \
__init__.py \
Emulator.py \
Process.py \
Session.py

View File

@ -19,14 +19,14 @@ from sugar import env
env.setup_system()
from session.Emulator import Emulator
from sugar.session.Emulator import Emulator
if os.environ.has_key('SUGAR_EMULATOR') and \
os.environ['SUGAR_EMULATOR'] == 'yes':
emulator = Emulator()
emulator.start()
from session.Session import Session
from Session import Session
session = Session()
session.start()

View File

@ -1,10 +1,9 @@
SUBDIRS = activity canvas chat p2p presence
SUBDIRS = activity canvas chat p2p presence session
sugardir = $(pythondir)/sugar
sugar_PYTHON = \
__init__.py \
__installed__.py \
bots.py \
env.py \
logger.py \
setup.py \

View File

@ -0,0 +1,20 @@
import os
from sugar.session.Process import Process
from sugar import env
class DbusProcess(Process):
def __init__(self):
config = env.get_dbus_config()
cmd = "dbus-daemon --print-address --config-file %s" % config
Process.__init__(self, cmd)
def get_name(self):
return 'Dbus'
def start(self):
Process.start(self, True)
dbus_file = os.fdopen(self._stdout)
addr = dbus_file.readline().strip()
dbus_file.close()
os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr

View File

@ -2,7 +2,7 @@ import os
import socket
import sys
from session.Process import Process
from sugar.session.Process import Process
import sugar.env
def get_display_number():

View File

@ -0,0 +1,7 @@
sugardir = $(pythondir)/sugar/session
sugar_PYTHON = \
__init__.py \
DbusProcess.py \
Emulator.py \
MatchboxProcess.py \
Process.py

View File

@ -0,0 +1,17 @@
import os
from sugar.session.Process import Process
from sugar import env
class MatchboxProcess(Process):
def __init__(self):
kbd_config = os.path.join(env.get_data_dir(), 'kbdconfig')
options = '-kbdconfig %s ' % kbd_config
options += '-theme olpc '
command = 'matchbox-window-manager %s ' % options
Process.__init__(self, command)
def get_name(self):
return 'Matchbox'