Python npyscreen.TitleText() Examples

The following are 30 code examples of npyscreen.TitleText(). 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 vote down vote up
def create(self):
        self.editw = 2
        self.add(npyscreen.FixedText, value=make_title(msg.ask_wrends_install), editable=False)

        self.ask_wrends = self.add(npyscreen.SelectOne, max_height=3, 
                values = msg.wrends_install_options, scroll_exit=True)
        self.ask_wrends.value_changed_callback = self.wrends_option_changed
        self.wrends_password = self.add(npyscreen.TitleText, name=msg.password_label)
        self.wrends_hosts = self.add(npyscreen.TitleText, name=msg.hosts_label)
        self.wrends_option_changed(self.ask_wrends)

        self.add(npyscreen.FixedText, value=make_title(msg.ask_cb_install), rely=10, editable=False)

        self.ask_cb = self.add(npyscreen.SelectOne, max_height=3,
                values = msg.cb_install_options, scroll_exit=True)
        self.ask_cb.value_changed_callback = self.cb_option_changed
        self.cb_admin = self.add(npyscreen.TitleText, name=msg.username_label)
        self.cb_password = self.add(npyscreen.TitleText, name=msg.password_label)
        self.cb_hosts = self.add(npyscreen.TitleText, name=msg.hosts_label)
        self.cb_option_changed(self.ask_cb) 
Example #2
Source File: filebeat_interface_config.py    From dynamite-nsm with GNU General Public License v3.0 6 votes vote down vote up
def create(self):
        is_kafka_enabled = self.parentApp.filebeat_config.is_kafka_output_enabled()
        self.agent_tag = self.add(npyscreen.TitleText, name="Agent Tag")
        self.nextrely += 2
        self.add(npyscreen.TitleText, name="Toggle between LogStash and Kafka output modes.", editable=False)
        self.add_widget(OpenToggleTypeFormButton, name='[Toggle Between Output Modes]', relx=0)
        self.nextrely += 2
        ls_target_names = self.parentApp.filebeat_config.get_logstash_target_hosts()
        ls_target_names = list(set(ls_target_names))
        ls_target_names.append('<create new target>')

        kf_target_names = self.parentApp.filebeat_config.get_kafka_target_hosts()
        kf_target_names = list(set(kf_target_names))
        kf_target_names.append('<create new target>')
        if not is_kafka_enabled:
            self.add(npyscreen.TitleText, name='LogStash Targets', editable=False)
            self.add(TargetMultiSelect, values=ls_target_names, max_height=5)
        else:
            self.add(npyscreen.TitleText, name='Kafka Targets', editable=False)
            self.add(TargetMultiSelect, values=kf_target_names, max_height=5) 
Example #3
Source File: tutorials.py    From vent with Apache License 2.0 6 votes vote down vote up
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 #4
Source File: console.py    From PRET with GNU General Public License v2.0 6 votes vote down vote up
def create(self):
        self.name = 'Dictionary Browser \xe2\x94\x80\xe2\x94\x80 (Press F1 for help)'
        self.add_handlers({curses.KEY_F1: self.usage,
         ord('/'): self.search,
         ord('f'): self.filter,
         ord('r'): self.reset,
         ord('q'): self.quit})
        self.items = self.add(npyscreen.TitleText, name='Items total', value='0', editable=False)
        self.add(npyscreen.TitleText, name='PS version', value='3010', editable=False)
        self.search_btn = self.add(SearchButton, relx=33, rely=2, name='Search')
        self.search_text = self.add(npyscreen.FixedText, relx=53, rely=2, editable=False)
        self.filter_btn = self.add(FilterButton, relx=33, rely=3, name='Filter')
        self.filter_text = self.add(npyscreen.FixedText, relx=53, rely=3, editable=False)
        self.dict = self.add(Dict, name='Dictionary', scroll_exit=True, max_width=43, relx=2, rely=5, max_height=-2)
        self.perms = self.add(Perms, name='Permissions', scroll_exit=True, rely=5, relx=46, max_height=6)
        self.value = self.add(Value, name='Edit Value', scroll_exit=True, rely=11, relx=46, max_height=-2)
        self.status = self.add(npyscreen.TitleText, name='Status', editable=False, value='Connected to laserjet.lan', rely=-3)
        self.save = self.add(npyscreen.ButtonPress, name='Save Changes', rely=-3, relx=-27)
        self.exit = self.add(npyscreen.ButtonPress, name='Exit', rely=-3, relx=-12)
        self.save.whenPressed = self.commit
        self.exit.whenPressed = self.quit
        self.update_dict() 
