Mercurial > libervia-backend
comparison sat_frontends/jp/xmlui_manager.py @ 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 |
parents | fee60f17ebac |
children | 9d0df638c8b4 |
comparison
equal
deleted
inserted
replaced
3092:9464ad3b2ece | 3093:d909473a76cc |
---|---|
442 Dialog.__init__(self, xmlui_parent) | 442 Dialog.__init__(self, xmlui_parent) |
443 xmlui_base.NoteDialog.__init__(self, xmlui_parent) | 443 xmlui_base.NoteDialog.__init__(self, xmlui_parent) |
444 self.title, self.message, self.level = title, message, level | 444 self.title, self.message, self.level = title, message, level |
445 | 445 |
446 async def show(self): | 446 async def show(self): |
447 # TODO: handle title and level | 447 # TODO: handle title |
448 self.disp(self.message) | 448 error = self.level in (C.XMLUI_DATA_LVL_WARNING, C.XMLUI_DATA_LVL_ERROR) |
449 if self.level == C.XMLUI_DATA_LVL_WARNING: | |
450 msg = A.color(C.A_WARNING, self.message) | |
451 elif self.level == C.XMLUI_DATA_LVL_ERROR: | |
452 msg = A.color(C.A_FAILURE, self.message) | |
453 else: | |
454 msg = self.message | |
455 self.disp(msg, error=error) | |
449 | 456 |
450 | 457 |
451 class ConfirmDialog(xmlui_base.ConfirmDialog, Dialog): | 458 class ConfirmDialog(xmlui_base.ConfirmDialog, Dialog): |
452 | 459 |
453 def __init__(self, xmlui_parent, title, message, level, buttons_set): | 460 def __init__(self, xmlui_parent, title, message, level, buttons_set): |