当前位置: 首页>>代码示例>>Python>>正文


Python dprint.Colorise类代码示例

本文整理汇总了Python中quodlibet.util.dprint.Colorise的典型用法代码示例。如果您正苦于以下问题:Python Colorise类的具体用法?Python Colorise怎么用?Python Colorise使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Colorise类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_table

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())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:27,代码来源:util.py

示例2: printErrors

 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)
开发者ID:bossjones,项目名称:quodlibet,代码行数:8,代码来源:__init__.py

示例3: bin_debug

def bin_debug(elements, depth=0, lines=None):
    """Takes a list of gst.Element that are part of a prerolled pipeline, and
    recursively gets the children and all caps between the elements.

    Returns a list of text lines suitable for printing.
    """

    from quodlibet.util.dprint import Colorise

    if lines is None:
        lines = []
    else:
        lines.append(" " * (depth - 1) + "\\")

    for i, elm in enumerate(elements):
        for pad in iter_to_list(elm.iterate_sink_pads):
            caps = pad.get_current_caps()
            if caps:
                lines.append("%s| %s" % (" " * depth, caps.to_string()))
        name = elm.get_name()
        cls = Colorise.blue(type(elm).__name__.split(".", 1)[-1])
        lines.append("%s|-%s (%s)" % (" " * depth, cls, name))

        if isinstance(elm, Gst.Bin):
            children = reversed(iter_to_list(elm.iterate_sorted))
            bin_debug(children, depth + 1, lines)

    return lines
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:28,代码来源:util.py

示例4: printErrorList

 def printErrorList(self, flavour, errors):
     for test, err in errors:
         print_(self.MAJOR_SEPARATOR)
         print_(Colorise.red("%s: %s" % (flavour, str(test))))
         print_(self.MINOR_SEPARATOR)
         # tracebacks can contain encoded paths, not sure
         # what the right fix is here, so use repr
         for line in err.splitlines():
             print_(repr(line)[1:-1])
开发者ID:bossjones,项目名称:quodlibet,代码行数:9,代码来源:__init__.py

示例5: __init__

 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="")
开发者ID:mistotebe,项目名称:quodlibet,代码行数:9,代码来源:__init__.py

示例6: _red

 def _red(cls, text):
     from quodlibet.util.dprint import Colorise
     return Colorise.red(text) if cls.use_colors else text
开发者ID:bossjones,项目名称:quodlibet,代码行数:3,代码来源:tests.py

示例7: addFailure

 def addFailure(self, test, err):
     unittest.TestResult.addFailure(self, test, err)
     print_(Colorise.red(self.CHAR_FAILURE), end="")
开发者ID:bossjones,项目名称:quodlibet,代码行数:3,代码来源:__init__.py

示例8: addError

 def addError(self, test, err):
     unittest.TestResult.addError(self, test, err)
     print_(Colorise.red(self.CHAR_ERROR), end="")
开发者ID:bossjones,项目名称:quodlibet,代码行数:3,代码来源:__init__.py

示例9: addSuccess

 def addSuccess(self, test):
     unittest.TestResult.addSuccess(self, test)
     print_(Colorise.green(self.CHAR_SUCCESS), end="")
开发者ID:bossjones,项目名称:quodlibet,代码行数:3,代码来源:__init__.py


注:本文中的quodlibet.util.dprint.Colorise类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。