예제 #1
0
def generate_layout(input_field: TextArea, output_field: TextArea,
                    log_field: TextArea, search_field: SearchToolbar):
    root_container = HSplit([
        VSplit([
            Window(FormattedTextControl(get_version), style="class:title"),
            Window(FormattedTextControl(get_paper_trade_status),
                   style="class:title"),
            Window(FormattedTextControl(get_title_bar_right_text),
                   align=WindowAlign.RIGHT,
                   style="class:title"),
        ],
               height=1),
        VSplit([
            FloatContainer(
                HSplit([
                    output_field,
                    Window(height=1, char='-', style='class:primary'),
                    input_field,
                ]),
                [
                    # Completion menus.
                    Float(xcursor=True,
                          ycursor=True,
                          transparent=True,
                          content=CompletionsMenu(max_height=16,
                                                  scroll_offset=1)),
                ]),
            Window(width=1, char='|', style='class:primary'),
            HSplit([
                log_field,
                search_field,
            ]),
        ]),
    ])
    return Layout(root_container, focused_element=input_field)
예제 #2
0
    def init_layout(self):
        for i in range(len(self.top_screens)):
            s = self.top_screens[i]
            s.app = self
            s.screen_idx = i
            self.screen_sel_buttons.append(
                Button(text="%s %s" % (s.shortcut.upper(), s.shortcut_label),
                       handler=s.screen_sel))

        self.lbl_screen = Label(text=self.top_screens[0].title)

        self.top_screen = DynamicContainer(self.get_top_screen_container)

        btn_action = Button(text="F8 Action", handler=self.f_action)
        btn_exit = Button(text="F10 Exit", handler=self.f_exit)

        self.root_container = FloatContainer(
            HSplit([
                Box(
                    body=VSplit([self.lbl_screen], align="CENTER", padding=3),
                    style="class:button-bar",
                    height=1,
                ),
                self.top_screen,
                Box(
                    body=VSplit(self.screen_sel_buttons +
                                [btn_action, btn_exit],
                                align="CENTER",
                                padding=3),
                    style="class:button-bar",
                    height=1,
                ),
            ]), self.floats)
        self.top_layout = Layout(self.root_container,
                                 focused_element=self.screen_sel_buttons[0])
예제 #3
0
def create_popup_window(title, body):
    """
    Return the layout for a pop-up window. It consists of a title bar showing
    the `title` text, and a body layout. The window is surrounded by borders.
    """
    assert isinstance(title, six.text_type)
    assert isinstance(body, Container)

    return HSplit([
        VSplit([
            Window(width=D.exact(1), height=D.exact(1),
                   content=FillControl(BORDER.TOP_LEFT, token=Token.Window.Border)),
            TokenListToolbar(
                get_tokens=lambda cli: [(Token.Window.Title, ' %s ' % title)],
                align_center=True,
                default_char=Char(BORDER.HORIZONTAL, Token.Window.Border)),
            Window(width=D.exact(1), height=D.exact(1),
                   content=FillControl(BORDER.TOP_RIGHT, token=Token.Window.Border)),
        ]),
        VSplit([
            Window(width=D.exact(1),
                   content=FillControl(BORDER.VERTICAL, token=Token.Window.Border)),
            body,
            Window(width=D.exact(1),
                   content=FillControl(BORDER.VERTICAL, token=Token.Window.Border)),
        ]),
        VSplit([
            Window(width=D.exact(1), height=D.exact(1),
                   content=FillControl(BORDER.BOTTOM_LEFT, token=Token.Window.Border)),
            Window(height=D.exact(1),
                   content=FillControl(BORDER.HORIZONTAL, token=Token.Window.Border)),
            Window(width=D.exact(1), height=D.exact(1),
                   content=FillControl(BORDER.BOTTOM_RIGHT, token=Token.Window.Border)),
        ]),
    ])
예제 #4
0
 def update_layout(self):
     if self.overview:
         self.layout = Layout(
             HSplit([
                 self.header,
                 VSplit([
                     HSplit(self.server_windows),
                     HSplit([
                         self.overview,
                         Window(FormattedTextControl(
                             text="[Ins ][Home][PgUp]\n[Del ][End ][PgDn]"),
                                style="class:overview",
                                height=2,
                                align=WindowAlign.CENTER,
                                dont_extend_height=True),
                     ]),
                 ]),
                 self.footer,
             ]), )
     else:
         self.layout = Layout(
             HSplit([
                 self.header,
                 VSplit([
                     HSplit(self.server_windows),
                 ]),
                 self.footer,
             ]), )
