Cleanup and startup the wm before first time dialog

This commit is contained in:
Marco Pesenti Gritti 2006-09-04 21:49:58 +02:00
parent 01c4658ee0
commit b9cc263d75
2 changed files with 23 additions and 18 deletions

View File

@ -7,11 +7,14 @@ import re
from Shell import Shell from Shell import Shell
from ConsoleWindow import ConsoleWindow from ConsoleWindow import ConsoleWindow
from session.Process import Process from session.Process import Process
import sugar.env from FirstTimeDialog import FirstTimeDialog
from sugar import env
from sugar import logger
import conf
class DbusProcess(Process): class DbusProcess(Process):
def __init__(self): def __init__(self):
config = sugar.env.get_dbus_config() config = env.get_dbus_config()
cmd = "dbus-daemon --print-address --config-file %s" % config cmd = "dbus-daemon --print-address --config-file %s" % config
Process.__init__(self, cmd) Process.__init__(self, cmd)
@ -27,7 +30,7 @@ class DbusProcess(Process):
class MatchboxProcess(Process): class MatchboxProcess(Process):
def __init__(self): def __init__(self):
kbd_config = os.path.join(sugar.env.get_data_dir(), 'kbdconfig') kbd_config = os.path.join(env.get_data_dir(), 'kbdconfig')
options = '-kbdconfig %s ' % kbd_config options = '-kbdconfig %s ' % kbd_config
options += '-theme olpc ' options += '-theme olpc '
@ -40,16 +43,29 @@ class MatchboxProcess(Process):
class Session: class Session:
"""Takes care of running the shell and all the sugar processes""" """Takes care of running the shell and all the sugar processes"""
def _check_profile(self):
profile = conf.get_profile()
if profile.get_nick_name() == None:
dialog = FirstTimeDialog()
dialog.run()
profile.save()
env.setup_user(profile)
def start(self): def start(self):
"""Start the session""" """Start the session"""
process = DbusProcess()
process.start()
process = MatchboxProcess() process = MatchboxProcess()
process.start() process.start()
self._check_profile()
process = DbusProcess()
process.start()
console = ConsoleWindow() console = ConsoleWindow()
sugar.logger.start('Shell', console) logger.start('Shell', console)
shell = Shell() shell = Shell()
shell.set_console(console) shell.set_console(console)

View File

@ -26,17 +26,6 @@ if os.environ.has_key('SUGAR_EMULATOR') and \
emulator = Emulator() emulator = Emulator()
emulator.start() emulator.start()
from FirstTimeDialog import FirstTimeDialog
import conf
profile = conf.get_profile()
if profile.get_nick_name() == None:
dialog = FirstTimeDialog()
dialog.run()
profile.save()
env.setup_user(profile)
from session.Session import Session from session.Session import Session
session = Session() session = Session()