changeset 3093:d909473a76cc

jp (xmlui_manager): use level for notes: display notes in specific colors according to level, and use stderr for warnings and errors.
author Goffi <goffi@goffi.org>
date Fri, 20 Dec 2019 12:28:04 +0100 (2019-12-20)
parents 9464ad3b2ece
children c3cb18236bdf
files sat_frontends/jp/xmlui_manager.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/jp/xmlui_manager.py	Fri Dec 20 12:28:04 2019 +0100
+++ b/sat_frontends/jp/xmlui_manager.py	Fri Dec 20 12:28:04 2019 +0100
@@ -444,8 +444,15 @@
         self.title, self.message, self.level = title, message, level
 
     async def show(self):
-        # TODO: handle title and level
-        self.disp(self.message)
+        # TODO: handle title
+        error = self.level in (C.XMLUI_DATA_LVL_WARNING, C.XMLUI_DATA_LVL_ERROR)
+        if self.level == C.XMLUI_DATA_LVL_WARNING:
+            msg = A.color(C.A_WARNING, self.message)
+        elif self.level == C.XMLUI_DATA_LVL_ERROR:
+            msg = A.color(C.A_FAILURE, self.message)
+        else:
+            msg = self.message
+        self.disp(msg, error=error)
 
 
 class ConfirmDialog(xmlui_base.ConfirmDialog, Dialog):