Created
October 17, 2012 21:33
-
-
Save gazpachoking/3908383 to your computer and use it in GitHub Desktop.
npyscreen test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import npyscreen | |
| tree_data = npyscreen.NPSTreeData() | |
| tree_data.newChild(content={'a': 1}) | |
| tree_data.newChild(content={'b': 2}) | |
| class MyTreeLineAnnotated(npyscreen.TreeLineAnnotated): | |
| def getAnnotationAndColor(self): | |
| # AHH, self.value is an empty str, this fails. | |
| content = self.value.getContent() | |
| return (self._annotate, 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment