本文整理匯總了Python中quodlibet.util.dprint.Colorise.bold方法的典型用法代碼示例。如果您正苦於以下問題:Python Colorise.bold方法的具體用法?Python Colorise.bold怎麽用?Python Colorise.bold使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.util.dprint.Colorise
的用法示例。
在下文中一共展示了Colorise.bold方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: print_table
# 需要導入模塊: from quodlibet.util.dprint import Colorise [as 別名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 別名]
def print_table(rows, headers, nicks, order):
"""Print a fancy table"""
rows.insert(0, headers)
rows = filter_table(rows, nicks, order)
if not rows:
return
widths = []
for c in range(len(rows[0])):
widths.append(max(map(lambda r: len(r[c]), rows)))
seperator = " %s " % Colorise.gray("|")
format_string = seperator.join(["%%-%ds" % w for w in widths])
header = []
for i, h in enumerate(rows.pop(0)):
header.append(h.ljust(widths[i], " "))
line_width = len(" ".join(header)) + 2
header = [Colorise.bold(h) for h in header]
header_line = " " + (" %s " % Colorise.gray("|")).join(header)
print_(header_line.rstrip())
print_(Colorise.gray("-" * line_width))
for row in rows:
print_(" " + (format_string % tuple(row)).rstrip())
示例2: printErrors
# 需要導入模塊: from quodlibet.util.dprint import Colorise [as 別名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 別名]
def printErrors(self):
succ = self.testsRun - (len(self.errors) + len(self.failures))
v = Colorise.bold("%3d" % succ)
cv = Colorise.green(v) if succ == self.testsRun else Colorise.red(v)
count = self.TEST_RESULTS_WIDTH - self.testsRun
print_((" " * count) + cv)
self.printErrorList('ERROR', self.errors)
self.printErrorList('FAIL', self.failures)
示例3: __init__
# 需要導入模塊: from quodlibet.util.dprint import Colorise [as 別名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 別名]
def __init__(self, test_name, num_tests, out=sys.stdout, failfast=False):
super(Result, self).__init__()
self.out = out
self.failfast = failfast
if hasattr(out, "flush"):
out.flush()
pref = "%s (%d): " % (Colorise.bold(test_name), num_tests)
line = pref + " " * (self.TEST_NAME_WIDTH - len(test_name) - 7 - int(num_tests and log(num_tests, 10) or 0))
print_(line, end="")