def __init__(self, config_file): super(CTMain, self).__init__() set_log_level(LogLevel.DEBUG) self.config_service = ConfigService(config_file) self.timer_service = TimerService(self, self.config_service) self.ui_service = UIService(UI_TIMEOUT, self.config_service.password)
class CTMain(object): def __init__(self, config_file): super(CTMain, self).__init__() set_log_level(LogLevel.DEBUG) self.config_service = ConfigService(config_file) self.timer_service = TimerService(self, self.config_service) self.ui_service = UIService(UI_TIMEOUT, self.config_service.password) #self.session_service = SessionService(self) #self.input_service = InputService(self) def start(self): # initially we're running but not counting self.timer_service.pause() self.timer_service.start() #self.session_service.start() #self.input_service.start() while True: try: sleep(1) except KeyboardInterrupt: info ("\nStopping!") self.timer_service.stop() break def timer_alert(self): info ("timer alert!") result = self.ui_service.get_input() if Results.TIMEOUT == result: info ("timeout") elif Results.SHUTDOWN == result: info ("shutdown") else: ext = datetime.now().replace(hour=0, minute=result, second=0, microsecond=0) self.timer_service.extension = ext self.timer_service.activate_alerts() def login(self): info ("login!") self.timer_service.resume() def logout(self): info ("logout!") self.timer_service.pause() def inactive(self): info ("inactive!") self.timer_service.pause() def active(self): info ("active!") self.timer_service.resume()