Exemplo n.º 1
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)
Exemplo n.º 2
0
 def nativekeyboard_setup(self):
     if self.usbdev is not None:
         self.audio_output_setup()
         self.keyboard = keyboard_native.alpha2_bundle(
             self.usbdev, self.kclone.cookie(), self.audio_output.cookie(),
             utils.notify(self.dead))
         self.audio_input_setup()
     else:
         self.keyboard = keyboard_native.alpha2_bundle_legacy(
             self.usbname, self.kclone.cookie(), utils.notify(self.dead))
Exemplo n.º 3
0
    def __loadverb(self,subject,t):

        tag = self.__process_tag(action.abstract_string(t))
        path = find_setup(tag)

        if not path:
            print 'no such state',tag
            thing= 'setup %s' %str(tag)
            return async.success(errors.doesnt_exist(thing,'load'))


        def deferred_load():
            self.__thing.cancel_timer_slow()
            self.__thing = None
            snap = self.prepare_file(path,self.uid,version.version)

            if not snap:
                print 'no such state'
                return async.failure('no such state %s' % tag)

            print 'loading from version',snap.version(),'in',tag
            self.setups_changed(path)
            self.__load(snap,tag)

        self.__thing = piw.thing()
        piw.tsd_thing(self.__thing)
        self.__thing.set_slow_timer_handler(utils.notify(deferred_load))
        self.__thing.timer_slow(500)
        return async.success()
Exemplo n.º 4
0
 def __init__(self):
     self.plugins_by_manufacturer = dict()
     self.plugins_by_id = dict()
     self.listeners = []
     self.__list = host_native.plugin_list(self.__plugins_cache,
                                           utils.notify(self.__setup))
     self.__setup()
Exemplo n.º 5
0
 def nativekeyboard_setup(self):
     self.keyboard = keyboard_native.tau_bundle(self.usbdev,
                                                self.kclone.cookie(),
                                                utils.notify(self.dead))
     self.audio_input = bundles.ScalarInput(self.keyboard.audio_cookie(),
                                            self.domain,
                                            signals=(1, 2))
     self[103] = HeadphoneInput(self)
Exemplo n.º 6
0
    def setUp(self):
        self.context = self.manager.context(utils.notify(None),
                                            utils.stringify(self.logger),
                                            'test')
        piw.setenv(self.context.getenv())

        if self.logger is not None:
            self.oldstd = sys.stdout, sys.stderr
            sys.stdout, sys.stderr = self.logger.Logger(), sys.stdout
Exemplo n.º 7
0
    def server_opened(self):
        audio.AudioOutput.server_opened(self)
        self.__agent.keyboard.mic_disabled(utils.notify(self.__notify))
        self.__agent.keyboard.set_mic_quality(self[109].get_value());
        self.__agent.keyboard.loopback_enable(self[104].get_value())
        self.__agent.keyboard.mic_automute(self[106].get_value())
        self.__agent.keyboard.loopback_gain(volume_function(self[105].get_value()))

        self.__agent.update()
Exemplo n.º 8
0
    def __init__(self,name):
        self.__timer = piw.thing()
        self.__index = piw.index()

        piw.tsd_index(name,self.__index)
        piw.tsd_thing(self.__timer)

        self.__timer.set_slow_timer_handler(utils.notify(self.__timercallback))
        self.__timer.timer_slow(8000)
Exemplo n.º 9
0
    def __init__(self):
        eigend_native.c2p.__init__(self)
        self.bugfiler = bugs.BugFiler(self)
        self.collector = None
        self.__progress = None
        self.__progress_lock = threading.Lock()
        self.saving = False
        self.quitting = False
        self.savcond = threading.Condition()

        self.fgthing = piw.thing()
        self.fgthing.set_slow_trigger_handler(utils.notify(self.fgdequeue))
        self.fgqueue = []

        self.bgthing = piw.thing()
        self.bgthing.set_slow_trigger_handler(utils.notify(self.bgdequeue))
        self.bgqueue = []

        upgrade.clr_tmp_setup()
Exemplo n.º 10
0
    def __init__(self,clockdomain,*outputs):
        piw.splitter.__init__(self)
        self.__outputs = []

        self.clockdomain = clockdomain
        self.clockdomain.add_listener(utils.notify(self.__listener))
        self.__listener()

        for o in outputs:
            self.add_output(o)
Exemplo n.º 11
0
 def __init__(self, usbname, agent):
     self.__usbname = usbname
     self.__agent = agent
     self.__thing = piw.thing()
     self.__device = 0
     self.__instrument = 0
     self.__kbd = None
     piw.tsd_thing(self.__thing)
     self.__thing.set_slow_timer_handler(utils.notify(self.__poll))
     self.__counter = itertools.cycle([1] + [0] * 20)
     self.__thing.timer_slow(1000)
Exemplo n.º 12
0
    def __init__(self):
        eigend_native.c2p.__init__(self)
        self.latest_release = latest_release.LatestReleasePoller(self)
        self.collector = None
        self.__progress = None
        self.__progress_lock = threading.Lock()
        self.saving = False
        self.quitting = False
        self.savcond = threading.Condition()
        self.current_setup = None
        self.current_setup_user = False

        self.fgthing = piw.thing()
        self.fgthing.set_slow_trigger_handler(utils.notify(self.fgdequeue))
        self.fgqueue = []

        self.bgthing = piw.thing()
        self.bgthing.set_slow_trigger_handler(utils.notify(self.bgdequeue))
        self.bgqueue = []
        self.frontend = None

        upgrade.clr_tmp_setup()
