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