本文整理汇总了Python中zenmapCore.UmitConf.CommandProfile.add_profile方法的典型用法代码示例。如果您正苦于以下问题:Python CommandProfile.add_profile方法的具体用法?Python CommandProfile.add_profile怎么用?Python CommandProfile.add_profile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapCore.UmitConf.CommandProfile
的用法示例。
在下文中一共展示了CommandProfile.add_profile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProfileEditor
# 需要导入模块: from zenmapCore.UmitConf import CommandProfile [as 别名]
# 或者: from zenmapCore.UmitConf.CommandProfile import add_profile [as 别名]
#.........这里部分代码省略.........
section = HIGSectionLabel(section_name)
vbox._pack_noexpand_nofill(section)
vbox._pack_noexpand_nofill(HIGSpacer(table))
vbox.set_border_width(5)
tab.fill_table(table, True)
else:
hbox = tab.get_hmain_box()
vbox.pack_start(hbox, True, True, 0)
self.notebook.append_page(vbox, gtk.Label(tab_name))
def save_profile(self, widget):
if self.overwrite:
self.profile.remove_profile(self.profile_name)
profile_name = self.profile_name_entry.get_text()
if profile_name == '':
alert = HIGAlertDialog(
message_format=_('Unnamed profile'),
secondary_text=_(
'You must provide a name for this profile.'))
alert.run()
alert.destroy()
self.profile_name_entry.grab_focus()
return None
command = self.ops.render_string()
buf = self.profile_description_text.get_buffer()
description = buf.get_text(
buf.get_start_iter(), buf.get_end_iter())
try:
self.profile.add_profile(
profile_name,
command=command,
description=description)
except ValueError:
alert = HIGAlertDialog(
message_format=_('Disallowed profile name'),
secondary_text=_('Sorry, the name "%s" is not allowed due '
'to technical limitations. (The underlying '
'ConfigParser used to store profiles does not allow '
'it.) Choose a different name.' % profile_name))
alert.run()
alert.destroy()
return
self.scan_interface.toolbar.profile_entry.update()
self.destroy()
def clean_profile_info(self):
self.profile_name_entry.set_text('')
self.profile_description_text.get_buffer().set_text('')
def set_scan_interface(self, interface):
self.scan_interface = interface
def exit(self, *args):
self.destroy()
def delete_profile(self, widget=None, extra=None):
if self.deletable:
dialog = HIGDialog(buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
alert = HIGEntryLabel('<b>' + _("Deleting Profile") + '</b>')