From 7cd7962c711fda790e2928eed9a8775b9f3ee2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Corr=C3=AAa=20da=20Silva=20Sanches?= Date: Fri, 19 May 2017 20:58:32 -0300 Subject: [PATCH] revert 90c9dee01f152b495bffcc7670b268234d245f11 Bring back commandline progressbar (it is actualy useful for some people) (issue #1357) --- Lib/fontbakery/fbchecklogger.py | 18 ++++++++++++++++++ bin/fontbakery-check-ttf.py | 2 ++ 2 files changed, 20 insertions(+) diff --git a/Lib/fontbakery/fbchecklogger.py b/Lib/fontbakery/fbchecklogger.py index d4648a49a1..2bed957850 100644 --- a/Lib/fontbakery/fbchecklogger.py +++ b/Lib/fontbakery/fbchecklogger.py @@ -28,6 +28,7 @@ NORMAL ) class FontBakeryCheckLogger(): + progressbar = False def __init__(self, config): self.config = config @@ -175,6 +176,22 @@ def output_github_markdown_report(self, a_target): ghm_output.write(markdown_data) self.ghm_report_files.append(output_filename) + def update_progressbar(self): + tick = { + "OK": GREEN_STR.format('.'), + "HOTFIX": BLUE_STR.format('H'), + "ERROR": RED_STR.format('E'), + "WARNING": YELLOW_STR.format('W'), + "SKIP": WHITE_STR.format('S'), + "INFO": CYAN_STR.format('I'), + "unknown": RED_STR.format('?') + } + if self.progressbar is False: + return + else: + print(tick[self.current_check["result"]], end='') + sys.stdout.flush() + def flush(self): if self.current_check is not None: if self.current_check["result"] == "unknown": @@ -186,6 +203,7 @@ def flush(self): " https://github.com/googlefonts/fontbakery/issues/new" "\n").format(self.current_check["check_number"])) + self.update_progressbar() check_number = self.current_check["check_number"] self.all_checks[check_number] = self.current_check self.current_check = None diff --git a/bin/fontbakery-check-ttf.py b/bin/fontbakery-check-ttf.py index f042a70f78..242647f617 100755 --- a/bin/fontbakery-check-ttf.py +++ b/bin/fontbakery-check-ttf.py @@ -55,9 +55,11 @@ def fontbakery_check_ttf(config): elif config['verbose'] >= 2: logger.setLevel(logging.DEBUG) else: + fb.progressbar = True logger.setLevel(logging.CRITICAL) if config['error']: + fb.progressbar = False logger.setLevel(logging.ERROR) # ------------------------------------------------------