# HG changeset patch # User Goffi # Date 1527242356 -7200 # Node ID 37638765c97b4314b9742f4244c0dd4fceaa2b4d # Parent dbd2274fc78b958352055ba2baaaaef478f1e118 xmlui: implemented ConfirmDialog using new dialog.ConfirmDialog diff -r dbd2274fc78b -r 37638765c97b cagou/core/xmlui.py --- 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()