本文整理汇总了Python中blessed.Terminal.enter_fullscreen方法的典型用法代码示例。如果您正苦于以下问题:Python Terminal.enter_fullscreen方法的具体用法?Python Terminal.enter_fullscreen怎么用?Python Terminal.enter_fullscreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blessed.Terminal
的用法示例。
在下文中一共展示了Terminal.enter_fullscreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CalculonDisplay
# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import enter_fullscreen [as 别名]
class CalculonDisplay (object):
def __init__(self):
self.term = Terminal()
print(self.term.enter_fullscreen())
# parse config
self.config = self.init_config(config)
self.bin_mode = self.config['bin_mode']
self.cur_bin_mode = None
self.bits = self.config['bits']
self.formats = self.config['formats']
self.align = self.config['align']
self.padding = self.config['padding']
self.attrs = self.config['attrs']
self.header = 'calculon'
self.show_header = True
# Watched variables
self.lastval = 0
# Watched expressions
self.exprs = []
self.draw_state = {
'header': True, 'value': True, 'vallabel': True, 'binlabel': True,
'varlabel': True, 'varvalue': True, 'exprlabel': True, 'exprvalue': True,
'all': True
}
# set initial value
self.update_value(0)
@Pyro4.expose
def are_you_there(self):
return True
def init_config(self, config):
# update text attributes
for sec in config['attrs']:
config['attrs'][sec] = ''.join(['{t.' + x + '}' for x in config['attrs'][sec]])
return config
def set_win(self, win, repl_win):
self.win = win
self.repl_win = repl_win
self.update_value(0)
self.redraw()
def update_bin_mode(self):
# detect bin display mode
old_mode = self.cur_bin_mode
if self.bin_mode == "auto":
self.cur_bin_mode = "wide" if self.term.width >= BIN_MODE_WIDTH_WIDE else "narrow"
if self.cur_bin_mode != old_mode:
self.draw_state['all'] = True
# round up bits to nearest row
self.bin_row = BIN_MODE_ROW_NARROW if self.cur_bin_mode == "narrow" else BIN_MODE_ROW_WIDE
if self.bits % self.bin_row > 0:
self.bits += self.bin_row - (self.bits % self.bin_row)
@Pyro4.expose
def update_value(self, value):
self.lastval = value
self.draw_state['value'] = True
self.redraw()
@Pyro4.expose
def set_exprs(self, values):
self.exprs = values
self.draw_state['exprvalue'] = True
self.draw_state['exprlabel'] = True
self.redraw()
@Pyro4.expose
def redraw(self, all=False):
global needs_redraw
self.update_bin_mode()
if all or needs_redraw:
self.draw_state['all'] = True
needs_redraw = False
if self.draw_state['all']:
print(self.term.clear())
if self.draw_state['header'] or self.draw_state['all']:
self.draw_header()
self.draw_state['header'] = False
if self.draw_state['value'] or self.draw_state['all']:
self.clear_value()
self.draw_value()
self.draw_binary()
self.draw_state['value'] = False
if self.draw_state['vallabel'] or self.draw_state['all']:
self.draw_value_labels()
self.draw_binary_labels()
self.draw_state['vallabel'] = False
if self.draw_state['exprlabel'] or self.draw_state['all']:
#.........这里部分代码省略.........