예제 #5
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.riitag_info = user.RiitagInfo()  # placeholder

        self.menu_settings_button = Button(
            'Settings', handler=lambda: self._set_state('Settings'))
        self.menu_exit_button = Button('Exit', handler=self.quit_app)
        self.menu_logout_button = Button('Logout', handler=self._logout)

        self.settings_back_button = Button(
            'Back...', width=12, handler=lambda: self._set_state('Menu'))
        self.settings_reset_button = Button('Reset...',
                                            width=12,
                                            handler=self._reset_preferences)
        self.settings_pres_timeout_button = PreferenceButton(
            value=self.app.preferences.presence_timeout,
            increments=10,
            limits=(10, 120))
        self.settings_check_interval_button = PreferenceButton(
            value=self.app.preferences.check_interval,
            increments=10,
            limits=(10, 60))

        self.right_panel_state = 'Menu'
        self.menu_layout = Frame(Box(HSplit([
            self.menu_settings_button,
            Label(''),
            self.menu_exit_button,
            self.menu_logout_button,
        ]),
                                     padding_left=3,
                                     padding_top=2),
                                 title='Menu')
        self.settings_layout = Frame(Box(HSplit([
            Window(FormattedTextControl(
                HTML(
                    'This is where you can modify settings\nregarding the underlying presence\nwatcher.'
                )),
                   wrap_lines=True,
                   width=25),
            Label(''),
            VSplit([
                Label('Presence Timeout (min.):'),
                self.settings_pres_timeout_button
            ],
                   width=15),
            VSplit([
                Label('Refresh Interval (sec.):'),
                self.settings_check_interval_button
            ],
                   padding=3),
            Label(''),
            VSplit([self.settings_back_button, self.settings_reset_button],
                   align=WindowAlign.CENTER)
        ]),
                                         padding_left=3,
                                         padding_top=2),
                                     title='Settings')
예제 #6
0
 def create_layout(self):
     inout_cells = list(
         itertools.chain.from_iterable([(
             VSplit([cell.input_prefix, cell.input]),
             VSplit([cell.output_prefix, ONE_COL, cell.output]),
         ) for cell in self.cells]))
     root_container = ScrollablePane(HSplit(inout_cells))
     self.layout = Layout(root_container)
예제 #7
0
def make_canvas(_noise, args):

    global noise
    global debug_file
    global root_container

    noise = _noise

    ui = [
        VSplit(
            [
                Frame(
                    title="Delete noise until only signal remains",
                    body=Window(content=BufferControl(buffer=buffer)),
                ),
                Frame(
                    title="Signals",
                    body=Window(width=15, content=subcanvasses_display),
                ),
                Frame(title="Gaps", body=Window(width=10, content=gaps_display)),
            ]
        ),
        VSplit(
            [
                Window(content=FormattedTextControl(text=legend_left)),
                Window(content=FormattedTextControl(text=legend_center)),
                Window(
                    content=FormattedTextControl(text=legend_right),
                    align=WindowAlign.RIGHT,
                ),
            ]
        ),
    ]

    if args.debug:
        debug_file = open(config.runtime.debug_log, "w")
        debug(f"cog started {datetime.now()}")
        ui.append(HorizontalLine())
        ui.append(Window(content=debug_display))

    root_container = HSplit(ui)

    subcanvasses.append(Data(Kind.signal, noise))

    # start with the input noise as the signal
    buffer.text = noise

    kb = KeyBindings()

    @kb.add("c-c")
    def done(event):
        event.app.exit()

    # https://github.com/prompt-toolkit/python-prompt-toolkit/issues/502#issuecomment-466591259
    sys.stdin = sys.stderr
    Application(
        key_bindings=kb, layout=Layout(root_container), editing_mode=EditingMode.VI
    ).run()
