本文整理汇总了Python中pyte.Screen方法的典型用法代码示例。如果您正苦于以下问题:Python pyte.Screen方法的具体用法?Python pyte.Screen怎么用?Python pyte.Screen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyte
的用法示例。
在下文中一共展示了pyte.Screen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def __init__(self, parent=None):
'''
Constructor
'''
super(self.__class__, self).__init__(parent)
self.setFont(QtGui.QFont({
'win32': 'Consolas',
'linux': 'Monospace',
'darwin': 'Andale Mono'
}.get(sys.platform, 'Courier'), 10))
self.setFocusPolicy(QtCore.Qt.ClickFocus)
self.setStyleSheet("background-color : black; color : #cccccc;")
self._workers = []
self._serial = None
self._thread = None
self._stream = pyte.Stream()
self._vt = pyte.Screen(80, 24)
self._stream.attach(self._vt)
self._workers.append(self._processText)
self._stop = threading.Event()
示例2: create_session
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def create_session(client, message, name=None):
if not name:
SessionManager.last_number += 1
name = SessionManager.last_number
screen = pyte.Screen(80, 24)
session = bash.BashSession(screen)
session.name = name
session.discord_client = client
SessionManager.sessions.append(session)
SessionManager.select(session, message.channel)
print("Created session #%s @ %s[%s]" % (
session.name,
message.channel.name,
(
message.channel.server.name if hasattr(message.channel, "server") else "PM"))
)
return session
示例3: _get_output_lines
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def _get_output_lines(output):
lines = output.split('\n')
screen = pyte.Screen(get_terminal_size().columns, len(lines))
stream = pyte.Stream(screen)
stream.feed('\n'.join(lines))
return screen.display
示例4: _get_output_lines
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def _get_output_lines(script, log_file):
data = log_file.read().decode()
data = re.sub(r'\x00+$', '', data)
lines = data.split('\n')
grouped = list(_group_by_calls(lines))
script_lines = _get_script_group_lines(grouped, script)
screen = pyte.Screen(get_terminal_size().columns, len(script_lines))
stream = pyte.Stream(screen)
stream.feed('\n'.join(script_lines))
return screen.display
示例5: __init_screen_stream
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def __init_screen_stream(self):
"""
Initializing the virtual screen and the character stream
"""
self._stream = pyte.ByteStream()
self._screen = pyte.Screen(100, 35)
self._stream.attach(self._screen)
示例6: __init_screen_stream
# 需要导入模块: import pyte [as 别名]
# 或者: from pyte import Screen [as 别名]
def __init_screen_stream(self):
"""
初始化虚拟屏幕和字符流
"""
self.stream = pyte.ByteStream()
self.screen = pyte.Screen(80, 24)
self.stream.attach(self.screen)