Esempio n. 1
0
    def __init__(self, input_handler: Callable, bindings: KeyBindings,
                 completer: Completer):
        use_asyncio_event_loop()
        self.input_field = create_input_field(completer=completer)
        self.output_field = create_output_field()
        self.log_field = create_log_field()
        self.layout = generate_layout(self.input_field, self.output_field,
                                      self.log_field)

        self.bindings = bindings
        self.input_handler = input_handler
        self.input_field.accept_handler = self.accept
        self.app = Application(layout=self.layout,
                               full_screen=True,
                               key_bindings=self.bindings,
                               style=load_style(),
                               mouse_support=True,
                               clipboard=PyperclipClipboard())
        self.log_lines: Deque[str] = deque()
        self.log(HEADER)

        # settings
        self.prompt_text = ">>> "
        self.pending_input = None
        self.input_event = None
        self.hide_input = False
    def __init__(self, input_handler: Callable, bindings: KeyBindings,
                 completer: Completer):
        self.search_field = create_search_field()
        self.input_field = create_input_field(completer=completer)
        self.output_field = create_output_field()
        self.log_field = create_log_field(self.search_field)
        self.timer = create_timer()
        self.process_usage = create_process_monitor()
        self.trade_monitor = create_trade_monitor()
        self.layout = generate_layout(self.input_field, self.output_field,
                                      self.log_field, self.search_field,
                                      self.timer, self.process_usage,
                                      self.trade_monitor)
        # add self.to_stop_config to know if cancel is triggered
        self.to_stop_config: bool = False

        self.live_updates = False
        self.bindings = bindings
        self.input_handler = input_handler
        self.input_field.accept_handler = self.accept
        self.app: Optional[Application] = None

        # settings
        self.prompt_text = ">>> "
        self.pending_input = None
        self.input_event = None
        self.hide_input = False

        # start ui tasks
        loop = asyncio.get_event_loop()
        loop.create_task(start_timer(self.timer))
        loop.create_task(start_process_monitor(self.process_usage))
        loop.create_task(start_trade_monitor(self.trade_monitor))
Esempio n. 3
0
    def __init__(self, input_handler: Callable, bindings: KeyBindings,
                 completer: Completer):
        self.search_field = create_search_field()
        self.input_field = create_input_field(completer=completer)
        self.output_field = create_output_field()
        self.log_field = create_log_field(self.search_field)
        self.layout = generate_layout(self.input_field, self.output_field,
                                      self.log_field, self.search_field)
        # add self.to_stop_config to know if cancel is triggered
        self.to_stop_config: bool = False

        self.bindings = bindings
        self.input_handler = input_handler
        self.input_field.accept_handler = self.accept
        self.app = Application(layout=self.layout,
                               full_screen=True,
                               key_bindings=self.bindings,
                               style=load_style(),
                               mouse_support=True,
                               clipboard=PyperclipClipboard())

        # settings
        self.prompt_text = ">>> "
        self.pending_input = None
        self.input_event = None
        self.hide_input = False
Esempio n. 4
0
    def __init__(self, client_config_map: ClientConfigAdapter,
                 input_handler: Callable, bindings: KeyBindings,
                 completer: Completer, command_tabs: Dict[str, CommandTab]):
        super().__init__()
        self.client_config_map: Union[ClientConfigAdapter,
                                      ClientConfigMap] = client_config_map
        self.command_tabs = command_tabs
        self.search_field = create_search_field()
        self.input_field = create_input_field(completer=completer)
        self.output_field = create_output_field(client_config_map)
        self.log_field = create_log_field(self.search_field)
        self.right_pane_toggle = create_log_toggle(self.toggle_right_pane)
        self.live_field = create_live_field()
        self.log_field_button = create_tab_button("Log-pane",
                                                  self.log_button_clicked)
        self.timer = create_timer()
        self.process_usage = create_process_monitor()
        self.trade_monitor = create_trade_monitor()
        self.layout, self.layout_components = generate_layout(
            self.input_field, self.output_field, self.log_field,
            self.right_pane_toggle, self.log_field_button, self.search_field,
            self.timer, self.process_usage, self.trade_monitor,
            self.command_tabs)
        # add self.to_stop_config to know if cancel is triggered
        self.to_stop_config: bool = False

        self.live_updates = False
        self.bindings = bindings
        self.input_handler = input_handler
        self.input_field.accept_handler = self.accept
        self.app: Optional[Application] = None

        # settings
        self.prompt_text = ">>> "
        self.pending_input = None
        self.input_event = None
        self.hide_input = False

        # stdout redirection stack
        self._stdout_redirect_context: ExitStack = ExitStack()

        # start ui tasks
        loop = asyncio.get_event_loop()
        loop.create_task(start_timer(self.timer))
        loop.create_task(start_process_monitor(self.process_usage))
        loop.create_task(start_trade_monitor(self.trade_monitor))
Esempio n. 5
0
    def __init__(self, input_handler: Callable, bindings: KeyBindings,
                 completer: Completer):
        self.search_field = create_search_field()
        self.input_field = create_input_field(completer=completer)
        self.output_field = create_output_field()
        self.log_field = create_log_field(self.search_field)
        self.timer = create_timer()
        self.process_usage = create_process_monitor()
        self.trade_monitor = create_trade_monitor()
        self.layout = generate_layout(self.input_field, self.output_field,
                                      self.log_field, self.search_field,
                                      self.timer, self.process_usage,
                                      self.trade_monitor)
        # add self.to_stop_config to know if cancel is triggered
        self.to_stop_config: bool = False

        self.live_updates = False
        self.bindings = bindings
        self.input_handler = input_handler
        self.input_field.accept_handler = self.accept
        self.app = Application(layout=self.layout,
                               full_screen=True,
                               key_bindings=self.bindings,
                               style=load_style(),
                               mouse_support=True,
                               clipboard=PyperclipClipboard())

        # settings
        self.prompt_text = ">>> "
        self.pending_input = None
        self.input_event = None
        self.hide_input = False

        # start ui tasks
        loop = asyncio.get_event_loop()
        loop.create_task(start_timer(self.timer))
        loop.create_task(start_process_monitor(self.process_usage))
        loop.create_task(start_trade_monitor(self.trade_monitor))