#!/usr/bin/env python # Copyright (C) 2006, Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import sys import os if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug': import time print '%r STARTUP: Starting the shell' % time.time() sys.stdout.flush() import gettext import logging import gconf import gtk import gobject import dbus.glib gtk.gdk.threads_init() dbus.glib.threads_init() from sugar import logger from sugar.profile import get_profile from jarabe.desktop.homewindow import HomeWindow from jarabe.model import sound from jarabe.view import launcher from jarabe import intro from jarabe import config from jarabe import service def uisetup_completed_cb(): logging.debug('STARTUP: --- uisetup_completed_cb ---') from jarabe.model import screen screen.set_dcon_freeze(0) def uisetup_delayed_cb(home_window): logging.debug('STARTUP: --- uisetup_delayed_cb ---') from jarabe.journal import journalactivity from jarabe.view import keyhandler from jarabe import frame keyhandler.setup(frame.get_view()) journalactivity.start() if os.path.isfile(os.path.expanduser('~/.sugar-update')): home_window.get_home_box().show_software_updates_alert() def main(): service.start_logsmanager() logger.start('shell') intro.check_profile() client = gconf.client_get_default() timezone = client.get_string('/desktop/sugar/date/timezone') if timezone is not '': os.environ['TZ'] = timezone service.start_all() sound.restore() sys.path.append(config.ext_path) gettext.bindtextdomain('sugar', config.locale_path) gettext.textdomain('sugar') icons_path = os.path.join(config.data_path, 'icons') gtk.icon_theme_get_default().append_search_path(icons_path) launcher.setup() home_window = HomeWindow() home_window.show() gobject.idle_add(uisetup_completed_cb) gobject.idle_add(uisetup_delayed_cb, home_window) try: gtk.main() except KeyboardInterrupt: print 'Ctrl+C pressed, exiting...' main()