本文整理汇总了Python中prompt_toolkit.token.Token.Transparent方法的典型用法代码示例。如果您正苦于以下问题:Python Token.Transparent方法的具体用法?Python Token.Transparent怎么用?Python Token.Transparent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prompt_toolkit.token.Token
的用法示例。
在下文中一共展示了Token.Transparent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _area_is_empty
# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import Transparent [as 别名]
def _area_is_empty(self, screen, write_position):
"""
Return True when the area below the write position is still empty.
(For floats that should not hide content underneath.)
"""
wp = write_position
Transparent = Token.Transparent
for y in range(wp.ypos, wp.ypos + wp.height):
if y in screen.data_buffer:
row = screen.data_buffer[y]
for x in range(wp.xpos, wp.xpos + wp.width):
c = row[x]
if c.char != ' ' or c.token != Transparent:
return False
return True
示例2: __init__
# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import Transparent [as 别名]
def __init__(self, default_char=None, initial_width=0, initial_height=0):
if default_char is None:
default_char = _CHAR_CACHE[' ', Transparent]
self.data_buffer = defaultdict(lambda: defaultdict(lambda: default_char))
#: Escape sequences to be injected.
self.zero_width_escapes = defaultdict(lambda: defaultdict(lambda: ''))
#: Position of the cursor.
self.cursor_position = Point(y=0, x=0)
#: Visibility of the cursor.
self.show_cursor = True
#: (Optional) Where to position the menu. E.g. at the start of a completion.
#: (We can't use the cursor position, because we don't want the
#: completion menu to change its position when we browse through all the
#: completions.)
self.menu_position = None
#: Currently used width/height of the screen. This will increase when
#: data is written to the screen.
self.width = initial_width or 0
self.height = initial_height or 0
示例3: __init__
# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import Transparent [as 别名]
def __init__(self, get_tokens, default_char=None, get_default_char=None,
align_right=False, align_center=False, has_focus=False):
assert callable(get_tokens)
assert default_char is None or isinstance(default_char, Char)
assert get_default_char is None or callable(get_default_char)
assert not (default_char and get_default_char)
self.align_right = to_cli_filter(align_right)
self.align_center = to_cli_filter(align_center)
self._has_focus_filter = to_cli_filter(has_focus)
self.get_tokens = get_tokens
# Construct `get_default_char` callable.
if default_char:
get_default_char = lambda _: default_char
elif not get_default_char:
get_default_char = lambda _: Char(' ', Token.Transparent)
self.get_default_char = get_default_char
#: Cache for the content.
self._content_cache = SimpleCache(maxsize=18)
self._token_cache = SimpleCache(maxsize=1)
# Only cache one token list. We don't need the previous item.
# Render info for the mouse support.
self._tokens = None