예제 #8
0
def generate_layout(
    input_field: TextArea,
    output_field: TextArea,
    log_field: TextArea,
    search_log_field: SearchToolbar,
    search_out_field: SearchToolbar,
    timer: TextArea,
    process_monitor: TextArea,
    # trade_monitor: TextArea):
):
    root_container = HSplit([
        # VSplit([
        #     Window(FormattedTextControl(get_version), style="class:title"),
        #     # Window(FormattedTextControl(get_paper_trade_status), style="class:title"),
        #     # Window(FormattedTextControl(get_active_strategy), style="class:title"),
        #     # Window(FormattedTextControl(get_active_markets), style="class:title"),
        #     # Window(FormattedTextControl(get_script_file), style="class:title"),
        #     # Window(FormattedTextControl(get_strategy_file), style="class:title"),
        # ], height=1),
        VSplit([
            FloatContainer(
                HSplit([
                    output_field,
                    Window(height=1, char='-', style='class:primary'),
                    Window(FormattedTextControl(get_partial_args),
                           style="class:title"),
                    Window(height=1, char='-', style='class:primary'),
                    input_field,
                ]),
                [
                    # Completion menus.
                    Float(xcursor=True,
                          ycursor=True,
                          transparent=True,
                          content=CompletionsMenu(max_height=16,
                                                  scroll_offset=1)),
                ]),
            Window(width=1, char='|', style='class:primary'),
            HSplit([log_field, search_log_field, search_out_field]),
        ]),
        VSplit(
            [
                # trade_monitor,
                process_monitor,
                timer,
            ],
            height=1),
    ])
    return Layout(root_container, focused_element=input_field)
예제 #9
0
    def __init__(self):
        self.lira = LiraApp()
        self.lira.setup()

        self.content = ContentArea(self)
        self.status = StatusBar(self)

        self.menu = SidebarMenu(self)
        self.menu.reset(BooksList(self))

        self.container = HSplit(
            [
                VSplit(
                    [
                        self.menu,
                        self.content,
                    ],
                    padding=Dimension.exact(1),
                    padding_char="│",
                    padding_style=theme["separator"],
                ),
                self.status,
            ],
            padding=Dimension.exact(1),
            padding_char="─",
            padding_style=theme["separator"],
        )
        self.app = Application(
            layout=Layout(self.container),
            key_bindings=self.get_key_bindings(),
            mouse_support=True,
            full_screen=True,
            style=style,
            after_render=self._ready,
        )
예제 #10
0
def MenuScreen(controller):
    def on_start_click():
        new_state = PlayingScreenState(username=controller.state.username,
                                       choice_history=[root_branch],
                                       choice_index=0,
                                       start_time=time())
        controller.set_state(new_state)

    def on_help_click():
        new_state = HelpScreenState(username=controller.state.username,
                                    previous_state=controller.state)
        controller.set_state(new_state)

    buttons = [
        Button('start', handler=on_start_click),
        Button('help', handler=on_help_click),
        Button('quit', handler=exit_current_app)
    ]

    kb = create_vertical_button_list_kbs(buttons)

    body = Box(
        VSplit([
            HSplit(children=buttons,
                   padding=Dimension(preferred=1, max=1),
                   key_bindings=kb)
        ]))

    toolbar_content = Window(content=FormattedTextControl(
        'Hello %s. I wish you the best of luck...' %
        controller.state.username),
                             align=WindowAlign.CENTER,
                             height=1)

    return ToolbarFrame(body, toolbar_content)
예제 #11
0
파일: layout.py 프로젝트: bdastur/os-shell
    def __init__(self,
                 message="openstack> ",
                 menu_height=12,
                 multiwindow=False):
        toolbar = Toolbar()
        main_layout = create_prompt_layout(
             message=message,
             lexer=OSLexer,
             get_bottom_toolbar_tokens=toolbar.handler,
             reserve_space_for_menu=menu_height)

        if multiwindow:
            self.mlayout = VSplit([
                main_layout,
                Window(width=D.exact(1),
                       content=FillControl('|', token=Token.Line)),
                Window(width=D.exact(70),
                       wrap_lines=True,
                       content=BufferControl(buffer_name='HELP')),
            ])

        if multiwindow:
            self.layout = self.mlayout
        else:
            self.layout = main_layout
예제 #12
0
    def get_root_container(self) -> FloatContainer:
        buttons = [
            *self._game_buttons.keys(),
            HorizontalLine(),
            Button("Quit", width=MENU_BUTTON_WIDTH, handler=self._exit),
        ]

        menu_keybindings = _create_menu_keybindings(buttons)

        game_buttons_container = Frame(
            HSplit(
                buttons,
                width=Dimension(min=MENU_BUTTON_WIDTH, max=40),
                height=Dimension(),
            ),
            title="Games",
            key_bindings=menu_keybindings,
        )

        game_description_container = Frame(
            Box(
                Label(
                    text=self._get_game_description,
                    dont_extend_height=False,
                    width=Dimension(min=40),
                ),
                padding=0,
                padding_left=1,
            ), )

        return FloatContainer(VSplit([
            game_buttons_container,
            game_description_container,
        ]),
                              floats=[])
