comparison cagou/core/xmlui.py @ 204:37638765c97b

xmlui: implemented ConfirmDialog using new dialog.ConfirmDialog
author Goffi <goffi@goffi.org>
date Fri, 25 May 2018 11:59:16 +0200
parents 8ed389d15690
children add3dcd65dd6
comparison
equal deleted inserted replaced
203:dbd2274fc78b 204:37638765c97b
32 from kivy.uix.widget import Widget 32 from kivy.uix.widget import Widget
33 from kivy.uix.dropdown import DropDown 33 from kivy.uix.dropdown import DropDown
34 from kivy.uix.switch import Switch 34 from kivy.uix.switch import Switch
35 from kivy import properties 35 from kivy import properties
36 from cagou import G 36 from cagou import G
37 from cagou.core import dialog
37 38
38 39
39 ## Widgets ## 40 ## Widgets ##
40 41
41 42
414 xmlui.NoteDialog.__init__(self, _xmlui_parent) 415 xmlui.NoteDialog.__init__(self, _xmlui_parent)
415 self.title, self.message, self.level = title, message, level 416 self.title, self.message, self.level = title, message, level
416 417
417 def _xmluiShow(self): 418 def _xmluiShow(self):
418 G.host.addNote(self.title, self.message, self.level) 419 G.host.addNote(self.title, self.message, self.level)
420
421
422 class ConfirmDialog(xmlui.ConfirmDialog, dialog.ConfirmDialog):
423
424 def __init__(self, _xmlui_parent, title, message, level, buttons_set):
425 dialog.ConfirmDialog.__init__(self,
426 title=title,
427 message=message,
428 no_cb = self.no_cb,
429 yes_cb = self.yes_cb)
430 xmlui.ConfirmDialog.__init__(self, _xmlui_parent)
431
432 def no_cb(self):
433 G.host.closeUI()
434 self._xmluiCancelled()
435
436 def yes_cb(self):
437 G.host.closeUI()
438 self._xmluiValidated()
439
440 def _xmluiShow(self):
441 G.host.addNotifUI(self)
442
443 def _xmluiClose(self):
444 G.host.closeUI()
445
446 def show(self, *args, **kwargs):
447 assert kwargs["force"]
448 G.host.showUI(self)
419 449
420 450
421 class FileDialog(xmlui.FileDialog, BoxLayout): 451 class FileDialog(xmlui.FileDialog, BoxLayout):
422 message = properties.ObjectProperty() 452 message = properties.ObjectProperty()
423 453