forked from npcole/npyscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testtreebug.py
31 lines (24 loc) · 836 Bytes
/
testtreebug.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
import npyscreen
tree_data = npyscreen.NPSTreeData()
tree_data.newChild(content={'a': 1})
q = tree_data.newChild(content={'b': 2})
q.newChild(content={'c': 4})
class MyTreeLineAnnotated(npyscreen.TreeLineAnnotated):
def getAnnotationAndColor(self):
# AHH, self.value is an empty str, this fails.
#if self.value:
content = str(self.value)
return (content, self._annotatecolor)
def display_value(self, vl):
return str(vl)
class MyTree(npyscreen.MultiLineTreeNew):
_contained_widgets = MyTreeLineAnnotated
def display_value(self, vl):
return vl
class MyForm(npyscreen.Form):
def create(self):
self.series_view = self.add(MyTree, values=tree_data)
def myFunction(*args):
F = MyForm(name = "My Form")
F.edit()
npyscreen.wrapper_basic(myFunction)