Example #1
0
def main():
    gobject.idle_add(_shell_started_cb)

    logsmanager.setup()
    logger.start('shell')

    _save_session_info()
    _start_matchbox()
    _setup_translations()

    hw_manager = hardwaremanager.get_manager()
    hw_manager.startup()

    icons_path = os.path.join(config.data_path, 'icons')
    gtk.icon_theme_get_default().append_search_path(icons_path)

    # Do initial setup if needed
    if not get_profile().is_valid():
        win = intro.IntroWindow()
        win.show_all()
        gtk.main()

    if os.environ.has_key("SUGAR_TP_DEBUG"):
        # Allow the user time to start up telepathy connection managers
        # using the Sugar DBus bus address
        import time
        from telepathy.client import ManagerRegistry

        registry = ManagerRegistry()
        registry.LoadManagers()

        debug_flags = os.environ["SUGAR_TP_DEBUG"].split(',')
        for cm_name in debug_flags:
            if cm_name not in ["gabble", "salut"]:
                continue

            try:
                cm = registry.services[cm_name]
            except KeyError:
               print RuntimeError("%s connection manager not found!" % cm_name)

            while not check_cm(cm['busname']):
                print "Waiting for %s on: DBUS_SESSION_BUS_ADDRESS=%s" % \
                    (cm_name, os.environ["DBUS_SESSION_BUS_ADDRESS"])
                try:
                    time.sleep(5)
                except KeyboardInterrupt:
                    print "Got Ctrl+C, continuing..."
                    break

    model = ShellModel()
    shell = Shell(model)
    service = ShellService(shell)

    if os.environ.has_key("SUGARBOT_EMULATOR"):
        sys.path.append(os.environ['SUGARBOT_PATH'])
        from sugarbotlauncher import SugarbotLauncher
        sbLauncher = SugarbotLauncher(shell, model)

    try:
        gtk.main()
    except KeyboardInterrupt:
        print 'Ctrl+C pressed, exiting...'

    session_info_file = os.path.join(env.get_profile_path(), "session.info")
    os.remove(session_info_file)
Example #2
0
def _shell_started_cb():
    # Unfreeze the display
    hw_manager = hardwaremanager.get_manager()
    hw_manager.set_dcon_freeze(0)