-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
109 additions
and
98 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 |
---|---|---|
@@ -1,37 +1,42 @@ | ||
#!/usr/bin/env python | ||
import npyscreen | ||
#npyscreen.disableColor() | ||
|
||
|
||
# npyscreen.disableColor() | ||
class ActionFormExample(npyscreen.ActionForm): | ||
initialWidgets = [ | ||
(npyscreen.TitleText, {'w_id': 'TextLine', 'name': "Text:"}), | ||
(npyscreen.TitleFilename, {'name' : "Filename:"}), | ||
(npyscreen.TitleFilename, {'name' : "Filename:"}), | ||
(npyscreen.TitleDateCombo, {'name' : "Date:"}), | ||
(npyscreen.TitleSlider, {'out_of': 12, 'name' : "Slider"}), | ||
(npyscreen.MultiLineEdit, {'value' : """try typing here!\nMutiline text, press ^R to reformat.\n""", 'max_height': 5,}) | ||
] | ||
initialWidgets = [ | ||
(npyscreen.TitleText, {'w_id': 'TextLine', 'name': "Text:"}), | ||
(npyscreen.TitleFilename, {'name': "Filename:"}), | ||
(npyscreen.TitleFilename, {'name': "Filename:"}), | ||
(npyscreen.TitleDateCombo, {'name': "Date:"}), | ||
(npyscreen.TitleSlider, {'out_of': 12, 'name': "Slider"}), | ||
(npyscreen.MultiLineEdit, | ||
{'value': """try typing here!\nMutiline text, press ^R to reformat.\n""", 'max_height': 5, }) | ||
] | ||
|
||
|
||
class TestApp(npyscreen.NPSApp): | ||
def main(self): | ||
# These lines create the form and populate it with widgets. | ||
# A fairly complex screen in only 8 or so lines of code - a line for each control. | ||
F = ActionFormExample(name = "Welcome to Npyscreen",) | ||
#t = F.add(npyscreen.TitleText, name = "Text:", ) | ||
#fn = F.add(npyscreen.TitleFilename, name = "Filename:") | ||
#dt = F.add(npyscreen.TitleDateCombo, name = "Date:") | ||
#s = F.add(npyscreen.TitleSlider, out_of=12, name = "Slider") | ||
#ml= F.add(npyscreen.MultiLineEdit, | ||
# value = """try typing here!\nMutiline text, press ^R to reformat.\n""", | ||
# max_height=5, rely=9) | ||
#ms= F.add(npyscreen.TitleSelectOne, max_height=4, value = [1,], name="Pick One", | ||
# values = ["Option1","Option2","Option3"], scroll_exit=True) | ||
#ms2= F.add(npyscreen.TitleMultiSelect, max_height=4, value = [1,], name="Pick Several", | ||
# values = ["Option1","Option2","Option3"], scroll_exit=True) | ||
# | ||
# This lets the user play with the Form. | ||
F.edit() | ||
return F.get_widget('TextLine').value | ||
def main(self): | ||
# These lines create the form and populate it with widgets. | ||
# A fairly complex screen in only 8 or so lines of code - a line for each control. | ||
F = ActionFormExample(name="Welcome to Npyscreen", ) | ||
# t = F.add(npyscreen.TitleText, name = "Text:", ) | ||
# fn = F.add(npyscreen.TitleFilename, name = "Filename:") | ||
# dt = F.add(npyscreen.TitleDateCombo, name = "Date:") | ||
# s = F.add(npyscreen.TitleSlider, out_of=12, name = "Slider") | ||
# ml= F.add(npyscreen.MultiLineEdit, | ||
# value = """try typing here!\nMutiline text, press ^R to reformat.\n""", | ||
# max_height=5, rely=9) | ||
# ms= F.add(npyscreen.TitleSelectOne, max_height=4, value = [1,], name="Pick One", | ||
# values = ["Option1","Option2","Option3"], scroll_exit=True) | ||
# ms2= F.add(npyscreen.TitleMultiSelect, max_height=4, value = [1,], name="Pick Several", | ||
# values = ["Option1","Option2","Option3"], scroll_exit=True) | ||
# | ||
# This lets the user play with the Form. | ||
F.edit() | ||
return F.get_widget('TextLine').value | ||
|
||
|
||
if __name__ == "__main__": | ||
App = TestApp() | ||
print App.run() | ||
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
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