Source code for tagit.view.dialogues.dialogue
"""Popup dialogue.
Based on code from https://gist.github.com/kived/742397a80d61e6be225a
by Ryan Pessa. The license is provided in the source folder.
Part of the tagit module.
A copy of the license is provided with the project.
Modifications authored by: Matthias Baumgartner, 2016
"""
from kivy.properties import StringProperty
from kivy.uix.popup import Popup
[docs]class Dialogue(Popup):
"""Popup dialogue with OK and Cancel buttons.
Use like below:
>>> dlg = Dialogue()
>>> dlg.bind(on_ok=....)
>>> dlg.bind(on_cancel=...)
>>> dlg.open()
"""
ok_text = StringProperty('OK')
cancel_text = StringProperty('Cancel')
__events__ = ('on_ok', 'on_cancel')
[docs] def ok(self):
"""User pressed the OK button.
"""
self.dispatch('on_ok')
self.dismiss()
[docs] def cancel(self):
"""User pressed the Cancel button.
"""
self.dispatch('on_cancel')
self.dismiss()
[docs] def on_ok(self):
"""Event prototype."""
pass
[docs] def on_cancel(self):
"""Event prototype."""
pass
## EOF ##