-
Notifications
You must be signed in to change notification settings - Fork 4
/
popup.py
54 lines (37 loc) · 1.25 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
# coding: utf-8
# This file is part of https://github.com/marcus67/gitsynchista
import ui
import six
import log
import ui_util
if six.PY3:
from importlib import reload
reload(log)
reload(ui_util)
global logger
logger = log.open_logging(__name__)
DEFAULT_TITLE = 'Additional Information'
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')
self.view.width = min(ui.get_screen_size())
self.view.height = min(ui.get_screen_size())
def handle_action(self, sender):
global logger
if sender.name == 'button_close':
self.view.close()
else:
logger.warning("Action '%s' not handled!" % sender.name)
return 0
def present(self, info, style='sheet', title=DEFAULT_TITLE, close_label="Close"):
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()