예제 #13
0
파일: gui.py 프로젝트: lostatc/skiddie
    def get_root_container(self) -> FloatContainer:
        header_row = self.table.format_table().splitlines()[0]
        data_rows = self.table.format_table().splitlines()[1:]

        row_buttons = [
            SelectableLabel(row,
                            handler=functools.partial(self._handle_answer, i))
            for i, row in enumerate(data_rows)
        ]

        table_container = HSplit([
            Label(FormattedText([("class:column-name", header_row)]), ),
            HorizontalLine(),
            *row_buttons,
        ])

        rules_container = Box(
            Label(
                self.table.format_constraints(separator="\n\n"),
                dont_extend_width=True,
            ), )

        return FloatContainer(
            Box(
                Frame(
                    VSplit([
                        table_container,
                        VerticalLine(),
                        rules_container,
                    ])), ),
            floats=[],
        )
예제 #14
0
def generate_layout(input_field: TextArea, output_field: TextArea,
                    log_field: TextArea):
    root_container = VSplit([
        FloatContainer(
            HSplit([
                output_field,
                Window(height=1, char='-', style='class:line'),
                input_field,
                TextArea(
                    height=1,
                    text=
                    f'Version: {version}    [Ctrl + C] QUIT    Hold down "fn" for selecting and copying text',
                    style='class:label'),
            ]),
            [
                # Completion menus.
                Float(xcursor=True,
                      ycursor=True,
                      transparent=True,
                      content=CompletionsMenu(max_height=16, scroll_offset=1)),
            ]),
        Window(width=1, char='|', style='class:line'),
        log_field,
    ])
    return Layout(root_container, focused_element=input_field)
예제 #15
0
파일: window.py 프로젝트: anakrish/gdbw
    def __init__(self,
                 app=None,
                 show=False,
                 title='[ A Window ]',
                 show_divider=lambda:True,
                 get_lexer=lambda: None,
                 height=Dimension(preferred=1),
                 wrap_lines=False,
                 scroll_offsets=ScrollOffsets()):
        self.app = app
        self.show = show
        self.buffer = Buffer(document=Document(),
                             multiline=True)
        self.control = BufferControl(buffer=self.buffer,
                                     focusable=True,
                                     lexer=self.lexer,
                                     focus_on_click=True)
        self.window = PromptWindow(content=self.control,
                                   height=height,
                                   wrap_lines=wrap_lines,
                                   scroll_offsets=scroll_offsets)

        self.divider = Divider(self, show=show_divider)
        self.info = InfoLine(title, width=240)
        self.container = ConditionalContainer(
            content=VSplit([
                self.divider.get_ui(),
                HSplit([self.info.get_ui(), self.window])]),
            filter=Condition(lambda: self.show))
예제 #16
0
파일: ui.py 프로젝트: y-martinez/lira
    def __init__(self, path):
        self.theme = "default"
        sections_list = []
        for section in ["text", "prompt"]:
            sections_list.append(sections[section])

        book = Book(root=path)
        book.parse()
        chapters = book.chapters[1]
        chapters.parse()

        contents = chapters.contents[0]
        render = self.get_label(contents)
        label = Label(merge_formatted_text(render))

        self.container = HSplit(
            [
                VSplit(
                    [
                        sections["menu"],
                        sections["vseparator"],
                        HSplit([label, sections["prompt"]]),
                    ]
                ),
                sections["hseparator"],
                sections["status"],
            ]
        )
예제 #17
0
    def __init__(self, session):
        self.session = session

        self.tabs_toolbar = TabsToolbar(self.session)
        self.float_container = FloatContainer(
            # Dummy window
            content=VSplit([Window(BufferControl())]),
            floats=[])

        super().__init__(
            children=[
                # Tabs
                self.tabs_toolbar,

                # Seperation line.
                Window(height=1, char='-', style='class:line'),

                # Here goes current tab buffer
                self.float_container
            ],
            window_too_small=None,
            align=VerticalAlign.JUSTIFY,
            padding=0,
            padding_char=None,
            padding_style='',
            width=None,
            height=None,
            z_index=None,
            modal=False,
            key_bindings=None,
            style='')
예제 #18
0
    def __init__(self, key=None, value=None):

        self.key = Label(text=key, width=20)
        self.value = Label(text=value, )
        self.vsplit = VSplit(
            [self.key, Window(width=1, char=' '), self.value],
            align=HorizontalAlign.LEFT)