Example #5
Source File: console.py    From PRET with GNU General Public License v2.0 6 votes vote down vote up
def search(self, *args):
        self.dict._contained_widget.h_set_filter
        self.dict.entry_widget.h_set_filter
        window = SearchDropdown(name='by key/value')
        self.searchline = window.add(npyscreen.TitleText, name='Keyword:', value=self.search_text.value)
        window.nextrely += 1
        self.statusline = window.add(npyscreen.Textfield, color='LABEL', editable=False)
        window.adjust_widgets = self.adjust_widgets1
        window.display()
        self.searchline.edit()
        self.dict.entry_widget._remake_filter_cache()
        self.dict.entry_widget.jump_to_first_filtered()
        self.search_btn.h_exit_down(ord('a'))
        self.filter_btn.h_exit_down(ord('a'))
        self.search_text.value = self.searchline.value
        self.search_text.update() 
Example #6
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 6 votes vote down vote up
def create(self):
        if self.class_num > 1:
            self.add(npyscreen.FixedText, editable=False,
                     value="Current Classes: {}".format(
                         self.parentApp.character.name))
        if self.class_num == 1:
            t = 'Primary Class:'
        else:
            t = 'Class #{:d}:'.format(self.class_num)
        for c in self.parentApp.character.class_list:
            self.class_options.remove(c.name)
        if self.class_num == 1:
            self.multiclass = self.add(npyscreen.Checkbox, name="Add Multiclass?".format(self.class_num + 1), value=False)
        else:
            self.multiclass = self.add(npyscreen.Checkbox, name="Add Class #{:d}?".format(self.class_num + 1), value=False)
        self.level = self.add(
            npyscreen.TitleText, name='Level:', value="1", use_two_lines=False)
        self.character_class = self.add(
            npyscreen.TitleSelectOne, name=t, values=tuple(self.class_options)) 
Example #7
Source File: zeek_node_config.py    From dynamite-nsm with GNU General Public License v3.0 6 votes vote down vote up
def create(self):
        workers = self.parentApp.zeek_config.list_workers()
        loggers = self.parentApp.zeek_config.list_loggers()
        proxies = self.parentApp.zeek_config.list_proxies()
        manager = [self.parentApp.zeek_config.get_manager()]
        if not any(manager):
            manager = []
        workers.append('<create new worker>')
        loggers.append('<create new logger>')
        proxies.append('<create new proxy>')
        self.add(npyscreen.TitleText, name='Workers', editable=False)
        self.add(WorkerSelect, values=workers, max_height=5)

        self.add(npyscreen.TitleText, name='Loggers', editable=False)
        self.add(LoggerSelect, values=loggers, max_height=5)
        self.add(npyscreen.TitleText, name='Proxies', editable=False)
        self.add(ProxySelect, values=proxies, max_height=5)
        self.add(npyscreen.TitleText, name='Manager', editable=False, max_height=3)
        self.add(ManagerSelect, values=manager) 
Example #8
Source File: menu.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def create(self):
        """Add."""
        self.mount = self.add(npyscreen.TitleText, name="Mountpoint")
        self.disk = self.add(npyscreen.TitleSelectOne, name="Disk", scroll_exit=True)

    # pylint: disable=invalid-name 
Example #9
Source File: setup_terminal.py    From autopilot with Mozilla Public License 2.0 5 votes vote down vote up
def create(self):
        self.input = odict({
            'BASEDIR': self.add(nps.TitleText, name="Base Directory:", value="/usr/autopilot"),
            'MSGPORT': self.add(nps.TitleText, name="Message Port - Our router port:", value="5560"),
        })
        #self.inName = self.add(nps.)


    # after we're done editing, close the input program 
