def processGuiSignal(self, flag, name): '''Receive flags from the Front End as user input TODO: Not all needed ''' name = name.split('_')[0] logger.info('Received signal from GUI: ' + flag[0]) if flag[0]: if flag[0] == Spike.run(): logger.info('Begin run!') #self.flags['run'] = True self.run() elif flag[0] == Spike.setup(): logger.info('Running setup') self.setup() elif flag[0] == Spike.ready(): logger.info('GUI ready') self.actorStates[name] = flag[0] elif flag[0] == Spike.quit(): logger.warning('Quitting the program!') self.flags['quit'] = True self.quit() elif flag[0] == Spike.load(): logger.info('Loading Tweak config from file ' + flag[1]) self.loadTweak(flag[1]) elif flag[0] == Spike.pause(): logger.info('Pausing processes') # TODO. Alsoresume, reset else: logger.error( 'Signal received from Nexus but cannot identify {}'.format( flag))
def run(self): if self.allowStart: for q in self.sig_queues.values(): try: q.put_nowait(Spike.run()) except Full: logger.warning('Signal queue' + q.name + 'is full')
def run(self): while True: if self.flag: try: self.checkStore2() except Exception as e: logger.error('Watcher exception during run: {}'.format(e)) #break try: signal = self.q_sig.get(timeout=0.005) if signal == Spike.run(): self.flag = True logger.warning('Received run signal, begin running') elif signal == Spike.quit(): logger.warning('Received quit signal, aborting') break elif signal == Spike.pause(): logger.warning('Received pause signal, pending...') self.flag = False elif signal == Spike.resume(): #currently treat as same as run logger.warning('Received resume signal, resuming') self.flag = True except Empty as e: pass #no signal from Nexus
def _runProcess(self): '''Run ImageProcessor in separate thread ''' self.comm.put([Spike.run()]) logger.info('------------------------- put run in comm')