예제 #19
0
    def __init__(self, body, padding=None,
                 padding_left=None, padding_right=None,
                 padding_top=None, padding_bottom=None,
                 width=None, height=None,
                 style='', char=None, modal=False, key_bindings=None):
        assert is_container(body)

        if padding is None:
            padding = D(preferred=0)

        def get(value):
            if value is None:
                value = padding
            return to_dimension(value)

        self.padding_left = get(padding_left)
        self.padding_right = get(padding_right)
        self.padding_top = get(padding_top)
        self.padding_bottom = get(padding_bottom)
        self.body = body

        self.container = HSplit([
            Window(height=self.padding_top, char=char),
            VSplit([
                Window(width=self.padding_left, char=char),
                body,
                Window(width=self.padding_right, char=char),
            ]),
            Window(height=self.padding_bottom, char=char),
        ],
        width=width, height=height, style=style, modal=modal,
        key_bindings=None)
예제 #20
0
    def __init__(self) -> None:
        self.cmder_input = TextArea(
            height=1, multiline=False, wrap_lines=False, style="class:normal"
        )
        self.input = self.cmder_input

        self.status_bar = Label("Loading status bar...", style="class:status")

        self.console = Frame(
            TextArea(plover_text, focusable=False),
            title="Console",
            style="class:normal",
        )

        self.tape = Tape()
        self.suggestions = Suggestions()

        self.outputs = [self.console]

        self.container = HSplit(
            [
                DynamicContainer(lambda: VSplit(self.outputs)),
                DynamicContainer(lambda: self.input),
                self.status_bar,
            ]
        )
예제 #21
0
    def __init__(self, inpipe):
        self.inpipe = inpipe
        self.tempfile = tempfile.NamedTemporaryFile(mode="w", delete=True)
        self.initialize_nodes()

        root = VSplit(
            [
                # Input buffer and status line
                HSplit(
                    [
                        self.first_line,
                        Window(
                            content=BufferControl(
                                buffer=self.input_buffer,
                                # This lexer is disabled for now because
                                # I don't want to mess with colourschemes
                                # lexer=PygmentsLexer(PythonLexer),
                            )
                        ),
                        self.error_output,
                    ],
                    width=Dimension(),
                ),
                Window(width=1, char="|"),
                # Output display area
                Window(ignore_content_width=True, content=self.output, wrap_lines=True),
            ],
            width=Dimension(),
        )

        layout = Layout(root)

        self.app = Application(layout=layout, key_bindings=kb, full_screen=True)
예제 #22
0
    def __init__(self) -> None:
        self._percentage = 60

        self.label = Label('60%')
        self.container = FloatContainer(
            content=Window(height=1),
            floats=[
                # We first draw the label, then the actual progress bar.  Right
                # now, this is the only way to have the colors of the progress
                # bar appear on top of the label. The problem is that our label
                # can't be part of any `Window` below.
                Float(content=self.label, top=0, bottom=0),
                Float(left=0,
                      top=0,
                      right=0,
                      bottom=0,
                      content=VSplit([
                          Window(
                              style='class:progress-bar.used',
                              width=lambda: D(weight=int(self._percentage))),
                          Window(style='class:progress-bar',
                                 width=lambda: D(weight=int(100 - self.
                                                            _percentage))),
                      ])),
            ])
예제 #23
0
    def create(self, sort_by=None, order=None):

        self.servers = servers.refresh(sort_by=sort_by, order=order)

        servers_output = VSplit([
            self.servers,
            Window(width=1, char='│', style='class:line'),
            response_box.create(),
        ])

        body = HSplit([
            servers_output,
            Window(height=1, char='─', style='class:line'),
            summary_box()
        ])

        title_bar = [
            ('class:title', ' Freud {}'.format(__version__)),
            ('class:title',
             ' (Press [Ctrl-C] to quit. Press [Ctrl-F] for info.)'),
        ]

        self.container = HSplit([
            search_toolbar,
            Window(height=1,
                   content=FormattedTextControl(title_bar),
                   align=WindowAlign.CENTER),
            Window(height=1, char='─', style='class:line'),
            body,
        ])

        return self.container
