forked from humberry/ui-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigationViewExample.py
29 lines (22 loc) · 970 Bytes
/
NavigationViewExample.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
# coding: utf-8
import ui
def make_button_item(action, image_name):
return ui.ButtonItem(action=action, image=ui.Image.named(image_name))
class NavView(ui.View):
def __init__(self):
root_view = ui.load_view()
root_view.left_button_items = [make_button_item(self.bt_close, 'ionicons-close-24')]
root_view.right_button_items = [make_button_item(self.bt_subview, 'ionicons-arrow-right-b-24')]
self.nav_view = ui.NavigationView(root_view)
self.nav_view.present(hide_title_bar=True)
def bt_subview(self, sender):
sub_view = ui.load_view('switchview1.pyui')
sub_view.name = 'subview'
sub_view['btn_Okay'].action = self.bt_action
sub_view['btn_Cancel'].action = self.bt_action
self.nav_view.push_view(sub_view)
def bt_close(self, sender):
self.nav_view.close()
def bt_action(self, sender):
print 'action from ' + sender.name
NavView()