Python npyscreen.MultiLineEdit() Examples
The following are 6
code examples of npyscreen.MultiLineEdit().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
npyscreen
, or try the search function
.
Example #1
Source File: tui.py From community-edition-setup with MIT License | 6 votes |
def beforeEditing(self): self.parentApp.my_counter = 0 self.add_handlers({curses.KEY_F1: self.display_help}) self.add(npyscreen.MultiLineEdit, value='=' * (self.columns - 4), max_height=1, rely=self.lines-4, editable=False) self.marketing_label = self.add(npyscreen.MultiLineEdit, value='', max_height=1, rely=self.lines-3, editable=False) form_name = getClassName(self) if form_name != 'InstallStepsForm': next_x = 20 if form_name == 'MAIN' else 28 self.button_next = self.add(npyscreen.ButtonPress, name="Next", when_pressed_function=self.nextButtonPressed, rely=self.lines-5, relx=self.columns - next_x) if next_x == 28: self.button_back = self.add(npyscreen.ButtonPress, name="Back", when_pressed_function=self.backButtonPressed, rely=self.lines-5, relx=self.columns - 20) self.button_quit = self.add(npyscreen.ButtonPress, name="Quit", when_pressed_function=self.quitButtonPressed, rely=self.lines-5, relx=self.columns - 12) if hasattr(self, 'do_beforeEditing'): self.do_beforeEditing()
Example #2
Source File: tutorials.py From vent with Apache License 2.0 | 6 votes |
def create(self): """ Overridden to add handlers and content """ self.add_handlers({'^Q': self.quit}) self.add(npyscreen.TitleText, name=self.title, editable=False) self.add(npyscreen.MultiLineEdit, editable=False, value=self.text, max_width=75, slow_scroll=True) self.m2 = self.add_menu(name='About Vent', shortcut='v') self.m2.addItem(text='Background', onSelect=self.switch, arguments=['TUTORIALBACKGROUND'], shortcut='b') self.m2.addItem(text='Terminology', onSelect=self.switch, arguments=['TUTORIALTERMINOLOGY'], shortcut='t') self.m2.addItem(text='Getting Setup', onSelect=self.switch, arguments=['TUTORIALGETTINGSETUP'], shortcut='s') self.m3 = self.add_menu(name='Working with Cores', shortcut='c') self.m3.addItem(text='Starting Cores', onSelect=self.switch, arguments=['TUTORIALSTARTINGCORES'], shortcut='c') self.m4 = self.add_menu(name='Working with Plugins', shortcut='p') self.m4.addItem(text='Adding Plugins', onSelect=self.switch, arguments=['TUTORIALADDINGPLUGINS'], shortcut='a') self.m5 = self.add_menu(name='Files', shortcut='f') self.m5.addItem(text='Adding Files', onSelect=self.switch, arguments=['TUTORIALADDINGFILES'], shortcut='a') self.m6 = self.add_menu(name='Help', shortcut='s') self.m6.addItem(text='Basic Troubleshooting', onSelect=self.switch, arguments=['TUTORIALTROUBLESHOOTING'], shortcut='t')
Example #3
Source File: tui.py From community-edition-setup with MIT License | 5 votes |
def create(self): desc_wrap = textwrap.wrap(msg.decription, self.columns - 6) self.description_label = self.add(npyscreen.MultiLineEdit, value='\n'.join(desc_wrap), max_height=6, rely=2, editable=False) self.description_label.autowrap = True self.os_type = self.add(npyscreen.TitleFixedText, name=msg.os_type_label, begin_entry_at=18, value=msg.os_type + ' ' + msg.os_version, editable=False) self.init_type = self.add(npyscreen.TitleFixedText, name=msg.init_type_label, begin_entry_at=18, value=msg.os_initdaemon, editable=False) self.httpd_type = self.add(npyscreen.TitleFixedText, name=msg.httpd_type_label, begin_entry_at=18, value=msg.apache_version, field_width=40, editable=False) self.license_confirm = self.add(npyscreen.Checkbox, scroll_exit=True, name=msg.acknowledge_lisence) self.warning_text = self.add(npyscreen.MultiLineEdit, value=msg.setup_properties_warning, max_height=4, editable=False) for sys_req in ('file_max', 'mem_size', 'number_of_cpu', 'free_disk_space'): cur_val = getattr(msg, 'current_' + sys_req) req_val = getattr(msg, 'suggested_' + sys_req) if cur_val < req_val: warning_text = getattr(msg, 'insufficient_' + sys_req).format(cur_val, req_val) if sys_req == 'file_max': self.parentApp.exit_reason = warning_text self.parentApp.onCleanExit() time.sleep(3.5) sys.exit(False) warning_text += '. Do you want to continue?' result = npyscreen.notify_yes_no(warning_text, title="Warning") if not result: self.parentApp.exit_reason = msg.not_to_continue self.parentApp.onCleanExit() sys.exit(False)
Example #4
Source File: add_options.py From vent with Apache License 2.0 | 5 votes |
def create(self): """ Update with current branches and commits """ self.add_handlers({'^Q': self.quit}) self.add(npyscreen.TitleText, name='Branches:', editable=False) if not self.branches or not self.commits: repo_vals = self.repo_values() i = 3 # check if repo_values returned successfully if (isinstance(repo_vals[0], list) and isinstance(repo_vals[1], dict)): self.branches, self.commits = repo_vals for branch in self.branches: self.branch_cb[branch] = self.add(npyscreen.CheckBox, name=branch, rely=i, relx=5, max_width=25) self.commit_tc[branch] = self.add(npyscreen.TitleCombo, value=0, rely=i+1, relx=10, max_width=30, name='Commit:', values=self.commits[branch]) i += 3 else: self.error = self.add(npyscreen.MultiLineEdit, name='Errors', editable=False, labelColor='DANGER', rely=i, relx=5, color='DANGER', value=""" Errors were found... """ + str(repo_vals[1]) + """ Please confirm the repo url and credentials are valid! Vent will return to the main screen. """) self.error.display()
Example #5
Source File: editor.py From vent with Apache License 2.0 | 5 votes |
def create(self): """ Create multi-line widget for editing """ # add various pointers to those editing vent_cfg if self.vent_cfg: self.add(npyscreen.Textfield, value='# when configuring external' ' services make sure to do so', editable=False) self.add(npyscreen.Textfield, value='# in the form of Service = {"setting": "value"}', editable=False) self.add(npyscreen.Textfield, value='# make sure to capitalize your service correctly' ' (i.e. Elasticsearch vs. elasticsearch)', editable=False) self.add(npyscreen.Textfield, value='# and make sure to enclose all dict keys and' ' values in double quotes ("")', editable=False) self.add(npyscreen.Textfield, value='', editable=False) elif self.instance_cfg: self.add(npyscreen.Textfield, value='# these settings will be used' ' to configure the new instances', editable=False) self.edit_space = self.add(npyscreen.MultiLineEdit, value=self.config_val)
Example #6
Source File: help.py From vent with Apache License 2.0 | 4 votes |
def create(self): """ Override method for creating FormBaseNew form """ self.add_handlers({'^T': self.change_forms, '^Q': self.exit}) self.addfield = self.add(npyscreen.TitleFixedText, name='Vent', labelColor='DEFAULT', editable=False) self.multifield1 = self.add(npyscreen.MultiLineEdit, editable=False, value=""" About Vent Vent is a library that includes a CLI designed to serve as a general platform for analyzing network traffic. Built with some basic functionality, Vent serves as a user-friendly platform to build custom plugins on to perform user-defined processing on incoming network data. Vent supports any filetype, but only processes ones based on the types of plugins installed for that instance of Vent. Simply create your plugins, point vent to them & install them, and drop a file in vent to begin processing! For a detailed explanation of Vent Concepts, check out the General section in our Help Menu. Topics include: Vent Plugins, Tools, Filetypes, and Statuses! Use ^X to access the menu and ESC to close it. Select CANCEL or ^Q to return to the Main Menu. Select OK or ^T to return to your previous menu. PRO TIP: You can use TAB to cycle through options. """) self.m2 = self.add_menu(name='Vent Basics', shortcut='b') self.m2.addItem(text='Menu Interactions', onSelect=HelpForm.switch, arguments=['Menu'], shortcut='m') self.m2.addItem(text='Plugins', onSelect=HelpForm.switch, arguments=['Plugins'], shortcut='p') self.m2.addItem(text='Tools', onSelect=HelpForm.switch, arguments=['Tools'], shortcut='t') self.m2.addItem(text='Filetypes', onSelect=HelpForm.switch, arguments=['Filetypes'], shortcut='f') self.m2.addItem(text='Statuses', onSelect=HelpForm.switch, arguments=['Status'], shortcut='s') self.m3 = self.add_menu(name='Working with Plugins', shortcut='p') self.m3.addItem(text='Adding a Plugin', onSelect=HelpForm.switch, arguments=['Plugin Adding'], shortcut='a') self.m3.addItem(text='Building a Plugin', onSelect=HelpForm.switch, arguments=['Plugin Building'], shortcut='b')