本文整理汇总了Python中zenmapGUI.higwidgets.higlabels.HIGEntryLabel.set_text方法的典型用法代码示例。如果您正苦于以下问题:Python HIGEntryLabel.set_text方法的具体用法?Python HIGEntryLabel.set_text怎么用?Python HIGEntryLabel.set_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higlabels.HIGEntryLabel
的用法示例。
在下文中一共展示了HIGEntryLabel.set_text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HighlightProperty
# 需要导入模块: from zenmapGUI.higwidgets.higlabels import HIGEntryLabel [as 别名]
# 或者: from zenmapGUI.higwidgets.higlabels.HIGEntryLabel import set_text [as 别名]
#.........这里部分代码省略.........
"clicked", self.highlight_color_dialog_cancel,
color_dialog)
color_dialog.connect(
"delete-event", self.highlight_color_dialog_close,
color_dialog)
color_dialog.run()
def highlight_color_dialog_ok(self, widget, color_dialog):
self.highlight_color = color_dialog.colorsel.get_current_color()
color_dialog.destroy()
self.update_example()
def highlight_color_dialog_cancel(self, widget, color_dialog):
color_dialog.destroy()
def highlight_color_dialog_close(self, widget, extra, color_dialog):
color_dialog.destroy()
def update_example(self, widget=None):
start = 0
end = len(self.example)
attributes = pango.AttrList()
attributes.insert(
pango.AttrForeground(self.text_color.red,
self.text_color.green, self.text_color.blue, start, end))
attributes.insert(pango.AttrBackground(self.highlight_color.red,
self.highlight_color.green,
self.highlight_color.blue,
start, end))
# Bold verification
if self.bold_tg_button.get_active():
attributes.insert(pango.AttrWeight(pango.WEIGHT_HEAVY, start, end))
else:
attributes.insert(
pango.AttrWeight(pango.WEIGHT_NORMAL, start, end))
# Italic verification
if self.italic_tg_button.get_active():
attributes.insert(pango.AttrStyle(pango.STYLE_ITALIC, start, end))
else:
attributes.insert(pango.AttrStyle(pango.STYLE_NORMAL, start, end))
# Underline verification
if self.underline_tg_button.get_active():
attributes.insert(
pango.AttrUnderline(pango.UNDERLINE_SINGLE, start, end))
else:
attributes.insert(
pango.AttrUnderline(pango.UNDERLINE_NONE, start, end))
self.example_label.set_attributes(attributes)
def show_bold(self, widget):
self.example_label.set_markup("<>")
def get_example(self):
return self.example_label.get_text()
def set_example(self, example):
self.example_label.set_text(example)
def get_bold(self):
if self.bold_tg_button.get_active():
return 1
return 0
def set_bold(self, bold):
self.bold_tg_button.set_active(bold)
def get_italic(self):
if self.italic_tg_button.get_active():
return 1
return 0
def set_italic(self, italic):
self.italic_tg_button.set_active(italic)
def get_underline(self):
if self.underline_tg_button.get_active():
return 1
return 0
def set_underline(self, underline):
self.underline_tg_button.set_active(underline)
def get_label(self):
return self.property_name_label.get_text()
def set_label(self, label):
self.property_name_label.set_text(label)
label = property(get_label, set_label)
example = property(get_example, set_example)
bold = property(get_bold, set_bold)
italic = property(get_italic, set_italic)
underline = property(get_underline, set_underline)
示例2: HostDetails
# 需要导入模块: from zenmapGUI.higwidgets.higlabels import HIGEntryLabel [as 别名]
# 或者: from zenmapGUI.higwidgets.higlabels.HIGEntryLabel import set_text [as 别名]
#.........这里部分代码省略.........
self.lastboot_label = HIGEntryLabel(_('Last boot:'))
self.info_lastboot_label = HIGEntryLabel(na)
# Addresses expander
self.ipv4_label = HIGEntryLabel(_('IPv4:'))
self.info_ipv4_label = HIGEntryLabel(na)
self.ipv6_label = HIGEntryLabel(_('IPv6:'))
self.info_ipv6_label = HIGEntryLabel(na)
self.mac_label = HIGEntryLabel(_('MAC:'))
self.info_mac_label = HIGEntryLabel(na)
self.vendor_label = HIGEntryLabel(_('Vendor:'))
self.info_vendor_label = HIGEntryLabel(na)
def create_table_hbox(self):
table = HIGTable()
hbox = HIGHBox()
hbox._pack_noexpand_nofill(hig_box_space_holder())
hbox._pack_noexpand_nofill(table)
return table, hbox
def set_host_status(self, status):
self.host_status_expander.set_use_markup(True)
self.host_status_expander.set_expanded(True)
table, hbox = self.create_table_hbox()
if ('state' in status and
status['state'] != ''):
self.info_host_state_label.set_text(status['state'])
if ('open' in status and
status['open'] != ''):
self.info_open_ports.set_text(status['open'])
if ('filtered' in status and
status['filtered'] != ''):
self.info_filtered_label.set_text(status['filtered'])
if ('closed' in status and
status['closed'] != ''):
self.info_closed_ports.set_text(status['closed'])
if ('scanned' in status and
status['scanned'] != ''):
self.info_scanned_label.set_text(status['scanned'])
if ('uptime' in status and
status['uptime'] != ''):
self.info_uptime_label.set_text(status['uptime'])
if ('lastboot' in status and
status['lastboot'] != ''):
self.info_lastboot_label.set_text(status['lastboot'])
table.attach(self.host_state_label, 0, 1, 0, 1)
table.attach(self.info_host_state_label, 1, 2, 0, 1)
table.attach(self.open_label, 0, 1, 1, 2)
table.attach(self.info_open_ports, 1, 2, 1, 2)
table.attach(self.filtered_label, 0, 1, 2, 3)
示例3: HostDetails
# 需要导入模块: from zenmapGUI.higwidgets.higlabels import HIGEntryLabel [as 别名]
# 或者: from zenmapGUI.higwidgets.higlabels.HIGEntryLabel import set_text [as 别名]
#.........这里部分代码省略.........
self.lastboot_label = HIGEntryLabel(_("Last boot:"))
self.info_lastboot_label = HIGEntryLabel(na)
# Addresses expander
self.ipv4_label = HIGEntryLabel(_("IPv4:"))
self.info_ipv4_label = HIGEntryLabel(na)
self.ipv6_label = HIGEntryLabel(_("IPv6:"))
self.info_ipv6_label = HIGEntryLabel(na)
self.mac_label = HIGEntryLabel(_("MAC:"))
self.info_mac_label = HIGEntryLabel(na)
self.vendor_label = HIGEntryLabel(_("Vendor:"))
self.info_vendor_label = HIGEntryLabel(na)
def create_table_hbox(self):
table = HIGTable()
hbox = HIGHBox()
hbox._pack_noexpand_nofill(hig_box_space_holder())
hbox._pack_noexpand_nofill(table)
return table, hbox
def set_host_status(self, status):
self.host_status_expander.set_use_markup(True)
self.host_status_expander.set_expanded(True)
table, hbox = self.create_table_hbox()
try:
if status["state"] == "":
raise Exception
self.info_host_state_label.set_text(status["state"])
except:
pass
try:
if status["open"] == "":
raise Exception
self.info_open_ports.set_text(status["open"])
except:
pass
try:
if status["filtered"] == "":
raise Exception
self.info_filtered_label.set_text(status["filtered"])
except:
pass
try:
if status["closed"] == "":
raise Exception
self.info_closed_ports.set_text(status["closed"])
except:
pass
try:
if status["scanned"] == "":
raise Exception
self.info_scanned_label.set_text(status["scanned"])
except:
pass
try:
示例4: ScanRunDetailsPage
# 需要导入模块: from zenmapGUI.higwidgets.higlabels import HIGEntryLabel [as 别名]
# 或者: from zenmapGUI.higwidgets.higlabels.HIGEntryLabel import set_text [as 别名]
#.........这里部分代码省略.........
self.general_table.set_col_spacings(6)
self.general_hbox = HIGHBox()
self.general_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.general_hbox._pack_noexpand_nofill(self.general_table)
self.general_table.attach(self.start_label, 0, 1, 0, 1)
self.general_table.attach(self.info_start_label, 1, 2, 0, 1)
self.general_table.attach(self.finished_label, 0, 1, 1, 2)
self.general_table.attach(self.info_finished_label, 1, 2, 1, 2)
self.general_table.attach(self.host_up_label, 0, 1, 2, 3)
self.general_table.attach(self.info_hosts_up_label, 1, 2, 2, 3)
self.general_table.attach(self.host_down_label, 0, 1, 3, 4)
self.general_table.attach(self.info_hosts_down_label, 1, 2, 3, 4)
self.general_table.attach(self.host_scanned_label, 0, 1, 4, 5)
self.general_table.attach(self.info_hosts_scanned_label, 1, 2, 4, 5)
self.general_table.attach(self.open_label, 0, 1, 5, 6)
self.general_table.attach(self.info_open_label, 1, 2, 5, 6)
self.general_table.attach(self.filtered_label, 0, 1, 6, 7)
self.general_table.attach(self.info_filtered_label, 1, 2, 6, 7)
self.general_table.attach(self.closed_label, 0, 1, 7, 8)
self.general_table.attach(self.info_closed_label, 1, 2, 7, 8)
self.general_expander.add(self.general_hbox)
self._pack_noexpand_nofill(self.general_expander)
self.general_expander.set_expanded(True)
self._set_from_scan(scan)
def _set_from_scan(self, scan):
"""Initialize the display from a parsed scan."""
# Command info.
self.info_command_label.set_text(scan.get_nmap_command())
self.info_nmap_version_label.set_text(scan.get_scanner_version())
self.info_verbose_label.set_text(scan.get_verbose_level())
self.info_debug_label.set_text(scan.get_debugging_level())
# General info.
self.info_start_label.set_text(scan.get_formatted_date())
self.info_finished_label.set_text(scan.get_formatted_finish_date())
self.info_hosts_up_label.set_text(str(scan.get_hosts_up()))
self.info_hosts_down_label.set_text(str(scan.get_hosts_down()))
self.info_hosts_scanned_label.set_text(str(scan.get_hosts_scanned()))
self.info_open_label.set_text(str(scan.get_open_ports()))
self.info_filtered_label.set_text(str(scan.get_filtered_ports()))
self.info_closed_label.set_text(str(scan.get_closed_ports()))
for scaninfo in scan.get_scaninfo():
exp = gtk.Expander('<b>%s - %s</b>' % (
_('Scan Info'), scaninfo['type'].capitalize()))
exp.set_use_markup(True)
display = self.make_scaninfo_display(scaninfo)
exp.add(display)
self._pack_noexpand_nofill(exp)
def make_scaninfo_display(self, scaninfo):
"""Return a widget displaying a scan's "scaninfo" information: type,
protocol, number of scanned ports, and list of services."""
hbox = HIGHBox()
table = HIGTable()
table.set_border_width(5)
table.set_row_spacings(6)
table.set_col_spacings(6)
table.attach(HIGEntryLabel(_('Scan type:')), 0, 1, 0, 1)
table.attach(HIGEntryLabel(scaninfo['type']), 1, 2, 0, 1)
table.attach(HIGEntryLabel(_('Protocol:')), 0, 1, 1, 2)
table.attach(HIGEntryLabel(scaninfo['protocol']), 1, 2, 1, 2)
table.attach(HIGEntryLabel(_('# scanned ports:')), 0, 1, 2, 3)
table.attach(HIGEntryLabel(scaninfo['numservices']), 1, 2, 2, 3)
table.attach(HIGEntryLabel(_('Services:')), 0, 1, 3, 4)
table.attach(
self.make_services_display(scaninfo['services']), 1, 2, 3, 4)
hbox._pack_noexpand_nofill(hig_box_space_holder())
hbox._pack_noexpand_nofill(table)
return hbox
def make_services_display(self, services):
"""Return a widget displaying a list of services like
1-1027,1029-1033,1040,1043,1050,1058-1059,1067-1068,1076,1080"""
combo = gtk.combo_box_new_text()
for i in services.split(","):
combo.append_text(i)
return combo