本文整理汇总了Python中blessed.Terminal.standout方法的典型用法代码示例。如果您正苦于以下问题:Python Terminal.standout方法的具体用法?Python Terminal.standout怎么用?Python Terminal.standout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blessed.Terminal
的用法示例。
在下文中一共展示了Terminal.standout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Terminal
# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import standout [as 别名]
return text
try:
from blessed import Terminal
except ImportError, exc:
import sys
print >>sys.stderr, 'WARNING: Terminal colorization disabled' + \
' because of ImportError: {0}'.format(exc)
Terminal = FakeTerminal
TERMINAL = Terminal()
FLAGS = {
'done': TERMINAL.green('done'),
'orphan': TERMINAL.standout(TERMINAL.red('ORPHAN')),
'outdated_fs_version': TERMINAL.standout(
TERMINAL.red('FS-VERSION-OUTDATED')),
'proposed': TERMINAL.blue('proposed')}
def print_table(data, titles=None, colspace=1):
if titles:
data.insert(0, map(TERMINAL.bright_black, titles))
column_lengths = map(max, zip(*map(
lambda row: map(TERMINAL.length, row), data)))
for row in data:
for col_num, cell in enumerate(row):
print TERMINAL.ljust(cell, column_lengths[col_num] + colspace),
print ''
示例2: __call__
# 需要导入模块: from blessed import Terminal [as 别名]
# 或者: from blessed.Terminal import standout [as 别名]
return str.__getattribute__(self, name)
def __call__(self, text):
return text
try:
from blessed import Terminal
except ImportError, exc:
Terminal = FakeTerminal
TERMINAL = Terminal()
FLAGS = {
'done': TERMINAL.green('done'),
'orphan': TERMINAL.standout(TERMINAL.red('ORPHAN')),
'outdated_fs_version': TERMINAL.standout(
TERMINAL.red('FS-VERSION-OUTDATED')),
'deferrable': TERMINAL.standout(TERMINAL.blue('DEFERRABLE')),
'proposed': TERMINAL.blue('proposed')}
def print_table(data, titles=None, colspace=1):
if titles:
data.insert(0, map(TERMINAL.bright_black, titles))
column_lengths = map(max, zip(*map(
lambda row: map(TERMINAL.length, row), data)))
for row in data:
for col_num, cell in enumerate(row):
print TERMINAL.ljust(cell, column_lengths[col_num] + colspace),