本文整理汇总了Python中core.data.options.option_list.OptionList.append方法的典型用法代码示例。如果您正苦于以下问题:Python OptionList.append方法的具体用法?Python OptionList.append怎么用?Python OptionList.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.data.options.option_list.OptionList
的用法示例。
在下文中一共展示了OptionList.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginConfig
# 需要导入模块: from core.data.options.option_list import OptionList [as 别名]
# 或者: from core.data.options.option_list.OptionList import append [as 别名]
class PluginConfig(object):
BOOL = 'boolean'
STR = 'string'
LIST = 'list'
INT = 'integer'
URL = 'url'
INPUT_FILE = 'input_file'
def __init__(self, name, *opts):
self._name = name
self._options = OptionList()
for optname, optval, optty in opts:
self._options.append(opt_factory(optname, str(optval), '', optty))
@property
def name(self):
return self._name
@property
def options(self):
return self._options
示例2: OnlyOptions
# 需要导入模块: from core.data.options.option_list import OptionList [as 别名]
# 或者: from core.data.options.option_list.OptionList import append [as 别名]
class OnlyOptions(gtk.VBox):
'''Only the options for configuration.
:param parentwidg: The parentwidg, to propagate changes
:param plugin: The selected plugin, for which the configuration is.
:param options: The options to configure.
:param save_btn: The save button.
:param rvrt_btn: The revert button.
:author: Facundo Batista <facundobatista =at= taniquetil.com.ar>
'''
def __init__(self, parentwidg, w3af, plugin, save_btn, rvrt_btn, overwriter=None):
super(OnlyOptions, self).__init__()
if overwriter is None:
overwriter = {}
self.set_spacing(5)
self.w3af = w3af
self.parentwidg = parentwidg
self.widgets_status = {}
self.tab_widget = {}
self.propagAnyWidgetChanged = helpers.PropagateBuffer(
self._changedAnyWidget)
self.propagLabels = {}
self.saved_successfully = False
# options
self.options = OptionList()
options = plugin.get_options()
# let's use the info from the core
coreopts = self.w3af.plugins.get_plugin_options(
plugin.ptype, plugin.pname)
if coreopts is None:
coreopts = {}
# let's get the real info
for opt in options:
if opt.get_name() in coreopts:
opt.set_value(coreopts[opt.get_name()].get_value_str())
if opt.get_name() in overwriter:
opt.set_value(overwriter[opt.get_name()])
self.options.append(opt)
# buttons
save_btn.connect("clicked", self._save_panel, plugin)
save_btn.set_sensitive(False)
rvrt_btn.set_sensitive(False)
rvrt_btn.connect("clicked", self._revertPanel)
self.save_btn = save_btn
self.rvrt_btn = rvrt_btn
# middle (the heart of the panel)
if self.options:
tabbox = gtk.HBox()
heart = self._createNotebook()
tabbox.pack_start(heart, expand=True)
tabbox.show()
self.pack_start(tabbox, expand=True, fill=False)
self.show()
def _createNotebook(self):
'''This create the notebook with all the options.
:return: The created notebook if more than one grouping
'''
# let's get the tabs, but in order!
tabs = []
for o in self.options:
t = o.get_tabid()
if t not in tabs:
tabs.append(t)
# see if we have more than a tab to create a nb
if len(tabs) < 2:
table = self._makeTable(self.options, None)
return table
# the notebook
nb = gtk.Notebook()
for tab in tabs:
options = [x for x in self.options if x.get_tabid() == tab]
if not tab:
tab = "General"
label = gtk.Label(tab)
prop = helpers.PropagateBufferPayload(self._changedLabelNotebook,
label, tab)
table = self._makeTable(options, prop)
nb.append_page(table, label)
nb.show()
return nb
def _makeTable(self, options, prop):
'''Creates the table in which the options are shown.
:param options: The options to show
:param prop: The propagation function for this options
:return: The created table
For each row, it will put:
- the option label
#.........这里部分代码省略.........