本文整理匯總了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