From 0fc335506644bd9a127ee6a8aa676a695a751213 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Thu, 28 Apr 2011 15:32:53 +0200 Subject: [PATCH] Colorize statistic output in GUI. --- doc/changelog.txt | 1 + linkcheck/gui/statistics.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/doc/changelog.txt b/doc/changelog.txt index bb810313..0447ae01 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -10,6 +10,7 @@ Changes: Features: - gui: Add syntax highlighting for Qt editor in case QScintilla is not installed. +- gui: Colorize number of errors in output statistics. 6.8 "Ghost in the shell" (released 26.4.2011) diff --git a/linkcheck/gui/statistics.py b/linkcheck/gui/statistics.py index 27a51c57..3591a702 100644 --- a/linkcheck/gui/statistics.py +++ b/linkcheck/gui/statistics.py @@ -24,6 +24,12 @@ def set_statistics (widget, statistics): widget.stats_url_maxlen.setText(u"%d" % statistics.max_url_length) widget.stats_url_avglen.setText(u"%d" % statistics.avg_url_length) widget.stats_valid_urls.setText(u"%d" % (statistics.number - statistics.errors)) + if statistics.errors > 0: + color = '#aa0000' + else: + color = '#00aa00' + style = "QLabel {font-weight:bold; color:%s;}" % color + widget.stats_invalid_urls.setStyleSheet(style) widget.stats_invalid_urls.setText(u"%d" % statistics.errors) widget.stats_warnings.setText(u"%d" % statistics.warnings) for key, value in statistics.link_types.items():