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