def on_start(self): self.application.subscribe(KeyStroke, self, self.on_key_stroke) self.application.subscribe(TextBoxSubmit, self, self.on_enter_pressed) self.application.subscribe(ScrollChange, self, self.on_scroll_change) self.display_state = { "editor": { "items": [], "line_generator": partial(make_text_editor, self.screen), "input_handler": handle_text_editor_input }, "spacer": { "line_generator": make_spacer }, "search_bar": { "label": "Search", "fixed_size": 1, "line_generator": make_text_input, "input_handler": handle_text_box_input }, "bottom_bar": { "items": {}, "fixed_size": 2, "line_generator": make_bottom_bar } } self.display_state[self.focus]["focused"] = True self.log_watcher = CentralDispatch.future( self._run_log_watcher, self.application.log_filename)
def start(self, activity: Activity): self.setup_logger() curses.curs_set(0) CentralDispatch.default_exception_handler = self._shutdown_app_exception_handler self.main_thread = CentralDispatch.create_serial_queue() self.subscribe(event_type=ExceptionOccured, activity=self, callback=self.on_exception) self.subscribe(event_type=KeyStroke, activity=self, callback=self.on_key_stroke) self.shutdown_signal = CentralDispatch.future(self._event_monitor) self.start_key_monitor() self.on_start() self.segue_to(activity) shutdown_event = self.shutdown_signal.result() self.handle_shutdown(shutdown_event)
def start_folder_scan(self, path): CentralDispatch.future(self._scan_folder, Path(path))
def start_key_monitor(self): CentralDispatch.future(self._key_monitor, self.curses_screen)