Example #10
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.name = self.add(
            npyscreen.TitleText, name="Character Name:", use_two_lines=False)
        self.player_name = self.add(
            npyscreen.TitleText, name="Player Name:", use_two_lines=False) 
Example #11
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 5 votes vote down vote up
def prep(self):
        attrs = ('strength', 'dexterity', 'constitution',
                 'intelligence', 'wisdom', 'charisma')
        self.class_text = self.add(npyscreen.FixedText, editable=False,
                                  value="Key stats for your primary class {:s} are listed with **".format(self.parentApp.character.primary_class.name))
        self.race_text = self.add(npyscreen.FixedText, editable=False,
                                  value="Do not add racial bonuses, they will be added for you as listed.")
        for attr in attrs:
            if attr in self.parentApp.character.primary_class.primary_abilities:
                name = '**' + attr
            else:
                name = '' + attr
            race_bonus = getattr(self.parentApp.character.race,
                                 f'{attr}_bonus')
            if race_bonus != 0:
                name += '({:+d})'.format(race_bonus)
            name += ':'
            new_fld = self.add(npyscreen.TitleText,
                               name=name,
                               begin_entry_at=24, value='10')
            setattr(self, attr, new_fld)
        self.hp_roll_text = self.add(npyscreen.FixedText, editable=False,
                                     value="")
        self.hp_reroll_buttom = self.add(npyscreen.MiniButtonPress,
                                         name="Reroll Max HP",
                                         when_pressed_function=self.reroll_hp)
        self.hp_max = self.add(npyscreen.TitleText, name="Max HP:")
        self.parentApp.update_max_hp_roll()
        self.parentApp.set_default_hp_max() 
Example #12
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.bg_skills = self.add(
            npyscreen.TitleText, name="Background:",
            value="", editable=False)
        self.race_skills = self.add(
            npyscreen.TitleText, name="Racial:",
            value="", editable=False)
        self.remaining = self.add(
            npyscreen.TitleText, name="Remaining:",
            value=0, editable=False)
        self.skill_proficiencies = self.add(
            npyscreen.TitleMultiSelect, name="Skill Proficiencies:",
            values=(),
            value_changed_callback=self.update_remaining) 
Example #13
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.instructions = self.add(
            npyscreen.FixedText, editable=False,
            value=("Please select your weapons."))
        self.remaining = self.add(
            npyscreen.TitleText, name="Remaining:",
            value=3, editable=False)
        self.weapons = self.add(
            npyscreen.TitleMultiSelect, name="Weapons:",
            values=tuple([wpn.name for wpn in all_weapons]),
            value_changed_callback=self.update_remaining) 
Example #14
Source File: create_character.py    From dungeon-sheets with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.instructions = self.add(
            npyscreen.FixedText, editable=False,
            value=("Your character will be saved in the file given below. "
                   "After saving, edit this file to finish your personality, "
                   "weapons, etc."))
        self.filename = self.add(
            npyscreen.TitleText, name='Filename:')
        self.make_pdf = self.add(npyscreen.Checkbox, name="Create PDF:",
                                 value=True) 
Example #15
Source File: menu.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def create(self):
        """Create method is called by the Form constructor.

        It does nothing by default - it is there for you to override in subclasses,
        but it is the best place to set up all the widgets on a Form. Expect this
        method to be full of self.add(...) method calls, then!
        """
        self.name = "Host configuration:"
        self.hostname = self.add(npyscreen.TitleText, name="Hostname")

    # pylint: disable=invalid-name 
