本文整理汇总了Python中zenmapCore.UmitConf.NmapOutputHighlight.__setattr__方法的典型用法代码示例。如果您正苦于以下问题:Python NmapOutputHighlight.__setattr__方法的具体用法?Python NmapOutputHighlight.__setattr__怎么用?Python NmapOutputHighlight.__setattr__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapCore.UmitConf.NmapOutputHighlight
的用法示例。
在下文中一共展示了NmapOutputHighlight.__setattr__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NmapOutputViewer
# 需要导入模块: from zenmapCore.UmitConf import NmapOutputHighlight [as 别名]
# 或者: from zenmapCore.UmitConf.NmapOutputHighlight import __setattr__ [as 别名]
#.........这里部分代码省略.........
def show_output_properties(self, widget):
nmap_out_prop = NmapOutputProperties(self.text_view)
nmap_out_prop.run()
for prop in nmap_out_prop.property_names:
widget = nmap_out_prop.property_names[prop][8]
wid_props = []
if widget.bold:
wid_props.append(1)
else:
wid_props.append(0)
if widget.italic:
wid_props.append(1)
else:
wid_props.append(0)
if widget.underline:
wid_props.append(1)
else:
wid_props.append(0)
wid_props.append("(%s, %s, %s)" % (widget.text_color.red,
widget.text_color.green,
widget.text_color.blue))
wid_props.append("(%s, %s, %s)" % (widget.highlight_color.red,
widget.highlight_color.green,
widget.highlight_color.blue))
self.nmap_highlight.__setattr__(widget.property_name, wid_props)
nmap_out_prop.destroy()
self.nmap_highlight.save_changes()
self.apply_highlighting()
def apply_highlighting(self, start_iter=None, end_iter=None):
buf = self.text_view.get_buffer()
if start_iter is None:
start_iter = buf.get_start_iter()
else:
# Patterns are line-oriented; start on a line boundary.
start_iter.backward_line()
if end_iter is None:
end_iter = buf.get_end_iter()
buf.apply_tag(self.tag_font, start_iter, end_iter)
if not self.nmap_highlight.enable:
return
text = buf.get_text(start_iter, end_iter)
for property in self.HIGHLIGHT_PROPERTIES:
settings = self.nmap_highlight.__getattribute__(property)
for m in re.finditer(settings[5], text, re.M):
m_start_iter = start_iter.copy()
m_start_iter.forward_chars(m.start())
m_end_iter = start_iter.copy()
m_end_iter.forward_chars(m.end())
buf.apply_tag_by_name(property, m_start_iter, m_end_iter)