forked from npcole/npyscreen
-
Notifications
You must be signed in to change notification settings - Fork 2
/
TESTING-TreeMultiLineBox.py
executable file
·46 lines (34 loc) · 1.45 KB
/
TESTING-TreeMultiLineBox.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
#!/usr/bin/env python
RETURN = []
import osc_npyscreen
class SelectableTreeLine(osc_npyscreen.TreeLineSelectableAnnotated):
def calculate_area_needed(self):
"Need two lines of screen, and any width going"
return 2,0
class TestTree(osc_npyscreen.MLTreeMultiSelect):
_contained_widgets = SelectableTreeLine
_contained_widget_height = 2
class TestApp(osc_npyscreen.NPSApp):
def main(self):
F = osc_npyscreen.Form(name = "Testing Tree class",)
#wgtree = F.add(osc_npyscreen.MLTree)
wgtree = F.add(TestTree)
treedata = osc_npyscreen.NPSTreeData(content='Root', selectable=True,ignoreRoot=False)
c1 = treedata.newChild(content='Child 1', selectable=True, selected=True)
c2 = treedata.newChild(content='Child 2', selectable=True)
g1 = c1.newChild(content='Grand-child 1', selectable=True)
g2 = c1.newChild(content='Grand-child 2', selectable=True)
g3 = c1.newChild(content='Grand-child 3')
gg1 = g1.newChild(content='Great Grand-child 1', selectable=True)
gg2 = g1.newChild(content='Great Grand-child 2', selectable=True)
gg3 = g1.newChild(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