Python npyscreen.TitleSelectOne() Examples

The following are 12 code examples of npyscreen.TitleSelectOne(). 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: wat.py    From raw-packet with MIT License 6 votes vote down vote up
def switch_wifi_channel(self, args):
        popup_columns: int = len(self.channel_one_select_name) + 25
        popup_lines: int = len(self.wifi_instance.available_wifi_channels) + 4
        if popup_lines > int(3 * self.y // 4):
            popup_lines = int(3 * self.y // 4)

        popup = npyscreen.Popup(name=self.channel_popup_name,
                                columns=popup_columns,
                                lines=popup_lines)
        channels = popup.add(npyscreen.TitleSelectOne, name=self.channel_one_select_name, scroll_exit=True,
                             values=self.wifi_instance.available_wifi_channels)
        popup.edit()
        if len(channels.get_selected_objects()) > 0:
            current_wifi_channel: int = channels.get_selected_objects()[0]
            self.wifi_channel = current_wifi_channel
            self.tm_instance.add_task(self.wifi_instance.set_wifi_channel, current_wifi_channel) 
Example #2
Source File: avatar2_installer.py    From avatar2 with Apache License 2.0 6 votes vote down vote up
def create(self):
        self.target_name = self.parentApp.current_target
        self.name = self.target_name + ' installer'
        options = []
        config = self.parentApp.config

        if TARGETS[self.target_name].get('git') is not None:
            options.append( MENTRY_GIT_INSTALL )

        if TARGETS[self.target_name].get('apt_name') is not None and \
           config.getboolean('DIST', 'has_apt') is True:
            options.append( MENTRY_APT_INSTALL )

        options.append( MENTRY_CHANGE_PATH )
        options.append( 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 #3
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 #4
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 #5
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 #6
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.race = self.add(
            npyscreen.TitleSelectOne, name="Race:", values=tuple(races.keys())) 
Example #7
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.subclass = self.add(
            npyscreen.TitleSelectOne, name="Subclass:",
            values=tuple(self.subclass_options)) 
Example #8
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.background = self.add(
            npyscreen.TitleSelectOne,
            name="Background:", values=tuple(backgrounds.keys())) 
Example #9
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.alignment = self.add(
            npyscreen.TitleSelectOne, name="Alignment:", values=self.alignments) 
Example #10
Source File: menu.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def create(self):
        """Add."""
        self.enabled = self.add(npyscreen.TitleSelectOne,
                                name=str_ljust("Enable Interface"),
                                max_height=3, scroll_exit=True,
                                begin_entry_at=25)
        self.interface = self.add(npyscreen.TitleSelectOne,
                                  name=str_ljust("Interface"),
                                  scroll_exit=True,
                                  begin_entry_at=25,
                                  editable=True)
        self.enabled.value_changed_callback = update_enabled_widget

    # pylint: disable=invalid-name 
Example #11
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 #12
Source File: menu.py    From EDCOP with Apache License 2.0 4 votes vote down vote up
def create(self):
        """Create method is called by the Form constructor."""
        self.begin_at = self.parentApp.begin_at
        self.bootproto = self.add(npyscreen.TitleSelectOne,
                                  name=str_ljust("Bootproto"),
                                  begin_entry_at=self.begin_at,
                                  max_height=3,
                                  scroll_exit=True)
        self.teaming = self.add(npyscreen.TitleSelectOne,
                                  name=str_ljust("NIC Teaming"),
                                  begin_entry_at=self.begin_at,
                                  max_height=3,
                                  scroll_exit=True)
        self.interface = self.add(npyscreen.TitleMultiSelect,
                                  name=str_ljust("Interface"),
                                  begin_entry_at=self.begin_at,
                                  #max_height=self.parentApp.calculate_menu_height,
                                  max_height=8,
                                  scroll_exit=True)
        self.ipaddress = self.add(npyscreen.TitleText,
                                  name=str_ljust("IP Address"),
                                  begin_entry_at=self.begin_at)
        self.netmask = self.add(npyscreen.TitleText,
                                name=str_ljust("Netmask"),
                                begin_entry_at=self.begin_at)
        self.dhcp_start = self.add(npyscreen.TitleText,
                                   name=str_ljust("DHCP start"),
                                   begin_entry_at=self.begin_at)
        self.dhcp_end = self.add(npyscreen.TitleText,
                                 name=str_ljust("DHCP end"),
                                 begin_entry_at=self.begin_at)
        self.dns1 = self.add(npyscreen.TitleText,
                             name=str_ljust("Primary DNS"),
                             begin_entry_at=self.begin_at)
        self.dns2 = self.add(npyscreen.TitleText,
                             name=str_ljust("Secondary DNS"),
                             begin_entry_at=self.begin_at)
        self.gateway = self.add(npyscreen.TitleText,
                                name=str_ljust("Gateway"),
                                begin_entry_at=self.begin_at)

        self.dhcp_start.hidden = True
        self.dhcp_end.hidden = True
        self.dns1.hidden = True
        self.dns2.hidden = True
        self.gateway.hidden = True
        self.bootproto.values = ['static', 'dhcp']
        self.teaming.values = ['yes', 'no']
        #self.bootproto.value = 0
        self.bootproto.value_changed_callback = update_bootproto_widget