From b9cc263d7529b319020d1a2ceb294663ddcb05ce Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 4 Sep 2006 21:49:58 +0200 Subject: [PATCH] Cleanup and startup the wm before first time dialog --- shell/session/Session.py | 30 +++++++++++++++++++++++------- shell/sugar | 11 ----------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/shell/session/Session.py b/shell/session/Session.py index f864da59..ef76c58c 100644 --- a/shell/session/Session.py +++ b/shell/session/Session.py @@ -7,11 +7,14 @@ import re from Shell import Shell from ConsoleWindow import ConsoleWindow 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): def __init__(self): - config = sugar.env.get_dbus_config() + config = env.get_dbus_config() cmd = "dbus-daemon --print-address --config-file %s" % config Process.__init__(self, cmd) @@ -27,7 +30,7 @@ class DbusProcess(Process): class MatchboxProcess(Process): 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 += '-theme olpc ' @@ -40,16 +43,29 @@ class MatchboxProcess(Process): class Session: """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): """Start the session""" - process = DbusProcess() - process.start() - process = MatchboxProcess() process.start() + self._check_profile() + + process = DbusProcess() + process.start() + console = ConsoleWindow() - sugar.logger.start('Shell', console) + logger.start('Shell', console) shell = Shell() shell.set_console(console) diff --git a/shell/sugar b/shell/sugar index 1dd726dd..17553d69 100755 --- a/shell/sugar +++ b/shell/sugar @@ -26,17 +26,6 @@ if os.environ.has_key('SUGAR_EMULATOR') and \ emulator = Emulator() 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 session = Session()