Python npyscreen.TitleMultiSelect() Examples

The following are 6 code examples of npyscreen.TitleMultiSelect(). 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 5 votes vote down vote up
def create(self):

        self.wrends_storage = self.add(npyscreen.TitleMultiSelect, begin_entry_at=30, max_height=len(msg.storages), 
            values=msg.storages, name=msg.DBBackendForm_label, scroll_exit=True)

        self.add(npyscreen.FixedText, value=msg.unselected_storages, rely=len(msg.storages)+4, editable=False, color='STANDOUT') 
Example #2
Source File: avatar2_installer.py    From avatar2 with Apache License 2.0 5 votes vote down vote up
def create(self):
        self.exit_on_cancel = True
        self.opt_form = self.add(
            nps.TitleMultiSelect,
            name='Which Targets do you want to install/modify?',
            values=list(TARGETS.keys())) 
Example #3
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 #4
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 #5
Source File: wat.py    From raw-packet with MIT License 4 votes vote down vote up
def deauth(self, args):
        try:
            bssid = self.grid.selected_row()[1]
            assert bssid in self.wifi_instance.bssids.keys(), 'Could not find AP with BSSID: ' + bssid
            if len(self.wifi_instance.bssids[bssid]['clients']) > 0:
                clients_list: List[str] = self.make_client_list(self.wifi_instance.bssids[bssid]['clients'])

                popup_columns: int = len(max(clients_list, key=len)) + len(self.deauth_multi_select_name) + 22
                popup_lines: int = len(clients_list) + 4

                if popup_columns > int(3 * self.x // 4):
                    popup_columns = int(3 * self.x // 4)
                if popup_lines > int(3 * self.y // 4):
                    popup_lines = int(3 * self.y // 4)
                if popup_lines < 6:
                    popup_lines = 6

                popup = npyscreen.Popup(name=self.deauth_popup_name,
                                        columns=popup_columns,
                                        lines=popup_lines)
                deauth_clients = popup.add(npyscreen.TitleMultiSelect, name=self.deauth_multi_select_name,
                                           scroll_exit=True, values=clients_list)
                popup.edit()
                if len(deauth_clients.get_selected_objects()) > 0:
                    if self.wifi_channel != self.wifi_instance.bssids[bssid]['channel']:
                        self.wifi_channel = self.wifi_instance.bssids[bssid]['channel']
                        self.wifi_instance.set_wifi_channel(channel=self.wifi_instance.bssids[bssid]['channel'])
                    for client in deauth_clients.get_selected_objects():
                        self.tm_instance.add_task(self.wifi_instance.send_deauth, bssid, client[0:17], 50)
            else:
                npyscreen.notify_confirm('Not found clients for AP: ' + self.wifi_instance.bssids[bssid]['essid'] +
                                         ' (' + bssid + ')', title="Deauth Error")
                self.parentApp.switchFormPrevious()

        except AssertionError as Error:
            npyscreen.notify_confirm(Error.args[0], title="Assertion Error")
            self.parentApp.switchFormPrevious()

        except IndexError:
            pass

        except TypeError:
            pass 
Example #6
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