-
Notifications
You must be signed in to change notification settings - Fork 109
/
TESTING-NewTree.py
executable file
·34 lines (27 loc) · 1.12 KB
/
TESTING-NewTree.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
#!/usr/bin/env python
RETURN = []
import npyscreen
class TestApp(npyscreen.NPSApp):
def main(self):
F = npyscreen.Form(name = "Testing Tree class",)
#wgtree = F.add(npyscreen.MLTree)
wgtree = F.add(npyscreen.MLTreeMultiSelect)
treedata = npyscreen.TreeData(content='Root', selectable=True, ignore_root=False)
c1 = treedata.new_child(content='Child 1', selectable=True, selected=True)
c2 = treedata.new_child(content='Child 2', selectable=True)
g1 = c1.new_child(content='Grand-child 1', selectable=True)
g2 = c1.new_child(content='Grand-child 2', selectable=True)
g3 = c1.new_child(content='Grand-child 3')
gg1 = g1.new_child(content='Great Grand-child 1', selectable=True)
gg2 = g1.new_child(content='Great Grand-child 2', selectable=True)
gg3 = g1.new_child(content='Great Grand-child 3')
wgtree.values = treedata
F.edit()
global RETURN
#RETURN = wgtree.values
RETURN = wgtree.get_selected_objects()
if __name__ == "__main__":
App = TestApp()
App.run()
for v in RETURN:
print v