当前位置: 首页>>代码示例>>Python>>正文


Python Token.Toolbar方法代码示例

本文整理汇总了Python中pygments.token.Token.Toolbar方法的典型用法代码示例。如果您正苦于以下问题:Python Token.Toolbar方法的具体用法?Python Token.Toolbar怎么用?Python Token.Toolbar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygments.token.Token的用法示例。


在下文中一共展示了Token.Toolbar方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: color_mapping

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def color_mapping(curr_completion, completion, prompt, command, subcommand,
                  param, text, line, example, toolbar):

    return style_from_dict({
        # Completion colors
        Token.Menu.Completions.Completion.Current: curr_completion,
        Token.Menu.Completions.Completion: completion,
        Token.Menu.Completions.ProgressButton: 'bg:#b78991',
        Token.Menu.Completions.ProgressBar: 'bg:#ffc0cb',

        Token.Az: prompt,
        Token.Prompt.Arg: prompt,

        # Pretty Words
        Token.Keyword: command,
        Token.Keyword.Declaration: subcommand,
        Token.Name.Class: param,
        Token.Text: text,

        Token.Line: line,
        Token.Number: example,
        # toolbar
        Token.Operator: toolbar,
        Token.Toolbar: toolbar
    }) 
开发者ID:Azure,项目名称:azure-cli-shell,代码行数:27,代码来源:color_styles.py

示例2: _create_toolbar_handler

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def _create_toolbar_handler(self, get_cluster_name, get_namespace, get_user, get_inline_help):
        def get_toolbar_items(_):
            if get_inline_help():
                help_token = Token.Toolbar.On
                help = "ON"
            else:
                help_token = Token.Toolbar.Off
                help = "OFF"

            return [
                (Keyword, ' [F4] Cluster: '),
                (Token.Toolbar, get_cluster_name()),
                (Keyword, ' [F5] Namespace: '),
                (Token.Toolbar, get_namespace()),
                (Keyword, ' User: '),
                (Token.Toolbar, get_user()),
                (Keyword, ' [F9] In-line help: '),
                (help_token, '{0}'.format(help)),
                (Keyword, ' [F10] Exit ')
            ]

        return get_toolbar_items 
开发者ID:cloudnativelabs,项目名称:kube-shell,代码行数:24,代码来源:toolbar.py

示例3: get_bottom_toolbar_tokens

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def get_bottom_toolbar_tokens(cli):
    """Return a list of tokens for the bottom toolbar"""
    mem = q('.Q.w', '') // 1024  # memory info in KiB
    return [(Token.Toolbar, "{0} {1.used}/{1.mphy} KiB".format(KDB_INFO, mem))] 
开发者ID:KxSystems,项目名称:pyq,代码行数:6,代码来源:ptk.py

示例4: get_tutorial_tokens

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def get_tutorial_tokens(cli):
    """ tutorial tokens """
    return [(Token.Toolbar, 'In Tutorial Mode: Press [Enter] after typing each part')] 
开发者ID:Azure,项目名称:azure-cli-shell,代码行数:5,代码来源:layout.py

示例5: create_tutorial_layout

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
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 
开发者ID:Azure,项目名称:azure-cli-shell,代码行数:41,代码来源:layout.py

示例6: setUp

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def setUp(self):
        self.aws_shell = AWSShell(mock.Mock(), mock.Mock(), mock.Mock())
        self.cli = mock.Mock()
        self.toolbar = Toolbar(
            lambda: self.aws_shell.model_completer.match_fuzzy,
            lambda: self.aws_shell.enable_vi_bindings,
            lambda: self.aws_shell.show_completion_columns,
            lambda: self.aws_shell.show_help) 
开发者ID:awslabs,项目名称:aws-shell,代码行数:10,代码来源:test_toolbar.py

