예제 #1
0
    def on_start(self):
        self.collect_results_dispatch_queue = CentralDispatch.create_serial_queue(
        )
        self.folder_work_dispatch_queue = CentralDispatch.create_concurrent_queue(
            size=5)

        self.start_folder_scan(self.args.path)
예제 #2
0
    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)
예제 #3
0
    def _refresh_timer(self, shutdown_signal):
        timer = CentralDispatch.timer(1.0, self._refresh_timer, shutdown_signal)

        if not shutdown_signal.done() and self.application is not None:
            timer.start()

            self.refresh_tree_state()

            if not shutdown_signal.done():
                self.application.main_thread.submit_async(self.refresh_screen)
예제 #4
0
    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)
예제 #5
0
 def start_folder_scan(self, path):
     CentralDispatch.future(self._scan_folder, Path(path))
예제 #6
0
 def start_key_monitor(self):
     CentralDispatch.future(self._key_monitor, self.curses_screen)