Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
New tests
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
import npyscreen | ||
|
||
class TestForm(npyscreen.FormMutt): | ||
def __init__(self, *args, **keywords): | ||
super(TestForm, self).__init__(*args, **keywords) | ||
self.add_handlers({"^R": self.go_to_main}) | ||
|
||
def go_to_main(self, t): | ||
raise ValueError | ||
|
||
|
||
|
||
class TestApp(npyscreen.NPSApp): | ||
def main(self): | ||
F = TestForm() | ||
F.wStatus1.value = "Status Line " | ||
F.wStatus2.value = "Second Status Line " | ||
F.wMain.values = [str(x) for x in range(500)] | ||
|
||
F.edit() | ||
|
||
|
||
if __name__ == "__main__": | ||
App = TestApp() | ||
App.run() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
import npyscreen | ||
|
||
class EditorFormExample(npyscreen.FormMutt): | ||
MAIN_WIDGET_CLASS = npyscreen.Pager | ||
|
||
class TestApp(npyscreen.NPSApp): | ||
def main(self): | ||
F = EditorFormExample() | ||
F.wStatus1.value = "Status Line " | ||
F.wStatus2.value = "Second Status Line " | ||
F.wMain.editable = False | ||
F.wMain.autowrap = True | ||
F.wMain.center = True | ||
|
||
|
||
#F.wMain.buffer([str(r) for r in range(100)], scroll_if_editing=True) | ||
#with open("/Users/nicholas/Downloads/pg2600.txt", 'r') as war_and_peace: | ||
with open("setup.py", 'r') as war_and_peace: | ||
F.wMain.values = war_and_peace.readlines()[:50] | ||
#F.wMain.values = war_and_peace.readlines() | ||
|
||
F.edit() | ||
|
||
|
||
if __name__ == "__main__": | ||
App = TestApp() | ||
App.run() |