comparison cagou/core/xmlui.py @ 243:50f7c000b4ae

xmlui: implemented MessageDialog
author Goffi <goffi@goffi.org>
date Thu, 03 Jan 2019 20:37:55 +0100
parents 661b9cf7b4e4
children 1f579baf787a
comparison
equal deleted inserted replaced
242:c2503168fab7 243:50f7c000b4ae
409 409
410 def _xmluiShow(self): 410 def _xmluiShow(self):
411 G.host.addNote(self.title, self.message, self.level) 411 G.host.addNote(self.title, self.message, self.level)
412 412
413 413
414 class MessageDialog(xmlui.MessageDialog, dialog.MessageDialog):
415
416 def __init__(self, _xmlui_parent, title, message, level):
417 dialog.MessageDialog.__init__(self,
418 title=title,
419 message=message,
420 level=level,
421 close_cb = self.close_cb)
422 xmlui.MessageDialog.__init__(self, _xmlui_parent)
423
424 def close_cb(self):
425 self._xmluiClose()
426
427 def _xmluiShow(self):
428 G.host.addNotifUI(self)
429
430 def _xmluiClose(self):
431 G.host.closeUI()
432
433 def show(self, *args, **kwargs):
434 G.host.showUI(self)
435
436
414 class ConfirmDialog(xmlui.ConfirmDialog, dialog.ConfirmDialog): 437 class ConfirmDialog(xmlui.ConfirmDialog, dialog.ConfirmDialog):
415 438
416 def __init__(self, _xmlui_parent, title, message, level, buttons_set): 439 def __init__(self, _xmlui_parent, title, message, level, buttons_set):
417 dialog.ConfirmDialog.__init__(self, 440 dialog.ConfirmDialog.__init__(self,
418 title=title, 441 title=title,
499 522
500 523
501 class XMLUIPanel(xmlui.XMLUIPanel, BoxLayout): 524 class XMLUIPanel(xmlui.XMLUIPanel, BoxLayout):
502 widget_factory = WidgetFactory() 525 widget_factory = WidgetFactory()
503 526
504 def __init__(self, host, parsed_xml, title=None, flags=None, callback=None, ignore=None, whitelist=None, profile=C.PROF_KEY_NONE): 527 def __init__(self, host, parsed_xml, title=None, flags=None, callback=None,
528 ignore=None, whitelist=None, profile=C.PROF_KEY_NONE):
505 BoxLayout.__init__(self) 529 BoxLayout.__init__(self)
506 self.close_cb = None 530 self.close_cb = None
507 self._post_treats = [] # list of callback to call after UI is constructed 531 self._post_treats = [] # list of callback to call after UI is constructed
508 xmlui.XMLUIPanel.__init__(self, 532 xmlui.XMLUIPanel.__init__(self,
509 host, 533 host,