Esempio n. 1
0
def run(app_func=None, config=None, args=None):
    configure_logging()

    options, args = parse_options(args)
    if options or args: 
        handle_options(options, args)    

    if config is None:
        config = load_user_config(options.configfile)
    load_config(config=config)

    set_process_name('samurai-x')

    xhelpers.open_display()
    xhelpers.check_for_other_wm()
    xhelpers.setup_xerror()

    init_atoms()
    xhelpers.get_numlock_mask()
    init_cursors()
    init_timer()

    if app_func is None:
        from samuraix.appl import App
        app_func = App

    log.info('creating app instance...')
    samuraix.app = app_func()
    samuraix.app.init()
    run_app()
    log.info('done')
Esempio n. 2
0
def run(app_func, nice_inc=15, name=None):
    from samuraix.procutil import set_process_name

    xhelpers.open_display()
    xhelpers.setup_xerror()

    xhelpers.get_numlock_mask()

    os.nice(nice_inc)
        
    simpleapp = app_func() #ClockApp(SimpleScreen(0), Rect(0, 0, 200, 15))

    if name is None:
        name = 'sx.%s' % simpleapp.__class__.__name__
    set_process_name(name)

    try:
        simpleapp.run()   
    finally:
        xhelpers.close_display()