Mercurial > libervia-desktop-kivy
changeset 204:37638765c97b
xmlui: implemented ConfirmDialog using new dialog.ConfirmDialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 May 2018 11:59:16 +0200 |
parents | dbd2274fc78b |
children | 9cefc9f8efc9 |
files | cagou/core/xmlui.py |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/cagou/core/xmlui.py Fri May 25 11:58:06 2018 +0200 +++ b/cagou/core/xmlui.py Fri May 25 11:59:16 2018 +0200 @@ -34,6 +34,7 @@ from kivy.uix.switch import Switch from kivy import properties from cagou import G +from cagou.core import dialog ## Widgets ## @@ -418,6 +419,35 @@ G.host.addNote(self.title, self.message, self.level) +class ConfirmDialog(xmlui.ConfirmDialog, dialog.ConfirmDialog): + + def __init__(self, _xmlui_parent, title, message, level, buttons_set): + dialog.ConfirmDialog.__init__(self, + title=title, + message=message, + no_cb = self.no_cb, + yes_cb = self.yes_cb) + xmlui.ConfirmDialog.__init__(self, _xmlui_parent) + + def no_cb(self): + G.host.closeUI() + self._xmluiCancelled() + + def yes_cb(self): + G.host.closeUI() + self._xmluiValidated() + + def _xmluiShow(self): + G.host.addNotifUI(self) + + def _xmluiClose(self): + G.host.closeUI() + + def show(self, *args, **kwargs): + assert kwargs["force"] + G.host.showUI(self) + + class FileDialog(xmlui.FileDialog, BoxLayout): message = properties.ObjectProperty()