Python pygments.token.Token.Toolbar() Examples
The following are 10
code examples of pygments.token.Token.Toolbar().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygments.token.Token
, or try the search function
.
Example #1
Source File: color_styles.py From azure-cli-shell with MIT License | 6 votes |
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 })
Example #2
Source File: toolbar.py From kube-shell with Apache License 2.0 | 6 votes |
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
Example #3
Source File: ptk.py From pyq with Apache License 2.0 | 5 votes |
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))]
Example #4
Source File: layout.py From azure-cli-shell with MIT License | 5 votes |
def get_tutorial_tokens(cli): """ tutorial tokens """ return [(Token.Toolbar, 'In Tutorial Mode: Press [Enter] after typing each part')]
Example #5
Source File: layout.py From azure-cli-shell with MIT License | 5 votes |
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
Example #6
Source File: test_toolbar.py From aws-shell with Apache License 2.0 | 5 votes |
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)
Example #7
Source File: test_toolbar.py From aws-shell with Apache License 2.0 | 5 votes |
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)
Example #8
Source File: test_toolbar.py From aws-shell with Apache License 2.0 | 5 votes |
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)
Example #9
Source File: toolbar.py From wharfee with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #10
Source File: style.py From wharfee with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)