Exemplo n.º 1
0
def python_sidebar_navigation(python_input):
    """
    Create the `Layout` showing the navigation information for the sidebar.
    """
    def get_tokens(cli):
        tokens = []
        T = Token.Sidebar

        # Show navigation info.
        tokens.extend([
            (T.Separator, ' ' * 43 + '\n'),
            (T, '    '),
            (T.Key, '[Arrows]'),
            (T, ' '),
            (T.Key.Description, 'Navigate'),
            (T, ' '),
            (T.Key, '[Enter]'),
            (T, ' '),
            (T.Key.Description, 'Hide menu'),
        ])

        return tokens

    return ConditionalContainer(content=Window(
        TokenListControl(get_tokens, Char(token=Token.Sidebar)),
        width=LayoutDimension.exact(43),
        height=LayoutDimension.exact(2)),
                                filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 2
0
def python_sidebar_navigation(python_input):
    """
    Create the `Layout` showing the navigation information for the sidebar.
    """
    def get_tokens(cli):
        tokens = []
        T = Token.Sidebar

        # Show navigation info.
        tokens.extend([
            (T.Separator, ' ' * 43 + '\n'),
            (T, '    '),
            (T.Key, '[Arrows]'),
            (T, ' '),
            (T.Key.Description, 'Navigate'),
            (T, ' '),
            (T.Key, '[Enter]'),
            (T, ' '),
            (T.Key.Description, 'Hide menu'),
        ])

        return tokens

    return ConditionalContainer(
        content=Window(
            TokenListControl(get_tokens, Char(token=Token.Sidebar)),
            width=LayoutDimension.exact(43),
            height=LayoutDimension.exact(2)),
        filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 3
0
    def get_dimensions(cli):
        """
        Return a list of LayoutDimension instances for this split.
        These dimensions will take the weight from the
        arrangement.VSplit/HSplit instances.
        """
        average_weight = get_average_weight()

        # Make sure that weight is distributed

        result = []
        for i, item in enumerate(split):
            result.append(D(weight=split.weights.get(item) or average_weight))

            # Add dimension for the vertical border.
            last_item = i == len(split) - 1
            if is_vsplit and not last_item:
                result.append(D.exact(1))
            elif is_hsplit and not last_item:
                if pymux.enable_pane_status:
                    result.append(D.exact(0))
                else:
                    result.append(D.exact(1))

        return result
Exemplo n.º 4
0
def show_sidebar_button_info(python_input):
    """
    Create `Layout` for the information in the right-bottom corner.
    (The right part of the status bar.)
    """
    @if_mousedown
    def toggle_sidebar(cli, mouse_event):
        " Click handler for the menu. "
        python_input.show_sidebar = not python_input.show_sidebar

    token = Token.Toolbar.Status

    version = sys.version_info
    tokens = [
        (token.Key, '[F2]', toggle_sidebar),
        (token, ' Menu', toggle_sidebar),
        (token, ' - '),
        (token.PythonVersion, '%s %i.%i.%i' % (platform.python_implementation(),
                                               version[0], version[1], version[2])),
        (token, ' '),
    ]
    width = token_list_width(tokens)

    def get_tokens(cli):
        # Python version
        return tokens

    return ConditionalContainer(
        content=Window(
            TokenListControl(get_tokens, default_char=Char(token=token)),
            height=LayoutDimension.exact(1),
            width=LayoutDimension.exact(width)),
        filter=~IsDone() & RendererHeightIsKnown() &
            Condition(lambda cli: python_input.show_status_bar and
                                  not python_input.show_exit_confirmation))
Exemplo n.º 5
0
    def __init__(self, python_input):
        def get_tokens(cli):
            tokens = []
            T = Token.Sidebar

            # Show navigation info.
            tokens.extend([
                (T.Separator , ' ' * 43 + '\n'),
                (T, '    '),
                (T.Key, '[Arrows]'),
                (T, ' '),
                (T.Key.Description, 'Navigate'),
                (T, ' '),
                (T.Key, '[Enter]'),
                (T, ' '),
                (T.Key.Description, 'Hide menu'),
            ])

            return tokens

        super(PythonSidebarNavigation, self).__init__(
            TokenListControl(get_tokens, Char(token=Token.Sidebar)),
            width=LayoutDimension.exact(43),
            height=LayoutDimension.exact(2),
            filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
def show_sidebar_button_info(python_input):
    """
    Create `Layout` for the information in the right-bottom corner.
    (The right part of the status bar.)
    """
    @if_mousedown
    def toggle_sidebar(cli, mouse_event):
        " Click handler for the menu. "
        python_input.show_sidebar = not python_input.show_sidebar

    token = Token.Toolbar.Status

    version = sys.version_info
    tokens = [
        (token.Key, '[F2]', toggle_sidebar),
        (token, ' Menu', toggle_sidebar),
        (token, ' - '),
        (token.PythonVersion, '%s %i.%i.%i' % (platform.python_implementation(),
                                               version[0], version[1], version[2])),
        (token, ' '),
    ]
    width = token_list_width(tokens)

    def get_tokens(cli):
        # Python version
        return tokens

    return ConditionalContainer(
        content=Window(
            TokenListControl(get_tokens, default_char=Char(token=token)),
            height=LayoutDimension.exact(1),
            width=LayoutDimension.exact(width)),
        filter=~IsDone() & RendererHeightIsKnown() &
            Condition(lambda cli: python_input.show_status_bar and
                                  not python_input.show_exit_confirmation))
Exemplo n.º 8
0
 def get_height(cli):
     # If there is an autocompletion menu to be shown, make sure that our
     # layout has at least a minimal height in order to display it.
     if reserve_space_for_menu and not cli.is_done:
         return LayoutDimension(min=reserve_space_for_menu)
     else:
         return LayoutDimension()
Exemplo n.º 9
0
    def __init__(self, editor, buffer_window, buffer_name):
        def get_scroll_text():
            info = buffer_window.render_info

            if info:
                if info.full_height_visible:
                    return 'All'
                elif info.top_visible:
                    return 'Top'
                elif info.bottom_visible:
                    return 'Bot'
                else:
                    percentage = info.vertical_scroll_percentage
                    return '%2i%%' % percentage

            return ''

        def get_tokens(cli):
            main_document = cli.buffers[buffer_name].document

            return [
                (Token.Toolbar.CursorPosition, '(%i,%i)' % (main_document.cursor_position_row + 1,
                                                            main_document.cursor_position_col + 1)),
                (Token.Toolbar, ' - '),
                (Token.Toolbar.Percentage, get_scroll_text()),
                (Token.Toolbar, ' '),
            ]

        super(WindowStatusBarRuler, self).__init__(
            Window(
                TokenListControl(get_tokens, default_char=Char(' ', Token.Toolbar), align_right=True),
                height=LayoutDimension.exact(1),
                width=LayoutDimension.exact(15)),
            filter=Condition(lambda cli: editor.show_ruler))
Exemplo n.º 10
0
    def __init__(self, editor, buffer_window, buffer_name):
        def get_scroll_text():
            info = buffer_window.render_info

            if info:
                if info.full_height_visible:
                    return 'All'
                elif info.top_visible:
                    return 'Top'
                elif info.bottom_visible:
                    return 'Bot'
                else:
                    percentage = info.vertical_scroll_percentage
                    return '%2i%%' % percentage

            return ''

        def get_tokens(cli):
            main_document = cli.buffers[buffer_name].document

            return [
                (Token.Toolbar.CursorPosition, '(%i,%i)' % (main_document.cursor_position_row + 1,
                                                            main_document.cursor_position_col + 1)),
                (Token.Toolbar, ' - '),
                (Token.Toolbar.Percentage, get_scroll_text()),
                (Token.Toolbar, ' '),
            ]

        super(WindowStatusBarRuler, self).__init__(
            TokenListControl(get_tokens, default_char=Char(' ', Token.Toolbar), align_right=True),
            height=LayoutDimension.exact(1),
            width=LayoutDimension.exact(15),
            filter=Condition(lambda cli: editor.show_ruler))
Exemplo n.º 11
0
    def get_dimensions(cli):
        """
        Return a list of LayoutDimension instances for this split.
        These dimensions will take the weight from the
        arrangement.VSplit/HSplit instances.
        """
        average_weight = get_average_weight()

        # Make sure that weight is distributed

        result = []
        for i, item in enumerate(split):
            result.append(D(weight=split.weights.get(item) or average_weight))

            # Add dimension for the vertical border.
            last_item = i == len(split) - 1
            if is_vsplit and not last_item:
                result.append(D.exact(1))
            elif is_hsplit and not last_item:
                if pymux.enable_pane_status:
                    result.append(D.exact(0))
                else:
                    result.append(D.exact(1))

        return result
Exemplo n.º 12
0
    def __init__(self, python_input):
        token = Token.Toolbar.Status

        version = sys.version_info
        tokens = [
            (token, ' [F2] Options'),
            (token, ' - '),
            (token.PythonVersion, '%s %i.%i.%i' % (platform.python_implementation(),
                                                   version[0], version[1], version[2])),
            (token, ' '),
        ]
        width = token_list_width(tokens)

        def get_tokens(cli):
            # Python version
            return tokens

        super(ShowSidebarButtonInfo, self).__init__(
            content=Window(
                TokenListControl(get_tokens, default_char=Char(token=token)),
                height=LayoutDimension.exact(1),
                width=LayoutDimension.exact(width)),
            filter=~IsDone() & RendererHeightIsKnown() &
                Condition(lambda cli: python_input.show_status_bar and
                                      not python_input.show_exit_confirmation))
Exemplo n.º 13
0
 def comp_height(cli):
     # If there is an autocompletion menu to be shown, make sure that o
     # layout has at least a minimal height in order to display it.
     if not cli.is_done:
         return LayoutDimension(min=size)
     else:
         return LayoutDimension()
Exemplo n.º 14
0
def get_anyhline(config):
    """ if there is a line between descriptions and example """
    if config.BOOLEAN_STATES[config.config.get('Layout', 'command_description')] or\
       config.BOOLEAN_STATES[config.config.get('Layout', 'param_description')]:
        return Window(width=LayoutDimension.exact(1),
                      height=LayoutDimension.exact(1),
                      content=FillControl('-', token=Token.Line))
    return get_empty()
Exemplo n.º 15
0
def python_sidebar(python_input):
    """
    Create the `Layout` for the sidebar with the configurable options.
    """
    def get_tokens(cli):
        tokens = []
        T = Token.Sidebar

        def append_category(category):
            tokens.extend([
                (T, '  '),
                (T.Title, '   %-36s' % category.title),
                (T, '\n'),
            ])

        def append(selected, label, status):
            token = T.Selected if selected else T

            tokens.append((T, ' >' if selected else '  '))
            tokens.append((token.Label, '%-24s' % label))
            tokens.append((token.Status, ' '))
            tokens.append((token.Status, '%s' % status))

            if selected:
                tokens.append((Token.SetCursorPosition, ''))

            tokens.append((token.Status, ' ' * (14 - len(status))))
            tokens.append((T, '<' if selected else ''))
            tokens.append((T, '\n'))

        i = 0
        for category in python_input.options:
            append_category(category)

            for option in category.options:
                append(i == python_input.selected_option_index,
                       option.title, '%s' % option.get_current_value())
                i += 1

        tokens.pop()  # Remove last newline.

        return tokens

    class Control(TokenListControl):
        def move_cursor_down(self, cli):
            python_input.selected_option_index += 1

        def move_cursor_up(self, cli):
            python_input.selected_option_index -= 1

    return ConditionalContainer(
        content=Window(
            Control(get_tokens, Char(token=Token.Sidebar),
                has_focus=ShowSidebar(python_input) & ~IsDone()),
            width=LayoutDimension.exact(43),
            height=LayoutDimension(min=3),
            scroll_offsets=ScrollOffsets(top=1, bottom=1)),
        filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 16
0
def get_anyhline(config):
    """ if there is a line between descriptions and example """
    if config.BOOLEAN_STATES[config.config.get('Layout', 'command_description')] or\
       config.BOOLEAN_STATES[config.config.get('Layout', 'param_description')]:
        return Window(
            width=LayoutDimension.exact(1),
            height=LayoutDimension.exact(1),
            content=FillControl('-', token=Token.Line))
    return get_empty()
Exemplo n.º 17
0
 def vertical_line():
     " Draw a vertical line between windows. (In case of a vsplit) "
     char = '│'
     content.append(HSplit([
             Window(
                width=D.exact(1), height=D.exact(1),
                content=FillControl(char, token=Token.TitleBar.Line)),
             Window(width=D.exact(1),
                    content=FillControl(char, token=Token.Line))
         ]))
Exemplo n.º 18
0
    def _gen_layout(self):
        stat_windows = []

        for stat_group in statinfo.groups:
            for stat in stat_group:
                stat_windows.append(make_stat_window(stat))

            stat_windows.append(vpad(1))

        stat_windows.append(
            Window(content=BufferControl(buffer_name='REROLLS_STAT_BUFFER'),
                   **stat_args))
        stat_windows.append(vpad(1))

        @Condition
        def scroll_cond(cli):
            if self.info_window.render_info is None:
                return True

            try:
                l = self.buffers['INFO_BUFFER'].document.line_count
                return self.info_window.render_info.window_height < l
            except:
                return True

        self.info_window = Window(
            content=BufferControl(buffer_name='INFO_BUFFER'),
            dont_extend_width=True,
            wrap_lines=True,
            always_hide_cursor=True,
            right_margins=[
                ConditionalMargin(ScrollbarMargin(display_arrows=True),
                                  scroll_cond)
            ])

        return HSplit([
            hpad(1),
            VSplit([
                vpad(1),
                HSplit(stat_windows),
                vpad(2),  # idk why there's an extra space on the stats
                self.info_window,
                vpad(1)
            ]),
            hpad(1),
            Window(content=BufferControl(buffer_name='MSG_BUFFER'),
                   height=D.exact(3),
                   wrap_lines=True),
            Window(content=BufferControl(buffer_name=DEFAULT_BUFFER),
                   height=D.exact(1),
                   always_hide_cursor=True)
        ])
Exemplo n.º 19
0
 def vertical_line():
     " Draw a vertical line between windows. (In case of a vsplit) "
     char = '│'
     content.append(HSplit([
             ConditionalContainer(
                 content=Window(
                     width=D.exact(1), height=D.exact(1),
                     content=FillControl(char, token=Token.TitleBar.Line)),
                 filter=Condition(lambda cli: pymux.enable_pane_status),
             ),
             Window(width=D.exact(1),
                    content=FillControl(char, token=Token.Line))
         ]))
Exemplo n.º 20
0
    def get_height(cli):
        # If there is an autocompletion menu to be shown, make sure that our
        # layout has at least a minimal height in order to display it.
        if reserve_space_for_menu and not cli.is_done:
            buff = cli.current_buffer

            # Reserve the space, either when there are completions, or when
            # `complete_while_typing` is true and we expect completions very
            # soon.
            if buff.complete_while_typing() or buff.complete_state is not None:
                return LayoutDimension(min=reserve_space_for_menu)

        return LayoutDimension()
Exemplo n.º 21
0
 def vertical_line():
     " Draw a vertical line between windows. (In case of a vsplit) "
     char = '│'
     content.append(
         HSplit([
             ConditionalContainer(
                 content=Window(width=D.exact(1),
                                height=D.exact(1),
                                content=FillControl(
                                    char, token=Token.TitleBar.Line)),
                 filter=Condition(lambda cli: pymux.enable_pane_status),
             ),
             Window(width=D.exact(1),
                    content=FillControl(char, token=Token.Line))
         ]))
Exemplo n.º 22
0
def signature_toolbar(python_input):
    """
    Return the `Layout` for the signature.
    """
    def get_tokens(cli):
        result = []
        append = result.append
        Signature = Token.Toolbar.Signature

        if python_input.signatures:
            sig = python_input.signatures[0]  # Always take the first one.

            append((Signature, ' '))
            try:
                append((Signature, sig.full_name))
            except IndexError:
                # Workaround for #37: https://github.com/jonathanslenders/python-prompt-toolkit/issues/37
                # See also: https://github.com/davidhalter/jedi/issues/490
                return []

            append((Signature.Operator, '('))

            for i, p in enumerate(sig.params):
                # Workaround for #47: 'p' is None when we hit the '*' in the signature.
                #                     and sig has no 'index' attribute.
                # See: https://github.com/jonathanslenders/ptpython/issues/47
                #      https://github.com/davidhalter/jedi/issues/598
                description = (p.description if p else '*') #or '*'
                sig_index = getattr(sig, 'index', 0)

                if i == sig_index:
                    # Note: we use `_Param.description` instead of
                    #       `_Param.name`, that way we also get the '*' before args.
                    append((Signature.CurrentName, str(description)))
                else:
                    append((Signature, str(description)))
                append((Signature.Operator, ', '))

            if sig.params:
                # Pop last comma
                result.pop()

            append((Signature.Operator, ')'))
            append((Signature, ' '))
        return result

    return ConditionalContainer(
        content=Window(
            TokenListControl(get_tokens),
            height=LayoutDimension.exact(1)),
        filter=
            # Show only when there is a signature
            HasSignature(python_input) &
            # And there are no completions to be shown. (would cover signature pop-up.)
            ~(HasCompletions() & (show_completions_menu(python_input) |
                                   show_multi_column_completions_menu(python_input)))
            # Signature needs to be shown.
            & ShowSignature(python_input) &
            # Not done yet.
            ~IsDone())
Exemplo n.º 23
0
def signature_toolbar(python_input):
    """
    Return the `Layout` for the signature.
    """
    def get_tokens(cli):
        result = []
        append = result.append
        Signature = Token.Toolbar.Signature

        if python_input.signatures:
            sig = python_input.signatures[0]  # Always take the first one.

            append((Signature, ' '))
            try:
                append((Signature, sig.full_name))
            except IndexError:
                # Workaround for #37: https://github.com/jonathanslenders/python-prompt-toolkit/issues/37
                # See also: https://github.com/davidhalter/jedi/issues/490
                return []

            append((Signature.Operator, '('))

            for i, p in enumerate(sig.params):
                # Workaround for #47: 'p' is None when we hit the '*' in the signature.
                #                     and sig has no 'index' attribute.
                # See: https://github.com/jonathanslenders/ptpython/issues/47
                #      https://github.com/davidhalter/jedi/issues/598
                description = (p.description if p else '*') #or '*'
                sig_index = getattr(sig, 'index', 0)

                if i == sig_index:
                    # Note: we use `_Param.description` instead of
                    #       `_Param.name`, that way we also get the '*' before args.
                    append((Signature.CurrentName, str(description)))
                else:
                    append((Signature, str(description)))
                append((Signature.Operator, ', '))

            if sig.params:
                # Pop last comma
                result.pop()

            append((Signature.Operator, ')'))
            append((Signature, ' '))
        return result

    return ConditionalContainer(
        content=Window(
            TokenListControl(get_tokens),
            height=LayoutDimension.exact(1)),
        filter=
            # Show only when there is a signature
            HasSignature(python_input) &
            # And there are no completions to be shown. (would cover signature pop-up.)
            ~(HasCompletions() & (show_completions_menu(python_input) |
                                   show_multi_column_completions_menu(python_input)))
            # Signature needs to be shown.
            & ShowSignature(python_input) &
            # Not done yet.
            ~IsDone())
Exemplo n.º 24
0
    def _get_height_dimension(self) -> LayoutDimension:
        """Retrieve the height dimension dynamically.

        Returns:
            :class:`prompt_toolkit.layout.Dimension` instance.
        """
        return LayoutDimension(preferred=self._get_height() + 1)
Exemplo n.º 25
0
def create_tutorial_layout(lex):
    """ layout for example tutorial """
    lexer, _, _ = get_lexers(lex, None, None)
    layout_full = HSplit([
        FloatContainer(
            Window(BufferControl(input_processors=input_processors,
                                 lexer=lexer,
                                 preview_search=Always()),
                   get_height=get_height), [
                       Float(xcursor=True,
                             ycursor=True,
                             content=CompletionsMenu(
                                 max_height=MAX_COMPLETION,
                                 scroll_offset=1,
                                 extra_filter=(HasFocus(DEFAULT_BUFFER))))
                   ]),
        ConditionalContainer(HSplit([
            get_hline(),
            get_param(lexer),
            get_hline(),
            Window(content=BufferControl(buffer_name='example_line',
                                         lexer=lexer), ),
            Window(TokenListControl(get_tutorial_tokens,
                                    default_char=Char(' ', Token.Toolbar)),
                   height=D.exact(1)),
        ]),
                             filter=~IsDone() & RendererHeightIsKnown())
    ])
    return layout_full
Exemplo n.º 26
0
    def __init__(self, python_input):
        def get_tokens(cli):
            tokens = []
            T = Token.Sidebar

            tokens.extend([
                (T, '  '),
                (T.Title, 'Options'),
                (T, '\n'),
            ])

            def append(selected, label, status):
                token = T.Selected if selected else T

                tokens.append((T, ' >' if selected else '  '))
                tokens.append((token.Label, '%-24s' % label))
                tokens.append((token.Status, ' %-14s' % status))
                tokens.append((T, '<' if selected else ''))
                tokens.append((T, '\n'))

            for i, option in enumerate(python_input.options):
                append(i == python_input.selected_option,
                       option.description, '%s' % option.get_current_value())

            tokens.pop()  # Remove last newline.

            return tokens

        super(PythonSidebar, self).__init__(
            TokenListControl(get_tokens, Char(token=Token.Sidebar)),
            width=LayoutDimension.exact(43),
            filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 27
0
def python_sidebar_help(python_input):
    """
    Create the `Layout` for the help text for the current item in the sidebar.
    """
    token = Token.Sidebar.HelpText

    def get_current_description():
        """
        Return the description of the selected option.
        """
        i = 0
        for category in python_input.options:
            for option in category.options:
                if i == python_input.selected_option_index:
                    return option.description
                i += 1
        return ''

    def get_tokens(cli):
        return [(token, get_current_description())]

    return ConditionalContainer(
        content=Window(TokenListControl(get_tokens, Char(token=token)),
                       height=LayoutDimension(min=3)),
        filter=ShowSidebar(python_input)
        & Condition(lambda cli: python_input.show_sidebar_help) & ~IsDone())
Exemplo n.º 28
0
 def horizontal_line():
     char = '─'
     content.append(
         ConditionalContainer(
             content=Window(height=D.exact(1),
                            content=FillControl(char, token=Token.Line)),
             filter=Condition(lambda cli: not pymux.enable_pane_status)), )
Exemplo n.º 29
0
 def __init__(self):
     super(CommandLine, self).__init__(BufferControl(
         buffer_name=COMMAND_BUFFER,
         input_processors=[BeforeInput.static(':')],
         lexer=create_command_lexer()),
                                       height=LayoutDimension.exact(1),
                                       filter=HasFocus(COMMAND_BUFFER))
Exemplo n.º 30
0
def create_default_layout(message='', lexer=None, is_password=False,
                          reserve_space_for_menu=False, get_bottom_toolbar_tokens=None,
                          extra_input_processors=None):
    """
    Generate default layout.
    """
    assert get_bottom_toolbar_tokens is None or callable(get_bottom_toolbar_tokens)

    # Create processors list.
    # (DefaultPrompt should always be at the end.)
    input_processors = [HighlightSearchProcessor(preview_search=Always()),
                        HighlightSelectionProcessor()]
    if extra_input_processors:
        input_processors.extend(extra_input_processors)

    if is_password:
        input_processors.extend([PasswordProcessor(), DefaultPrompt(message)])
    else:
        input_processors.append(DefaultPrompt(message))

    # Create bottom toolbar.
    if get_bottom_toolbar_tokens:
        toolbars = [Window(TokenListControl(get_bottom_toolbar_tokens,
                                            default_char=Char(' ', Token.Toolbar)),
                           height=LayoutDimension.exact(1),
                           filter=~IsDone())]
    else:
        toolbars = []

    def get_height(cli):
        # If there is an autocompletion menu to be shown, make sure that our
        # layout has at least a minimal height in order to display it.
        if reserve_space_for_menu and not cli.is_done:
            return LayoutDimension(min=8)
        else:
            return LayoutDimension()

    # Create and return Layout instance.
    return HSplit([
        FloatContainer(
            Window(
                BufferControl(
                    input_processors=input_processors,
                    lexer=lexer,
                    # Enable preview_search, we want to have immediate feedback
                    # in reverse-i-search mode.
                    preview_search=Always()),
                get_height=get_height,
            ),
            [
                Float(xcursor=True,
                      ycursor=True,
                      content=CompletionsMenu(max_height=16,
                                              extra_filter=HasFocus(DEFAULT_BUFFER)))
            ]
        ),
        ValidationToolbar(),
        SystemToolbar(),
    ] + toolbars)
Exemplo n.º 31
0
 def horizontal_line():
     char = '─'
     content.append(
         ConditionalContainer(
             content=Window(height=D.exact(1),
                            content=FillControl(char, token=Token.Line)),
             filter=Condition(lambda cli: not pymux.enable_pane_status)),
     )
Exemplo n.º 32
0
 def __init__(self):
     super(CommandLine, self).__init__(
         BufferControl(
             buffer_name=COMMAND_BUFFER,
             input_processors=[BeforeInput.static(':')],
             lexer=create_command_lexer()),
         height=LayoutDimension.exact(1),
         filter=HasFocus(COMMAND_BUFFER))
Exemplo n.º 33
0
    def __init__(self, opt_ns, srv_c, inst_xml):
        manager = KeyBindingManager()  # Start with the `KeyBindingManager`.

        self.srv_text = ServiceOutput(opt_ns, srv_c, inst_xml)
        layout = HSplit(
            [
                # One window that holds the BufferControl with the default buffer on the
                # left.
                Window(
                    height=D.exact(1),
                    content=TokenListControl(
                        self.get_title_line,
                        default_char=Char(" ", token=Token.String.ICSW.Header)
                    )
                ),
                Window(
                    height=D.exact(1),
                    content=FillControl('-', token=Token.Line)
                ),
                # Display the text 'Hello world' on the right.
                Window(
                    content=TokenListControl(
                        self.get_icsw_output,
                    )
                ),
            ]
        )

        self._updating = False

        @manager.registry.add_binding(Keys.ControlC, eager=True)
        @manager.registry.add_binding("q", eager=True)
        def _handler_data(event):
            event.cli.set_return_value(0)

        our_style = style_from_dict(logging_tools.get_icsw_prompt_styles())
        application = Application(
            layout=layout,
            use_alternate_screen=True,
            style=our_style,
            on_input_timeout=self.input_timeout,
            key_bindings_registry=manager.registry,
        )
        event_loop = create_eventloop()
        self.application = application
        self.event_loop = event_loop
Exemplo n.º 34
0
 def __init__(self):
     super(CommandPrompt, self).__init__(
         BufferControl(
             buffer_name=COMMAND_BUFFER,
             input_processors=[BeforeInput.static(self.PROMPT)],
         ),
         height=D.exact(1)
     )
Exemplo n.º 35
0
def python_sidebar(python_input):
    """
    Create the `Layout` for the sidebar with the configurable options.
    """
    def get_tokens(cli):
        tokens = []
        T = Token.Sidebar

        def append_category(category):
            tokens.extend([
                (T, '  '),
                (T.Title, '   %-36s' % category.title),
                (T, '\n'),
            ])

        def append(selected, label, status):
            token = T.Selected if selected else T

            tokens.append((T, ' >' if selected else '  '))
            tokens.append((token.Label, '%-24s' % label))
            tokens.append((token.Status, ' '))
            tokens.append((token.Status, '%s' % status))

            if selected:
                tokens.append((Token.SetCursorPosition, ''))

            tokens.append((token.Status, ' ' * (14 - len(status))))
            tokens.append((T, '<' if selected else ''))
            tokens.append((T, '\n'))

        i = 0
        for category in python_input.options:
            append_category(category)

            for option in category.options:
                append(i == python_input.selected_option_index,
                       option.title, '%s' % option.get_current_value())
                i += 1

        tokens.pop()  # Remove last newline.

        return tokens

    class Control(TokenListControl):
        def move_cursor_down(self, cli):
            python_input.selected_option_index += 1

        def move_cursor_up(self, cli):
            python_input.selected_option_index -= 1

    return ConditionalContainer(
        content=Window(
            Control(get_tokens, Char(token=Token.Sidebar),
                has_focus=ShowSidebar(python_input) & ~IsDone()),
            width=LayoutDimension.exact(43),
            height=LayoutDimension(min=3),
            scroll_offsets=ScrollOffsets(top=1, bottom=1)),
        filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 36
0
    def _get_layout(self):

        token_list_window = Window(height=LD.exact(1),
                                   content=TokenListControl(
                                       self._get_prompt_tokens))

        conditional_window = ConditionalContainer(Window(
            self.controller,
            width=LD.exact(43),
            height=LD.exact(len(self.choices)),
            scroll_offsets=ScrollOffsets(top=1, bottom=1)),
                                                  filter=~IsDone())

        if self.prompt_msg:

            return HSplit([token_list_window, conditional_window])

        else:

            return HSplit([conditional_window])
Exemplo n.º 37
0
def create_default_layout(message='', lexer=None, is_password=False,
                          reserve_space_for_menu=False, get_bottom_toolbar_tokens=None):
    """
    Generate default layout.
    """
    assert get_bottom_toolbar_tokens is None or callable(get_bottom_toolbar_tokens)

    # Create processors list.
    input_processors = [HighlightSearchProcessor(), HighlightSelectionProcessor()]
    if is_password:
        input_processors.extend([PasswordProcessor(), DefaultPrompt(message)])
    else:
        input_processors.append(DefaultPrompt(message))

    # Create bottom toolbar.
    if get_bottom_toolbar_tokens:
        toolbars = [Window(TokenListControl(get_bottom_toolbar_tokens,
                                            default_char=Char(' ', Token.Toolbar)),
                           height=LayoutDimension.exact(1),
                           filter=~IsDone())]
    else:
        toolbars = []

    def get_height(cli):
        # If there is an autocompletion menu to be shown, make sure that our
        # layout has at least a minimal height in order to display it.
        if reserve_space_for_menu and not cli.is_done:
            return LayoutDimension(min=8)
        else:
            return LayoutDimension()

    # Create and return Layout instance.
    return HSplit([
        FloatContainer(
            Window(
                BufferControl(
                    input_processors=input_processors,
                    lexer=lexer,
                    # Enable preview_search, we want to have immediate feedback
                    # in reverse-i-search mode.
                    preview_search=Always()),
                get_height=get_height,
            ),
            [
                Float(xcursor=True,
                      ycursor=True,
                      content=CompletionsMenu(max_height=16,
                                              extra_filter=HasFocus(DEFAULT_BUFFER)))
            ]
        ),
        ValidationToolbar(),
        SystemToolbar(),
    ] + toolbars)
Exemplo n.º 38
0
    def __init__(self, app):
        self.layout = HSplit([
            # main window
            MainWindow(app),
            TabSelectWindow(app),

            # horizontal split
            Window(height=D.exact(1),
                   content=FillControl('\u2500', token=Token.Line)),

            # command prompt
            CommandPrompt(),
        ])
Exemplo n.º 39
0
    def __init__(self):
        token = Token.Toolbar.Status

        version = sys.version_info
        tokens = [
            (token, ' [F2] Sidebar'),
            (token, ' - '),
            (token.PythonVersion, '%s %i.%i.%i' % (platform.python_implementation(),
                                                   version[0], version[1], version[2])),
            (token, ' '),
        ]
        width = token_list_width(tokens)

        def get_tokens(cli):
            # Python version
            return tokens

        super(ShowSidebarButtonInfo, self).__init__(
            TokenListControl(get_tokens, default_char=Char(token=token)),
            filter=~IsDone() & RendererHeightIsKnown(),
            height=LayoutDimension.exact(1),
            width=LayoutDimension.exact(width))
Exemplo n.º 40
0
 def __init__(self, settings):
     super(SignatureToolbar, self).__init__(
         SignatureControl(settings),
         height=LayoutDimension.exact(1),
         filter=
             # Show only when there is a signature
             HasSignature(settings) &
             # And there are no completions to be shown. (would cover signature pop-up.)
             (~HasCompletions() | ~ShowCompletionsMenu(settings))
             # Signature needs to be shown.
             & ShowSignature(settings) &
             # Not done yet.
             ~IsDone())
Exemplo n.º 41
0
 def __init__(self, settings):
     super(SignatureToolbar, self).__init__(
         SignatureControl(settings),
         height=LayoutDimension.exact(1),
         filter=
         # Show only when there is a signature
         HasSignature(settings) &
         # And there are no completions to be shown. (would cover signature pop-up.)
         (~HasCompletions() | ~ShowCompletionsMenu(settings))
         # Signature needs to be shown.
         & ShowSignature(settings) &
         # Not done yet.
         ~IsDone())
Exemplo n.º 42
0
    def __init__(self, path):
        self.edit = False
        self.lock = False

        self.model = model.Model(path)
        self.style = style_from_dict({
            Token.CursorLine: 'reverse',
        })

        self.wrapping = Condition(lambda cli: self.model.wrap)
        self.editing = Condition(lambda cli: self.edit)
        self.locked = Condition(lambda clie: self.lock)

        self.main = Window(content=MyControl(self.model),
                           cursorline=~self.locked,
                           wrap_lines=self.wrapping)

        self.status = Window(height=LayoutDimension.exact(1),
                             content=TokenListControl(
                                 get_tokens=self.get_status_tokens,
                                 align_right=False))

        self.command = Window(
            height=LayoutDimension.exact(1),
            content=BufferControl(buffer_name=DEFAULT_BUFFER),
            allow_scroll_beyond_bottom=True)

        self.layout = HSplit([self.main, self.status, self.command])

        bindings = self.load_bindings()

        self.application = Application(
            layout=self.layout,
            style=self.style,
            use_alternate_screen=True,
            buffer=Buffer(is_multiline=False,
                          read_only=Condition(lambda: not self.edit)),
            key_bindings_registry=bindings)
Exemplo n.º 43
0
def create_default_layout(message='', lexer=None, is_password=False,
                          reserve_space_for_menu=False, get_bottom_toolbar_tokens=None):
    """
    Generate default layout.
    """
    assert get_bottom_toolbar_tokens is None or callable(get_bottom_toolbar_tokens)

    # Create processors list.
    if is_password:
        input_processors = [PasswordProcessor(), DefaultPrompt(message)]
    else:
        input_processors = [DefaultPrompt(message)]

    # Create bottom toolbar.
    if get_bottom_toolbar_tokens:
        toolbars = [Window(TokenListControl(get_bottom_toolbar_tokens,
                                            default_char=Char(' ', Token.Toolbar)),
                           height=LayoutDimension.exact(1),
                           filter=~IsDone())]
    else:
        toolbars = []

    def get_height(cli):
        # If there is an autocompletion menu to be shown, make sure that our
        # layout has at least a minimal height in order to display it.
        if reserve_space_for_menu and not cli.is_done:
            return LayoutDimension(min=8)
        else:
            return LayoutDimension()

    # Create and return Layout instance.
    return HSplit([
        FloatContainer(
            Window(
                BufferControl(
                    input_processors=input_processors,
                    lexer=lexer),
                get_height=get_height,
            ),
            [
                Float(xcursor=True,
                      ycursor=True,
                      content=CompletionsMenu(max_height=16,
                                              extra_filter=HasFocus('default')))
            ]
        ),
        ValidationToolbar(),
        SystemToolbar(),
    ] + toolbars)
Exemplo n.º 44
0
    def _get_width_dimension(self) -> LayoutDimension:
        """Retrieve the width dimension dynamically.

        Returns:
            :class:`prompt_toolkit.layout.Dimension` instance.
        """
        width, _ = get_dimension(offset=self._dimension_offset +
                                 (self._padding * 2))
        if self._vertical_mode():
            if self._id == Pane.left:
                width = math.ceil((width - (self._padding * 2)) / 2)
            elif self._id == Pane.right:
                width = math.floor((width - (self._padding * 2)) / 2)
        self._width = width
        return LayoutDimension(preferred=width)
Exemplo n.º 45
0
 def __init__(self,
              message: "AnyFormattedText",
              filter: "FilterOrBool",
              wrap_lines: bool = True,
              show_cursor: bool = True,
              **kwargs) -> None:
     super().__init__(
         content=Window(
             height=LayoutDimension.exact(1) if not wrap_lines else None,
             content=FormattedTextControl(message, show_cursor=show_cursor),
             wrap_lines=wrap_lines,
             dont_extend_height=True,
             **kwargs),
         filter=filter,
     )
Exemplo n.º 46
0
    def __init__(self, python_input):
        def get_tokens(cli):
            tokens = []
            T = Token.Sidebar

            def append_category(category):
                tokens.extend([
                    (T, '  '),
                    (T.Title, '   %-36s' % category.title),
                    (T, '\n'),
                ])

            def append(selected, label, status):
                token = T.Selected if selected else T

                tokens.append((T, ' >' if selected else '  '))
                tokens.append((token.Label, '%-24s' % label))
                tokens.append((token.Status, ' '))
                tokens.append((token.Status, '%s' % status))

                if selected:
                    tokens.append((Token.SetCursorPosition, ''))

                tokens.append((token.Status, ' ' * (14 - len(status))))
                tokens.append((T, '<' if selected else ''))
                tokens.append((T, '\n'))

            i = 0
            for category in python_input.options:
                append_category(category)

                for option in category.options:
                    append(i == python_input.selected_option_index,
                           option.title, '%s' % option.get_current_value())
                    i += 1

            tokens.pop()  # Remove last newline.

            return tokens

        super(PythonSidebar, self).__init__(
            content=Window(
                TokenListControl(get_tokens, Char(token=Token.Sidebar),
                    has_focus=ShowSidebar(python_input) & ~IsDone()),
                width=LayoutDimension.exact(43),
                height=LayoutDimension(min=3),
                scroll_offset=1),
            filter=ShowSidebar(python_input) & ~IsDone())
Exemplo n.º 47
0
    def __init__(self, python_input):
        def get_tokens(cli):
            result = []
            append = result.append
            Signature = Token.Toolbar.Signature

            if python_input.signatures:
                sig = python_input.signatures[0]  # Always take the first one.

                append((Signature, ' '))
                try:
                    append((Signature, sig.full_name))
                except IndexError:
                    # Workaround for #37: https://github.com/jonathanslenders/python-prompt-toolkit/issues/37
                    # See also: https://github.com/davidhalter/jedi/issues/490
                    return []

                append((Signature.Operator, '('))

                for i, p in enumerate(sig.params):
                    if i == sig.index:
                        # Note: we use `_Param.description` instead of
                        #       `_Param.name`, that way we also get the '*' before args.
                        append((Signature.CurrentName, str(p.description)))
                    else:
                        append((Signature, str(p.description)))
                    append((Signature.Operator, ', '))

                if sig.params:
                    # Pop last comma
                    result.pop()

                append((Signature.Operator, ')'))
                append((Signature, ' '))
            return result

        super(SignatureToolbar, self).__init__(
            TokenListControl(get_tokens),
            height=LayoutDimension.exact(1),
            filter=
                # Show only when there is a signature
                HasSignature(python_input) &
                # And there are no completions to be shown. (would cover signature pop-up.)
                (~HasCompletions() | ~ShowCompletionsMenu(python_input))
                # Signature needs to be shown.
                & ShowSignature(python_input) &
                # Not done yet.
                ~IsDone())
Exemplo n.º 48
0
 def _factory():
     return [
         window_class(
             control,
             height=LayoutDimension(max=page_size),
             dont_extend_height=True,
             wrap_lines=True,
         ),
         ConditionalContainer(
             Window(
                 TokenListControl(_get_default_pager_tokens),
                 dont_extend_height=True,
                 wrap_lines=True,
             ),
             filter=NeedsScrollTip(page_size) & ~IsDone(),
         ),
     ]
Exemplo n.º 49
0
 def setup_layout(self):
     """docstring for setup_layout"""
     if bool(egc.TEXT_EDITOR_ENABLE_LEFT_MARGIN) is True:
         self._left_margin = NumberredMargin(display_tildes=True)
     if bool(egc.TEXT_EDITOR_ENABLE_RIGHT_MARGIN) is True:
         self._right_margin = ScrollbarMargin(display_arrows=True)
     self._buffer_control = BufferControl(buffer_name=self._editor_buffer_name)
     self._editor_aiml_code_window = Window(content=self._buffer_control, left_margins=[self._left_margin,])
     self._vertical_line = FillControl('|', token=Token.Line)
     self._window_separater = Window(width=D.exact(1), content=self._vertical_line)
     self._aiml_list = TokenListControl(get_tokens=self.get_aiml_list)
     self._editor_aiml_list_window = Window(content=self._aiml_list, right_margins=[self._right_margin,])
     self._layout = VSplit([
         self._editor_aiml_code_window,
         self._window_separater,
         self._editor_aiml_list_window,
         ])
Exemplo n.º 50
0
    def get_dimensions(cli):
        """
        Return a list of LayoutDimension instances for this split.
        These dimensions will take the weight from the
        arrangement.VSplit/HSplit instances.
        """
        average_weight = get_average_weight()

        # Make sure that weight is distributed

        result = []
        for i, item in enumerate(split):
            result.append(D(weight=split.weights.get(item) or average_weight))

            # Add dimension for the vertical border.
            if is_vsplit and i != len(split) - 1:
                result.append(D.exact(1))

        return result
Exemplo n.º 51
0
        def create_layout_from_node(node):
            if isinstance(node, window_arrangement.Window):
                # Create frame for Window, or reuse it, if we had one already.
                key = (node, node.editor_buffer)
                frame = existing_frames.get(key)
                if frame is None:
                    frame = self._create_window_frame(node.editor_buffer)
                self._frames[key] = frame
                return frame

            elif isinstance(node, window_arrangement.VSplit):
                children = []
                for n in node:
                    children.append(create_layout_from_node(n))
                    children.append(Window(width=LayoutDimension.exact(1),
                                           content=FillControl('\u2502', token=Token.FrameBorder)))
                children.pop()
                return VSplit(children)

            if isinstance(node, window_arrangement.HSplit):
                return HSplit([create_layout_from_node(n) for n in node])
Exemplo n.º 52
0
def create_tutorial_layout(lex):
    """ layout for example tutorial """
    lexer, _, _ = get_lexers(lex, None, None)
    layout_full = HSplit([
        FloatContainer(
            Window(
                BufferControl(
                    input_processors=input_processors,
                    lexer=lexer,
                    preview_search=Always()),
                get_height=get_height),
            [
                Float(xcursor=True,
                      ycursor=True,
                      content=CompletionsMenu(
                          max_height=MAX_COMPLETION,
                          scroll_offset=1,
                          extra_filter=(HasFocus(DEFAULT_BUFFER))))]),
        ConditionalContainer(
            HSplit([
                get_hline(),
                get_param(lexer),
                get_hline(),
                Window(
                    content=BufferControl(
                        buffer_name='example_line',
                        lexer=lexer
                    ),
                ),
                Window(
                    TokenListControl(
                        get_tutorial_tokens,
                        default_char=Char(' ', Token.Toolbar)),
                    height=D.exact(1)),
            ]),
            filter=~IsDone() & RendererHeightIsKnown()
        )
    ])
    return layout_full
Exemplo n.º 53
0
 def __init__(self, editor):
     super(TabsToolbar, self).__init__(
         Window(TabsControl(editor), height=LayoutDimension.exact(1)),
         filter=Condition(lambda cli: len(editor.window_arrangement.tab_pages) > 1))
# larger than what was available to the window.

# So, for this example, we create a layout that shows the content of the
# default buffer on the left, shows a line in the middle and another buffer
# (called 'RESULT') on the right.

layout = VSplit([
    # One window that holds the BufferControl with the default buffer on the
    # left.
    Window(content=BufferControl(buffer_name=DEFAULT_BUFFER)),

    # A vertical line in the middle. We explicitely 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 `FillControl` will simply fill the whole
    # window by repeating this character.
    Window(width=D.exact(1),
           content=FillControl('|', token=Token.Line)),

    # Display the Result buffer on the right.
    Window(content=BufferControl(buffer_name='RESULT')),
])

# As a demonstration. Let's add a title bar to the top, displaying "Hello world".

# somewhere, because usually the default key bindings include searching. (Press
# Ctrl-R.) It would be really annoying if the search key bindings are handled,
# but the user doesn't see any feedback. We will add the search toolbar to the
# bottom by using an HSplit.

def get_titlebar_tokens(cli):
    return [
Exemplo n.º 55
0
def get_hline():
    """ gets a horiztonal line """
    return Window(
        width=D.exact(1),
        height=D.exact(1),
        content=FillControl('-', token=Token.Line))
Exemplo n.º 56
0
def get_vline():
    """ gets a vertical line """
    return Window(
        width=D.exact(1),
        height=D.exact(1),
        content=FillControl('*', token=Token.Line))
Exemplo n.º 57
0
def create_layout(python_input, history_mapping):
    """
    Create and return a `Container` instance for the history
    application.
    """
    processors = [
        HighlightSearchProcessor(preview_search=True),
        HighlightSelectionProcessor()]

    help_window = create_popup_window(
        title='History Help',
        body=Window(
            content=BufferControl(
                buffer_name=HELP_BUFFER,
                default_char=Char(token=Token),
                lexer=PygmentsLexer(RstLexer),
                input_processors=processors),
            right_margins=[ScrollbarMargin()],
            scroll_offsets=ScrollOffsets(top=2, bottom=2)))

    return HSplit([
        #  Top title bar.
        TokenListToolbar(
            get_tokens=_get_top_toolbar_tokens,
            align_center=True,
            default_char=Char(' ', Token.Toolbar.Status)),
        FloatContainer(
            content=VSplit([
                # Left side: history.
                Window(
                    content=BufferControl(
                        buffer_name=HISTORY_BUFFER,
                        lexer=PygmentsLexer(PythonLexer),
                        input_processors=processors),
                    wrap_lines=False,
                    left_margins=[HistoryMargin(history_mapping)],
                    scroll_offsets=ScrollOffsets(top=2, bottom=2)),
                # Separator.
                Window(width=D.exact(1),
                       content=FillControl(BORDER.LIGHT_VERTICAL, token=Token.Separator)),
                # Right side: result.
                Window(
                    content=BufferControl(
                        buffer_name=DEFAULT_BUFFER,
                        input_processors=processors + [GrayExistingText(history_mapping)],
                        lexer=PygmentsLexer(PythonLexer)),
                    wrap_lines=False,
                    left_margins=[ResultMargin(history_mapping)],
                    scroll_offsets=ScrollOffsets(top=2, bottom=2)),
            ]),
            floats=[
                # Help text as a float.
                Float(width=60, top=3, bottom=2,
                      content=ConditionalContainer(
                          # (We use InFocusStack, because it's possible to search
                          # through the help text as well, and at that point the search
                          # buffer has the focus.)
                          content=help_window, filter=InFocusStack(HELP_BUFFER))),
            ]
        ),
        # Bottom toolbars.
        ArgToolbar(),
        SearchToolbar(),
        TokenListToolbar(
            get_tokens=partial(_get_bottom_toolbar_tokens, python_input=python_input),
            default_char=Char(' ', Token.Toolbar.Status)),
    ])
Exemplo n.º 58
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)),
        ]),
    ])