예제 #24
0
    def show_message(self, title, message, callback=None):
        cancel_button = Button('Cancel', handler=lambda: response_received(False))
        ok_button = Button('OK', handler=lambda: response_received(True))

        def response_received(is_ok):
            if callback:
                callback(is_ok)

            self._float_message_layout = None
            self.layout.focus_next()
            self.invalidate()

        message_frame = Frame(
            HSplit([
                Window(FormattedTextControl(HTML(message + '\n\n')), align=WindowAlign.CENTER),
                VSplit([
                    cancel_button,
                    ok_button
                ], padding=3, align=WindowAlign.CENTER)
            ], padding=1),
            title=title,
        )

        self._float_message_layout = message_frame
        self.layout.focus(cancel_button)
        self.invalidate()
예제 #25
0
파일: regular.py 프로젝트: asmodehn/hex
def application():

    root_container = VSplit([
        # One window that holds the BufferControl with the default buffer on
        # the left.
        input_field,

        # A vertical line in the middle. We explicitly specify the width, to
        # make sure that the layout engine will not try to divide the whole
        # width by three for all these windows. The window will simply fill its
        # content by repeating this character.
        Window(width=1, char='|'),

        # Display the text 'Hello world' on the right.
        Window(content=BufferControl(buffer=right_buffer)),
    ])

    layout = Layout(root_container)

    # TODO : different layout if input/output not a terminal...
    application = Application(
        key_bindings=kb,
        layout=layout,
        full_screen=True,
    )
    return application
예제 #26
0
파일: widgets.py 프로젝트: plotski/upsies
    def __init__(self, text, content, group=None, style=''):
        self.text = text
        self.width = get_cwidth(text)
        self.label = Window(
            content=FormattedTextControl(text=text),
            dont_extend_width=True,
            dont_extend_height=True,
            style=style,
            align=WindowAlign.RIGHT,
        )
        self.container = VSplit([
            # The HSplit makes the label non-greedy, i.e. the label itself takes
            # only one line and the space below is empty with default background
            # color.
            HSplit([self.label]),
            hspacer,
            content,
        ])

        self._group = group
        if group is not None:
            self._groups[group].append(self)
            max_width = max(label.width for label in self._groups[group])
            for label in self._groups[group]:
                label.label.width = max_width + 1
예제 #27
0
 def row(label, default):
     buffer=Buffer()
     buffer.text = default
     return VSplit([
         Label(HTML(f'{label}'), width=10),
         Window(width=2, char=": "),
         Window(content=BufferControl(buffer=buffer)),
     ])
예제 #28
0
	def __init__(self):
		self.top = VSplit([
			Window(width=1, char='│', style='class:line'),
			itemlist.top,
			Window(width=1, char='│', style='class:line'),
			Window(content=BufferControl()),
			Window(width=1, char='│', style='class:line'),
		])
예제 #29
0
    def create_layout(self):
        inout_cells = list(
            itertools.chain.from_iterable([
                (
                    VSplit([cell.input_prefix, cell.input]),
                    VSplit([cell.output_prefix, ONE_COL, cell.output,
                            ONE_COL]),
                )
                for cell in self.cells[self.top_cell_idx:self.bottom_cell_idx +
                                       1  # noqa
                                       ]
            ]))
        nb_window = ScrollablePane(HSplit(inout_cells), show_scrollbar=False)

        def get_top_bar_text():
            text = ""
            if self.dirty:
                text += "+ "
            text += str(self.nb_path.relative_to(self.kernel_cwd))
            if self.dirty and self.quitting:
                text += (
                    " (no write since last change, please exit again to confirm, "
                    "or save your changes)")
            return text

        def get_bottom_bar_text():
            text = ""
            if self.kd and not self.no_kernel and self.kernel_name:
                if self.executing_cells:
                    kernel_status = "busy"
                else:
                    kernel_status = "idle"
                text += f"{self.kernel_name} ({kernel_status})"
            else:
                text += "[NO KERNEL]"
            text += (
                f" @ {self.kernel_cwd} - {self.current_cell_idx + 1}/{len(self.cells)}"
            )
            return text

        self.top_bar = FormattedTextToolbar(get_top_bar_text,
                                            style="#ffffff bg:#444444")
        self.bottom_bar = FormattedTextToolbar(get_bottom_bar_text,
                                               style="#ffffff bg:#444444")
        root_container = HSplit([self.top_bar, nb_window, self.bottom_bar])
        self.layout = Layout(root_container)
예제 #30
0
 def arrange_ui(self, container):
     container.children.clear()
     container.children.extend([
         VSplit(self.captures),
         to_container(self.output_field),
         self.ui.statusbar,
         to_container(self.input_field),
     ])