-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpopups.py
More file actions
31 lines (23 loc) · 755 Bytes
/
popups.py
File metadata and controls
31 lines (23 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
UI popups.
"""
__author__ = 'Holger Fleischmann'
__copyright__ = 'Copyright 2018, Holger Fleischmann, Bavaria/Germany'
__license__ = 'Apache License 2.0'
from kivy.properties import StringProperty
from kivy.uix.popup import Popup
class OkCancelPopup(Popup):
message = StringProperty()
result = StringProperty()
def __init__(self, ok_callback=None, title='missing title', **kwargs):
super().__init__(title=title, **kwargs)
self.ok_callback = ok_callback
self.open()
def ok_action(self):
self.dismiss()
self.result = 'ok'
if self.ok_callback is not None:
self.ok_callback()
def cancel_action(self):
self.dismiss()
self.result = 'cancel'