jp (xmlui_manager): use level for notes:

display notes in specific colors according to level, and use stderr for warnings and
errors.
This commit is contained in:
Goffi 2019-12-20 12:28:04 +01:00
commit 5c1dd0da49

View file

@ -444,8 +444,15 @@ class NoteDialog(xmlui_base.NoteDialog, Dialog):
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):