def mainException(self): if isinstance(sys.exc_info()[1], KeyboardInterrupt): self.logger.warn("Timer interrupted at user request; program " "terminating.\n") self.terminate() else: UIBase.mainException(self)
def terminate(self, *args, **kwargs): curses.nocbreak(); self.stdscr.keypad(0); curses.echo() curses.endwin() # need to remove the Curses console handler now and replace with # basic one, so exceptions and stuff are properly displayed self.logger.removeHandler(self._log_con_handler) UIBase.setup_consolehandler(self) # finally call parent terminate which prints out exceptions etc super(Blinkenlights, self).terminate(*args, **kwargs)
def terminate(self, *args, **kwargs): curses.nocbreak() self.stdscr.keypad(0) curses.echo() curses.endwin() # need to remove the Curses console handler now and replace with # basic one, so exceptions and stuff are properly displayed self.logger.removeHandler(self._log_con_handler) UIBase.setup_consolehandler(self) # reset the warning method, we do not have curses anymore self.warn = super(Blinkenlights, self).warn # finally call parent terminate which prints out exceptions etc super(Blinkenlights, self).terminate(*args, **kwargs)
def threadExited(s, thread): threadid = thread.threadid accountname = s.getthreadaccount(thread) s.tflock.acquire() try: if threadid in s.threadframes[accountname]: tf = s.threadframes[accountname][threadid] del s.threadframes[accountname][threadid] s.availablethreadframes[accountname].append(tf) tf.setthread(None) finally: s.tflock.release() UIBase.threadExited(s, thread)
def mainException(self): UIBase.mainException(self)
def sleep(s, sleepsecs, siglistener): s.gettf().setcolor('red') s.getaccountframe().startsleep(sleepsecs) return UIBase.sleep(s, sleepsecs, siglistener)
def unregisterthread(s, thread): UIBase.unregisterthread(s, thread) s._printData(s.logger.info, 'unregisterthread', thread.getName())
def threadExited(s, thread): s._printData(s.logger.info, 'threadExited', thread.getName()) UIBase.threadExited(s, thread)
def unregisterthread(s, thread): UIBase.unregisterthread(s, thread) s._printData('unregisterthread', thread.getName())
def threadException(self, thread): #self._log_con_handler.stop() UIBase.threadException(self, thread)
def threadExited(s, thread): s._printData('threadExited', thread.getName()) UIBase.threadExited(s, thread)
def sleep(s, sleepsecs, account): s.gettf().setcolor('red') s.getaccountframe().startsleep(sleepsecs) return UIBase.sleep(s, sleepsecs, account)