Example #16
Source File: setup_pilot.py    From autopilot with Mozilla Public License 2.0 5 votes vote down vote up
def create(self):
        self.input = odict({
            'NAME': self.add(nps.TitleText, name="Pilot Name:", value=""),
            'BASEDIR': self.add(nps.TitleText, name="Base Directory:", value="/usr/autopilot"),
            'LINEAGE': self.add(nps.TitleText, name="Are we a parent or a child?", value=""),
            'CONFIG': self.add(nps.TitleSelectOne,max_height=4,value=[0,], name="Configuration:",
                                   values=["AUDIO", "VISUAL", "NONE"], scroll_exit=True),
            'CHILDID': self.add(nps.TitleText, name="Child ID:", value=""),
            'PARENTID': self.add(nps.TitleText, name="Parent ID:", value=""),
            'PARENTIP': self.add(nps.TitleText, name="Parent IP:", value=""),
            'PARENTPORT': self.add(nps.TitleText, name="Parent Port:", value=""),
            'PUSHPORT': self.add(nps.TitleText, name="Push Port - Router port used by the Terminal:", value="5560"),
            'MSGPORT': self.add(nps.TitleText, name="Message Port - Our router port:", value="5565"),
            'TERMINALIP': self.add(nps.TitleText, name="Terminal IP:", value="192.168.0.100"),
            'AUDIOSERVER':self.add(nps.TitleSelectOne,max_height=4,value=[0,], name="Audio Server:",
                                   values=["jack", "pyo", "none"], scroll_exit=True),
            'NCHANNELS':self.add(nps.TitleText, name="N Audio Channels", value="1"),
            'OUTCHANNELS': self.add(nps.TitleText, name="List of output ports for jack audioserver to connect to", value="[1]"),
            'FS': self.add(nps.TitleText, name="Audio Sampling Rate", value="192000"),
            'JACKDSTRING': self.add(nps.TitleText, name="Command used to launch jackd - note that \'fs\' will be replaced with above FS",
                                    value="jackd -P75 -p16 -t2000 -dalsa -dhw:sndrpihifiberry -P -rfs -n3 -s &"),
            'PIGPIOMASK': self.add(nps.TitleText, name="Binary mask to enable pigpio to access pins according to the BCM numbering",
                                    value="1111110000111111111111110000")


        })
        #self.inName = self.add(nps.)


    # after we're done editing, close the input program 
Example #17
Source File: stdfmemail.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def create(self):
        self.m1 = self.add_menu(name="Read Email")
        self.m1.addItemsFromList([
            ('View Short Headers',              self.viewShortHeaders),
            ('View Full Headers',               self.viewAllHeaders),
            ('View Message Tree',              self.viewMessageTree),
            ('Save this Message Part',          self.saveMessagePart),
            ('View Message Source',             self.viewMessageSource),
        ])
        self.nextrely = 1
        self.wSubject = self.add(npyscreen.TitleText, begin_entry_at=10, editable=False, 
                                        use_two_lines=False, name = "Subject:")
        self.wFrom    = self.add(npyscreen.TitleText, begin_entry_at=10, 
                                        editable=False, name = "From:", ) #max_width=-8)
        self.wDate    = self.add(npyscreen.TitleText, begin_entry_at=10, 
                                        editable=False, name = "Date:")
        
        self.draw_line_at   = self.nextrely
        self.nextrely      += 1
        _body_rely          = self.nextrely        
        self.wEmailBody     = self.add(EmailPager, max_height=-1, scroll_exit=True, hidden=True)
        self.nextrely       = _body_rely
        self.wMessageTree   = self.add(EmailTree, max_height=-1, scroll_exit=True, hidden=False)
        self.nextrely      += 1
        self.wStatusLine    = self.add(npyscreen.FixedText, 
            editable=False, 
            use_max_space=True, 
            color='STANDOUT', 
            value="Status Line-Status Line-Status Line-Status Line-Status Line-Status Line-Status Line-") 
