Download:
child 23:9f9b68ad5068
parent 21:0c0cb021d530
22:7fe853d16460
Anton Shestakov <av6@dwimlabs.net>, Wed, 15 Jun 2016 22:02:33 +0800
viewer: add labels for errors and warnings

1 файлов изменено, 8 вставок(+), 4 удалений(-) [+]
viewer.py file | annotate | diff | comparison | revisions
--- a/viewer.py Wed Jun 15 21:35:37 2016 +0800
+++ b/viewer.py Wed Jun 15 22:02:33 2016 +0800
@@ -83,11 +83,15 @@
parts.append(('#777', 62, 30.5, 'unknown'))
elif check.errors or check.warnings:
if check.errors:
- w = 7 + 6 * len(str(check.errors)) + 7
- parts.append(('#da314b', w, w / 2 - 0.5, check.errors))
+ msg = self.locale.translate('{} error', '{} errors', check.errors)
+ text = msg.format(check.errors)
+ width = 7 + 6 * len(text) + 7
+ parts.append(('#da314b', width, width // 2 - 0.5, text))
if check.warnings:
- w = 7 + 6 * len(str(check.warnings)) + 7
- parts.append(('#faa732', w, w / 2 - 0.5, check.warnings))
+ msg = self.locale.translate('{} warning', '{} warnings', check.warnings)
+ text = msg.format(check.warnings)
+ width = 7 + 6 * len(text) + 9
+ parts.append(('#faa732', width, width // 2 + 0.5, text))
else:
parts.append(('#8cc14c', 40, 19.5, 'none'))
width = sum(p[1] for p in parts)