示例7: test_toolbar_on

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def test_toolbar_on(self):
        self.aws_shell.model_completer.match_fuzzy = True
        self.aws_shell.enable_vi_bindings = True
        self.aws_shell.show_completion_columns = True
        self.aws_shell.show_help = True
        expected = [
            (Token.Toolbar.On, ' [F2] Fuzzy: ON '),
            (Token.Toolbar.On, ' [F3] Keys: Vi '),
            (Token.Toolbar.On, ' [F4] Multi Column '),
            (Token.Toolbar.On, ' [F5] Help: ON '),
            (Token.Toolbar, ' [F9] Focus: doc '),
            (Token.Toolbar, ' [F10] Exit ')]
        assert expected == self.toolbar.handler(self.cli) 
开发者ID:awslabs,项目名称:aws-shell,代码行数:15,代码来源:test_toolbar.py

示例8: test_toolbar_off

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def test_toolbar_off(self):
        self.aws_shell.model_completer.match_fuzzy = False
        self.aws_shell.enable_vi_bindings = False
        self.aws_shell.show_completion_columns = False
        self.aws_shell.show_help = False
        self.cli.current_buffer_name = 'DEFAULT_BUFFER'
        expected = [
            (Token.Toolbar.Off, ' [F2] Fuzzy: OFF '),
            (Token.Toolbar.On, ' [F3] Keys: Emacs '),
            (Token.Toolbar.On, ' [F4] Single Column '),
            (Token.Toolbar.Off, ' [F5] Help: OFF '),
            (Token.Toolbar, ' [F9] Focus: cli '),
            (Token.Toolbar, ' [F10] Exit ')]
        assert expected == self.toolbar.handler(self.cli) 
开发者ID:awslabs,项目名称:aws-shell,代码行数:16,代码来源:test_toolbar.py

示例9: create_toolbar_handler

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def create_toolbar_handler(is_long_option, is_fuzzy):

    assert callable(is_long_option)
    assert callable(is_fuzzy)

    def get_toolbar_items(_):
        """
        Return bottom menu items
        :param _: cli instance
        :return: list of Token.Toolbar
        """

        if is_long_option():
            option_mode_token = Token.Toolbar.On
            option_mode = 'Long'
        else:
            option_mode_token = Token.Toolbar.Off
            option_mode = 'Short'

        if is_fuzzy():
            fuzzy_token = Token.Toolbar.On
            fuzzy = 'ON'
        else:
            fuzzy_token = Token.Toolbar.Off
            fuzzy = 'OFF'

        return [
            (Token.Toolbar, ' [F2] Help '),
            (option_mode_token, ' [F3] Options: {0} '.format(option_mode)),
            (fuzzy_token, ' [F4] Fuzzy: {0} '.format(fuzzy)),
            (Token.Toolbar, ' [F10] Exit ')
        ]

    return get_toolbar_items 
开发者ID:j-bennet,项目名称:wharfee,代码行数:36,代码来源:toolbar.py

示例10: style_factory

# 需要导入模块: from pygments.token import Token [as 别名]
# 或者: from pygments.token.Token import Toolbar [as 别名]
def style_factory(name):
    try:
        style = pygments.styles.get_style_by_name(name)
    except ClassNotFound:
        style = pygments.styles.get_style_by_name('native')

    styles = {}

    styles.update(style.styles)
    styles.update(default_style_extensions)
    styles.update({
        Token.Menu.Completions.Completion.Current: 'bg:#00aaaa #000000',
        Token.Menu.Completions.Completion: 'bg:#008888 #ffffff',
        Token.Menu.Completions.ProgressButton: 'bg:#003333',
        Token.Menu.Completions.ProgressBar: 'bg:#00aaaa',
        Token.Toolbar: 'bg:#222222 #cccccc',
        Token.Toolbar.Off: 'bg:#222222 #004444',
        Token.Toolbar.On: 'bg:#222222 #ffffff',
        Token.Toolbar.Search: 'noinherit bold',
        Token.Toolbar.Search.Text: 'nobold',
        Token.Toolbar.System: 'noinherit bold',
        Token.Toolbar.Arg: 'noinherit bold',
        Token.Toolbar.Arg.Text: 'nobold'
    })

    return PygmentsStyle.from_defaults(style_dict=styles) 
开发者ID:j-bennet,项目名称:wharfee,代码行数:28,代码来源:style.py


注:本文中的pygments.token.Token.Toolbar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。