Example #18
Source File: GUI.py    From ptop with MIT License 5 votes vote down vote up
def create(self,**kwargs):
        ''' 
            Sub widgets [details_box_heading,details_box] are only shown in GUI if
            they are created in the create() method
        '''
        super(ProcessDetailsInfoBox,self).create()
        
        self._logger = logging.getLogger(__name__)
        self._logger.info("Showing the local ports {0} and files opened and are being used by the process with pid {1}".format(self._local_ports,
                                                                                         str(self._process_pid)))
        #logger.info("Showing the local ports {0} and files opened and are being used by the process with pid {1}".format(self._local_ports,str(self._process_pid)))
                        #             self.details_box_heading = self.add(npyscreen.TitleText, name='No ports used by the process {0}'.format(str(self._process_pid)),)
        self.details_box_heading = self.add(npyscreen.TitleText, name='Showing info for process with PID {0}'.format(str(self._process_pid)))
        self.details_box = self.add(npyscreen.BufferPager)
        if len(self._local_ports) != 0 and len(self._open_files)!= 0:
            self.details_box.values.extend(['System ports used by the process are:\n'])
            self.details_box.values.extend(self._local_ports)
            self.details_box.values.extend('\n')
            self.details_box.values.extend(['Files opened by this process are:\n'])
            self.details_box.values.extend('\n')
            self.details_box.values.extend(self._open_files)
        elif len(self._open_files) != 0:
            self.details_box.values.extend(['Files opened by this process are:\n'])
            self.details_box.values.extend(self._open_files)
            self.details_box.values.extend('\n')
            self.details_box.values.extend(['The process is not using any System ports.\n'])
        elif len(self._local_ports) != 0:
            self.details_box.values.extend(['System ports used by the process are:\n'])
            self.details_box.values.extend(self._local_ports)
            self.details_box.values.extend('\n')
            self.details_box.values.extend(['No files are opened by this process.\n'])
        else:
            self.details_box.values.extend(['No system ports are used and no files are opened by this process.\n'])
        self.details_box.display() 
Example #19
Source File: GUI.py    From ptop with MIT License 5 votes vote down vote up
def create(self):
        super(ProcessFilterInputBox, self).create()
        self.filterbox = self.add(npyscreen.TitleText, name='Filter String:', )
        self.nextrely += 1
        self.statusline = self.add(npyscreen.Textfield, color = 'LABEL', editable = False) 
Example #20
Source File: search.py    From pi_romulus with GNU General Public License v2.0 5 votes vote down vote up
def create(self):
        """
        Creates form upon initialization by main app.
        """
        self.rom = self.add(npyscreen.TitleText, name='Game: ') 
Example #21
Source File: setup_pilot.py    From autopilot with Mozilla Public License 2.0 5 votes vote down vote up
def create(self):
        self.input = odict({
            'PINS':{
                'POKES':{
                    'L':self.add(nps.TitleText, name="PINS - POKES - L", value="24"),
                    'C': self.add(nps.TitleText, name="PINS - POKES - C", value="8"),
                    'R': self.add(nps.TitleText, name="PINS - POKES - R", value="10"),
                },
                'LEDS': {
                    'L': self.add(nps.TitleText, name="PINS - LEDS - L", value="[11, 13, 15]"),
                    'C': self.add(nps.TitleText, name="PINS - LEDS - C", value="[22, 18, 16]"),
                    'R': self.add(nps.TitleText, name="PINS - LEDS - R", value="[19, 21, 23]"),
                },
                'PORTS': {
                    'L': self.add(nps.TitleText, name="PINS - PORTS - L", value="31"),
                    'C': self.add(nps.TitleText, name="PINS - PORTS - C", value="33"),
                    'R': self.add(nps.TitleText, name="PINS - PORTS - R", value="37"),
                },
                'FLAGS': {
                    'L': self.add(nps.TitleText, name="PINS - FLAGS - L", value=""),
                    'R': self.add(nps.TitleText, name="PINS - FLAGS - R", value="")
                }},
            'PULLUPS': self.add(nps.TitleText, name="Pins to pull up on boot",
                                value="[7]"),
            'PULLDOWNS': self.add(nps.TitleText, name="Pins to pull down on boot",
                                  value="[]")
        })
        #self.inName = self.add(nps.)


    # after we're done editing, close the input program 
