Exemple #1
0
    def initialise(self,frontend,scaffold,cookie,info):
        self.scaffold = scaffold
        self.frontend = frontend
        self.frontend_context = piw.tsd_snapshot()

        self.garbage_context = self.__create_context('eigend-garbage',None,False)

        piw.tsd_thing(self.fgthing)

        self.stdio = (sys.stdout,sys.stderr)

        if not self.opts.noredirect:
            sys.stdout = session.Logger()
            sys.stderr = sys.stdout

        self.backend_context = self.__create_context('eigend-backend',None,False)

        def bginit():
            self.agent = Agent(self)
            piw.tsd_thing(self.bgthing)

        self.collector = GarbageCollector(self.scaffold,self.garbage_context)
        self.collector.start()
        self.bugfiler.start(cookie,info)
        self.run_background(bginit)
Exemple #2
0
    def set_args(self, argv):
        args = argv.split()

        self.opts = EigenOpts()

        if '--stdout' in args:
            args.remove('--stdout')
            self.opts.stdout = True

        if '--noauto' in args:
            args.remove('--noauto')
            self.opts.noauto = True

        if '--noredirect' in args:
            args.remove('--noredirect')
            self.opts.stdout = True
            self.opts.noredirect = True

        self.args = args

        self.stdio = (sys.stdout, sys.stderr)

        if not self.opts.noredirect:
            sys.stdout = session.Logger()
            sys.stderr = sys.stdout
Exemple #3
0
    def __init__(self, name=None, logfunc=None, user=None, **kwds):
        wx.App.__init__(self, redirect=False, **kwds)

        self.Bind(EVT_PIA_SERVICE, self.__service_ctx)
        self.Bind(EVT_PIA_ASYNC, self.__service_async)

        self.mgr = piagent.scaffold_gui(utils.notify(self.__service),
                                        utils.notify(self.__service_shutdown),
                                        utils.stringify(logfunc),
                                        utils.stringify(None), False, False)

        self.__env_bg = self.mgr.bgcontext('main', utils.statusify(None),
                                           utils.stringify(logfunc), name
                                           or 'App')
        self.__env_fg = self.mgr.context('main', utils.statusify(None),
                                         utils.stringify(logfunc), name
                                         or 'App')

        piw.setenv(self.__env_fg.getenv())

        self.__stdio = (sys.stdout, sys.stderr)
        sys.stdout = session.Logger()
        sys.stderr = sys.stdout

        self.__thing = piw.thing()
        self.__thing.set_slow_trigger_handler(utils.notify(self.__trigger))
        self.__queue = []
        self.__lock = picross.mutex()

        self.run_bg_sync(self.__setup)
Exemple #4
0
    def initialise(self, frontend, scaffold, cookie, info):
        try:
            self.scaffold = scaffold
            self.frontend = frontend
            self.frontend_context = piw.tsd_snapshot()

            self.garbage_context = self.__create_context('eigend-garbage')

            piw.tsd_thing(self.fgthing)

            self.stdio = (sys.stdout, sys.stderr)

            if not self.opts.noredirect:
                sys.stdout = session.Logger()
                sys.stderr = sys.stdout

            self.backend_context = self.__create_context('eigend-backend')

            resource.clean_current_setup()

            def bginit():
                self.agent = agentd.Agent(self, 1)
                piw.tsd_thing(self.bgthing)

            self.collector = GarbageCollector(self.scaffold,
                                              self.garbage_context)
            self.collector.start()

            if os.getenv('PI_NOCHECK') is None:
                self.latest_release.start(cookie, info)

            self.run_background(bginit)
        except:
            print >> sys.__stdout__, 'Initialisation failure'
            traceback.print_exc(limit=None, file=sys.__stdout__)
            raise