Пример #1
0
def main(args, launch_file, debug=False):
    
    try:
        if args.i:
            install_and_exit(launch_file)
    except:
        pass
    
    try:
        import MediaKeysServer.system.util as util
        from   MediaKeysServer.agents.clock import Clock
        import MediaKeysServer.agents.socket_server #@UnusedImport
        
        from   MediaKeysServer.system import app as App
                
        if util.isLinux():
            import MediaKeysServer.agents.mk_dbus #@UnusedImport
            from MediaKeysServer.agents.notifier import NotifierAgent
            _na=NotifierAgent(APP_NAME, ICON_NAME)
            _na.start()
            
        #from MediaKeysServer.agents.uitk import UiAgent
                   
        icon_path=get_res_path(ICON_NAME)
        
        _app=App.create()
        _app.app_name=APP_NAME
        _app.version=APP_VERSION
        _app.help_url=HELP_URL
        _app.icon_path=icon_path
        
        mswitch.publish("__main__", "debug", debug)
                
        App.run(_app, TIME_BASE, Clock, None)
        
    except KeyboardInterrupt:
        mswitch.quit()
        sys.exit(1)        
        
    except Exception,e:
        try: 
            util.notify(APP_NAME, "There was an error: %s" % e)
        finally:
            print "Exception: %s" % e
        mswitch.quit()
        sys.exit(1)
Пример #2
0
def exit(code):
    mswitch.quit("__main__")
    sys.exit(code)