Example #22
Source File: gui.py    From Doga with MIT License 5 votes vote down vote up
def main(self):
        """ 'main' function of npyscreen.NPSApp application object
        this function help in initial widget setup and rendering
        """

        # time(ms) to wait for user interactions
        self.keypress_timeout_default = 10

        # Form widget instance
        self.window = WindowForm(parentApp=self, name="Doga : HTTP Log Monitor",)
        
        # setup a section for Alert status
        self.alert_status = self.window.add(npyscreen.TitleText, name="Alert Status", max_height=3)
        self.alert_status.value = ""
        self.alert_status.editable = False

        # setup a section for Doga status
        self.doga_status = self.window.add(npyscreen.TitleText, name="Doga Status", max_height=3, rely=4)
        self.doga_status.value = ""
        self.doga_status.editable = False

        # setup a section for Doga logs
        self.doga_logs = self.window.add(npyscreen.BoxTitle, name="Doga Logs", max_width=50, relx=2, rely=7)
        self.doga_logs.entry_widget.scroll_exit = True
        self.doga_logs.values = []

        # setup a section for Alert history
        self.alert_history = self.window.add(npyscreen.BoxTitle, name="Alert History", max_width=75, relx=52, rely=7)
        self.alert_history.entry_widget.scroll_exit = True
        self.alert_history.values = []

        # update parent widget by embedding sub-widgets
        self.window.edit() 
Example #23
Source File: add_options.py    From vent with Apache License 2.0 5 votes vote down vote up
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 #24
Source File: choose_tools.py    From vent with Apache License 2.0 5 votes vote down vote up
def create(self):
        """ Update with current tools for each branch at the version chosen """
        self.add_handlers({'^Q': self.quit})
        self.add(npyscreen.TitleText,
                 name='Select which tools to add from each branch selected:',
                 editable=False)
        self.add(npyscreen.Textfield,
                 value='NOTE tools you have already installed will be ignored',
                 color='STANDOUT',
                 editable=False)

        i = 6
        for branch in self.parentApp.repo_value['versions']:
            self.tools_tc[branch] = {}
            self.add(npyscreen.TitleText,
                     name='Branch: ' + branch,
                     editable=False,
                     rely=i,
                     relx=5,
                     max_width=25)
            tools = self.repo_tools(branch)
            i += 1
            for tool in tools:
                value = True
                if tool.startswith('/dev'):
                    value = False
                # tool in base directory
                if tool == '' or tool.startswith(':'):
                    tool = '/' + tool
                self.tools_tc[branch][tool] = self.add(npyscreen.CheckBox,
                                                       name=tool,
                                                       value=value,
                                                       relx=10)
                i += 1
            i += 2 
Example #25
Source File: avatar2_installer.py    From avatar2 with Apache License 2.0 5 votes vote down vote up
def create(self):
        self.target_name = self.parentApp.current_target
        self.name = self.target_name + ' git installer'

    
        self.form = self.add(nps.TitleText, name=VERIFY_GIT_INSTALL,
                             autowrap=True, editable=False)

        self.install_dir = self.parentApp.config.get(
            'DIST', 'default_install_path') + self.target_name

        self.git_path = self.add(nps.TitleText, name='Remote Repository',
                                value=TARGETS[self.target_name]['git'],
                                begin_entry_at=25)

        self.git_branch = self.add(nps.TitleText, name='Remote Branch',
                                   value='master', begin_entry_at=25)

        self.install_dir = self.add(nps.TitleFilename,
                                    name='Local directory',
                                    value=self.install_dir,
                                    begin_entry_at=25)
        
        conf = TARGETS[self.target_name].get('configure')
        self.configure_options = self.add(
             nps.TitleText, name='Configure options', begin_entry_at=25,
             value=conf, hidden=False if conf is not None else True
        )

        make = TARGETS[self.target_name].get('make')
        self.make_options= self.add(
            nps.TitleText, name='Make options', begin_entry_at=25,
            value=make, hidden=False if make is not None else True
        )
           

        options = [MENTRY_BUILD, MENTRY_CANCEL]
        self.opt_form = self.add(nps.TitleSelectOne,
                                 name='What do you want to do?',
                                 values=options, value =[0,],
                                 scroll_on_exit=True) 
