-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.py
55 lines (35 loc) · 1.12 KB
/
popup.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# coding: utf-8
# This file is part of https://github.com/marcus67/rechtschreibung
import ui
import six
import defaults
import ui_util
import rulesets
if six.PY3:
from importlib import reload
reload(defaults)
reload(ui_util)
reload(rulesets)
from rulesets import *
DEFAULT_TITLE = 'Zusätzliche Info'
class PopupViewController ( ui_util.ViewController ) :
def __init__(self):
super(PopupViewController, self).__init__(None)
self.load('popup')
self.info_text_view = self.find_subview_by_name('textview_info_text')
self.button_view = self.find_subview_by_name('button_close')
def handle_action(self, sender):
if sender.name == 'button_close':
self.view.close()
else:
print ("WARNING: action '%s' not handled!" % sender.name)
return 0
def present(self, info, style='sheet', title=DEFAULT_TITLE, close_label=defaults.DEFAULT_CLOSE_LABEL):
self.info_text_view.text = info
self.button_view.title = close_label
super(PopupViewController, self).present(style)
def test():
popup_vc = PopupViewController()
popup_vc.present("Hallo!", close_label="Close")
if __name__ == '__main__':
test()