本文整理汇总了Python中prompt_toolkit.layout.screen.Screen方法的典型用法代码示例。如果您正苦于以下问题:Python screen.Screen方法的具体用法?Python screen.Screen怎么用?Python screen.Screen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prompt_toolkit.layout.screen
的用法示例。
在下文中一共展示了screen.Screen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _reset_screen
# 需要导入模块: from prompt_toolkit.layout import screen [as 别名]
# 或者: from prompt_toolkit.layout.screen import Screen [as 别名]
def _reset_screen(self):
""" Reset the Screen content. (also called when switching from/to
alternate buffer. """
self.pt_screen = Screen(default_char=Char(' ', ''))
self.pt_screen.cursor_position = CursorPosition(0, 0)
self.pt_screen.show_cursor = True
self.data_buffer = self.pt_screen.data_buffer
self.pt_cursor_position = self.pt_screen.cursor_position
self._attrs = Attrs(color=None, bgcolor=None, bold=False,
underline=False, italic=False, blink=False, reverse=False)
self._style_str = ''
self.margins = None
self.max_y = 0 # Max 'y' position to which is written.
示例2: clear
# 需要导入模块: from prompt_toolkit.layout import screen [as 别名]
# 或者: from prompt_toolkit.layout.screen import Screen [as 别名]
def clear(self):
"""
Clear screen and go to 0,0
"""
# Erase current output first.
self.erase()
# Send "Erase Screen" command and go to (0, 0).
output = self.output
output.erase_screen()
output.cursor_goto(0, 0)
output.flush()
self.request_absolute_cursor_position()
示例3: last_rendered_screen
# 需要导入模块: from prompt_toolkit.layout import screen [as 别名]
# 或者: from prompt_toolkit.layout.screen import Screen [as 别名]
def last_rendered_screen(self):
"""
The `Screen` class that was generated during the last rendering.
This can be `None`.
"""
return self._last_screen
示例4: reset
# 需要导入模块: from prompt_toolkit.layout import screen [as 别名]
# 或者: from prompt_toolkit.layout.screen import Screen [as 别名]
def reset(self):
"""Resets the terminal to its initial state.
* Scroll margins are reset to screen boundaries.
* Cursor is moved to home location -- ``(0, 0)`` and its
attributes are set to defaults (see :attr:`default_char`).
* Screen is cleared -- each character is reset to
:attr:`default_char`.
* Tabstops are reset to "every eight columns".
.. note::
Neither VT220 nor VT102 manuals mentioned that terminal modes
and tabstops should be reset as well, thanks to
:manpage:`xterm` -- we now know that.
"""
self._reset_screen()
self.title = ''
self.icon_name = ''
# Reset modes.
self.mode = set([mo.DECAWM, mo.DECTCEM])
# According to VT220 manual and ``linux/drivers/tty/vt.c``
# the default G0 charset is latin-1, but for reasons unknown
# latin-1 breaks ascii-graphics; so G0 defaults to cp437.
# XXX: The comment above comes from the original Pyte implementation,
# it seems for us that LAT1_MAP should indeed be the default, if
# not a French version of Vim would incorrectly show some
# characters.
self.charset = 0
# self.g0_charset = cs.IBMPC_MAP
self.g0_charset = cs.LAT1_MAP
self.g1_charset = cs.VT100_MAP
# From ``man terminfo`` -- "... hardware tabs are initially
# set every `n` spaces when the terminal is powered up. Since
# we aim to support VT102 / VT220 and linux -- we use n = 8.
# (We choose to create tab stops until x=1000, because we keep the
# tab stops when the screen increases in size. The OS X 'ls' command
# relies on the stops to be there.)
self.tabstops = set(range(8, 1000, 8))
# The original Screen instance, when going to the alternate screen.
self._original_screen = None