Exemplo n.º 13
0
    def __init__(self,usbname,ordinal,dom,remove):
        agent.Agent.__init__(self,names='keyboard pico',ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='is_subsys')

        self.usbname=usbname
        self.remover=remove

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self[1] = bundles.Output(1,False, names='activation output')
        self[2] = bundles.Output(2,False, names='pressure output')
        self[3] = bundles.Output(3,False, names='roll output')
        self[4] = bundles.Output(4,False, names='yaw output')

        self[5] = bundles.Output(1,False, names='strip position output')
        self[6] = bundles.Output(1,False, names='breath output')
        self[8] = bundles.Output(2,False, names='absolute strip output')
        
        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[7] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.soutput = bundles.Splitter(self.domain,self[5],self[8])
        self.boutput = bundles.Splitter(self.domain,self[6])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.soutput.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(3,self.boutput.cookie(),piw.first_filter(3))
        self.keyboard=pkbd_native.bundle(usbname,self.kclone.cookie(),utils.notify(self.dead),utils.changify(self.signal))

        self[100] = VirtualKey()
        #self[102] = vc

        self[251] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold1(), protocols='input output', names='soft threshold', policy=atom.default_policy(self.keyboard.set_threshold1))
        self[249] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold2(), protocols='input output', names='hard threshold', policy=atom.default_policy(self.keyboard.set_threshold2))
        self[240] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_roll_axis_window(), protocols='input output', names='roll axis window', policy=atom.default_policy(self.keyboard.set_roll_axis_window))
        self[241] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_yaw_axis_window(), protocols='input output', names='yaw axis window', policy=atom.default_policy(self.keyboard.set_yaw_axis_window))
        self[242] = atom.Atom(domain=domain.Bool(), init=False, protocols='input output nostage', names='k logging', policy=atom.default_policy(self.keyboard.enable_key_logging))

        f=self.keyboard.led_functor()
        self.led_backend.set_functor(piw.pathnull(0),f)

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.__courses())
Exemplo n.º 14
0
def deferred_call(func, *args, **kwds):
    r = Deferred()

    def call():
        try:
            v = func(*args, **kwds)
            r.succeeded(v)
        except:
            utils.log_trace()
            r.failed('internal error')

    r.thing = piw.thing()
    piw.tsd_thing(r.thing)
    r.thing.set_slow_trigger_handler(utils.notify(call))
    r.thing.trigger_slow()

    return r
Exemplo n.º 15
0
    def __loadverb(self, subject, t):
        tag = self.__process_tag(action.abstract_string(t))
        path = find_setup(tag)

        if not path:
            print 'no such state', tag
            thing = 'setup %s' % str(tag)
            return async .success(errors.doesnt_exist(thing, 'load'))

        def deferred_load():
            self.__thing.cancel_timer_slow()
            self.__thing = None
            self.__backend.setups_changed(path)
            self.__workspace.load_file(path)

        self.__thing = piw.thing()
        piw.tsd_thing(self.__thing)
        self.__thing.set_slow_timer_handler(utils.notify(deferred_load))
        self.__thing.timer_slow(500)
        return async .success()
Exemplo n.º 16
0
    def __init__(self, callback):
        self.__callback = callback

        self.__user_file_name = resource.user_resource_file(
            'Fingerer', 'User Fingerings.txt', version='')
        self.__factory_file_name = os.path.join(os.path.dirname(__file__),
                                                'Factory Fingerings.txt')
        self.__user_seed_file = resource.find_release_resource(
            'fingerer', 'User Fingerings.txt')
        self.__timestamp = piw.tsd_time()
        self.__timer = piw.thing()
        self.__timer.set_slow_timer_handler(utils.notify(
            self.__timer_callback))

        if not resource.os_path_exists(
                self.__user_file_name) and resource.os_path_exists(
                    self.__user_seed_file):
            resource.shutil_copyfile(self.__user_seed_file,
                                     self.__user_file_name)

        self.__user_file_time = 0
        self.__factory_fingerings = {}
        self.__user_fingerings = {}

        self.__load_factory()
        self.__load_user()

        fn = set(self.__factory_fingerings.keys())
        fn.update(set(self.__user_fingerings.keys()))

        atom.Atom.__init__(self,
                           names='fingering',
                           domain=domain.String(),
                           init='simple whistle',
                           policy=atom.default_policy(self.__change_fingering),
                           protocols='browse')
Exemplo n.º 17
0
 def nativekeyboard_setup(self):
     self.keyboard=keyboard_native.bundle(self.usbname,self.kclone.cookie(),utils.notify(self.dead))
Exemplo n.º 18
0
 def nativekeyboard_setup(self):
     self.keyboard = keyboard_native.tau_bundle(self.usbdev,
                                                self.kclone.cookie(),
                                                utils.notify(self.dead))
     self.audio_input_setup()
Exemplo n.º 19
0
 def shutdown(self):
     self.__thing = piw.thing()
     piw.tsd_thing(self.__thing)
     self.__thing.set_slow_timer_handler(utils.notify(self.__shutdown))
     self.__thing.timer_slow(500)