本文整理汇总了Python中npyscreen.TitleSelectOne方法的典型用法代码示例。如果您正苦于以下问题:Python npyscreen.TitleSelectOne方法的具体用法?Python npyscreen.TitleSelectOne怎么用?Python npyscreen.TitleSelectOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类npyscreen
的用法示例。
在下文中一共展示了npyscreen.TitleSelectOne方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: switch_wifi_channel
# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import TitleSelectOne [as 别名]
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)
示例2: create
# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import TitleSelectOne [as 别名]
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
)
示例3: create
# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import TitleSelectOne [as 别名]
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))
示例4: create
# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import TitleSelectOne [as 别名]
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
示例5: create
# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import TitleSelectOne [as 别名]
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