Example #26
Source File: suricata_rule_config.py    From dynamite-nsm with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.add(npyscreen.TitleText, name='Pick your Suricata Rules',
                 value='Suricata rules provide signature based detection and alerting.',
                 color='LABELBOLD',
                 editable=False
                )
        enabled_rules = self.parentApp.suricata_rule_config.list_enabled_rules()
        disabled_rules = self.parentApp.suricata_rule_config.list_disabled_rules()
        combined_rules = list(enabled_rules)
        combined_rules.extend(disabled_rules)
        error = 0
        for i, rule in enumerate(sorted(combined_rules)):
            try:
                if i == 0:
                    self.rendered_rules.append(
                        self.add(npyscreen.RoundCheckBox, name=rule, value=rule in enabled_rules, rely=5,
                                 relx=2 + (70 * error))
                    )
                else:
                    self.rendered_rules.append(
                        self.add(npyscreen.RoundCheckBox, name=rule, value=rule in enabled_rules,
                                 relx=2 + (70 * error))
                    )
            except npyscreen.wgwidget.NotEnoughSpaceForWidget:
                error += 1
                self.rendered_rules.append(
                    self.add(npyscreen.RoundCheckBox, name=rule, value=rule in enabled_rules, rely=5,
                             relx=2 + (70 * error))
                ) 
Example #27
Source File: zeek_node_config.py    From dynamite-nsm with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.message = self.add(npyscreen.TitleText, color='LABELBOLD', name='Description', editable=False, wrap=True)

        self.component_name_text = self.add(npyscreen.TitleText, name='Component Name', rely=4)
        self.host_text = self.add(npyscreen.TitleText, name='Host') 
Example #28
Source File: zeek_node_config.py    From dynamite-nsm with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.message = self.add(npyscreen.TitleText,
                                name='Description',
                                value='Zeek workers analyze network traffic on a given interface.',
                                color='LABELBOLD',
                                editable=False)
        self.worker_name_text = self.add(npyscreen.TitleText, name='Worker Name', editable=True, rely=4)
        self.net_interface_text = self.add(npyscreen.TitleText, name='Network Interface')
        self.host_text = self.add(npyscreen.TitleText, name='Host')
        self.threads_text = self.add(npyscreen.TitleText, name='Worker Threads')
        self.cpus_text = self.add(npyscreen.TitleText, name='CPU Affinity')
        self.delete_button = self.add_widget(RemoveWorkerButton, name='Delete Worker', rely=13, color='DANGER') 
Example #29
Source File: suricata_interface_config.py    From dynamite-nsm with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        interface_names = list(set([interface_config['interface']
                                    for interface_config in self.parentApp.suricata_config.af_packet_interfaces]))
        interface_names.append('<create new interface>')

        self.add(npyscreen.TitleText, name='Network Interfaces', editable=False)
        self.add(NetworkInterfaceSelect, values=interface_names, max_height=5) 
Example #30
Source File: zeek_script_config.py    From dynamite-nsm with GNU General Public License v3.0 5 votes vote down vote up
def create(self):
        self.add(npyscreen.TitleText, name='Pick your Zeek Scripts',
                 value='Zeek scripts can generate real-time alerts, infer connection information, '
                       'provide highlevel application summaries, and even extract files.',
                 color='LABELBOLD',
                 editable=False
                )
        enabled_scripts = self.parentApp.zeek_script_config.list_enabled_scripts()
        disabled_scripts = self.parentApp.zeek_script_config.list_disabled_scripts()
        combined_scripts = list(enabled_scripts)
        combined_scripts.extend(disabled_scripts)
        error = 0
        for i, script in enumerate(sorted(combined_scripts)):
            try:
                if i == 0:
                    self.rendered_scripts.append(
                        self.add(npyscreen.RoundCheckBox, name=script, value=script in enabled_scripts, rely=5,
                                 relx=2 + (70 * error))
                    )
                else:
                    self.rendered_scripts.append(
                        self.add(npyscreen.RoundCheckBox, name=script, value=script in enabled_scripts,
                                 relx=2 + (70 * error))
                    )
            except npyscreen.wgwidget.NotEnoughSpaceForWidget:
                error += 1
                self.rendered_scripts.append(
                    self.add(npyscreen.RoundCheckBox, name=script, value=script in enabled_scripts, rely=5,
                             relx=2 + (70 * error))
                )