-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathShowTableView.py
64 lines (55 loc) · 2.27 KB
/
ShowTableView.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
55
56
57
58
59
60
61
62
63
64
# coding: utf-8
import console, os, ui
class ShowTableView(object):
def __init__(self):
self.view = ui.load_view("ShowTableView")
self.view.present("fullscreen")
self.view.name = "ShowTableView"
self.bt_empty_action(None)
def bt_dir_action(self, sender):
dir_items = os.listdir(os.getcwd())
tv1 = self.view["tableview1"]
tv1.data_source = tv1.delegate = ui.ListDataSource(dir_items)
tv1.data_source.delete_enabled = tv1.editing = False
tv1.reload_data()
def bt_empty_action(self, sender):
lst = ui.ListDataSource([])
tv1 = self.view["tableview1"]
tv1.data_source = tv1.delegate = ui.ListDataSource([])
tv1.data_source.delete_enabled = tv1.editing = False
tv1.reload_data()
def bt_picture_action(self, sender):
lst = ui.ListDataSource(
[
{"title": "none", "accessory_type": "none"},
{"title": "checkmark", "accessory_type": "checkmark"},
{"title": "detail_button", "accessory_type": "detail_button"},
{
"title": "detail_disclosure_button",
"accessory_type": "detail_disclosure_button",
},
{
"title": "disclosure_indicator",
"accessory_type": "disclosure_indicator",
},
{
"title": "image24 and checkmark",
"image": "ionicons-images-24",
"accessory_type": "checkmark",
},
{"title": "image32", "image": "ionicons-alert-32"},
{"title": "image256", "image": "ionicons-alert-circled-256"},
{"title": "frog", "image": "Frog_Face"},
{"title": "OwnImage", "image": "Image/OwnImage.png"},
]
)
tv1 = self.view["tableview1"]
tv1.data_source = tv1.delegate = lst
tv1.data_source.delete_enabled = tv1.editing = False
lst.action = self.tv1_action
tv1.reload_data()
@ui.in_background
def tv1_action(self, sender):
info = sender.items[sender.selected_row]
console.alert("info", "\n".join(["{} = {}".format(i, info[i]) for i in info]))
ShowTableView()