本文整理汇总了Python中zenmapGUI.higwidgets.higboxes.HIGVBox.pack_start方法的典型用法代码示例。如果您正苦于以下问题:Python HIGVBox.pack_start方法的具体用法?Python HIGVBox.pack_start怎么用?Python HIGVBox.pack_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higboxes.HIGVBox
的用法示例。
在下文中一共展示了HIGVBox.pack_start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_profile
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
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>')
text = HIGEntryLabel(_('Your profile is going to be deleted! Click\
Ok to continue, or Cancel to go back to Profile Editor.'))
hbox = HIGHBox()
hbox.set_border_width(5)
hbox.set_spacing(12)
vbox = HIGVBox()
vbox.set_border_width(5)
vbox.set_spacing(12)
image = gtk.Image()
image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
vbox.pack_start(alert)
vbox.pack_start(text)
hbox.pack_start(image)
hbox.pack_start(vbox)
dialog.vbox.pack_start(hbox)
dialog.vbox.show_all()
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return True
self.profile.remove_profile(self.profile_name)
self.update_profile_entry()
self.destroy()
示例2: __create_tab
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
def __create_tab(self, tab_name, section_name, tab):
log.debug(">>> Tab name: %s" % tab_name)
log.debug(">>>Creating profile editor section: %s" % section_name)
vbox = HIGVBox()
if tab.notscripttab: # if notscripttab is set
table = HIGTable()
table.set_row_spacings(2)
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))
示例3: DiffWindow
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class DiffWindow(gtk.Window):
def __init__(self, scans):
gtk.Window.__init__(self)
self.set_title(_("Compare Results"))
self.ndiff_process = None
# We allow the user to start a new diff before the old one has
# finished. We have to keep references to old processes until they
# finish to avoid problems when tearing down the Python interpreter at
# program exit.
self.old_processes = []
self.timer_id = None
self.main_vbox = HIGVBox()
self.diff_view = DiffView()
self.diff_view.set_size_request(-1, 100)
self.hbox_buttons = HIGHBox()
self.progress = gtk.ProgressBar()
self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
self.hbox_selection = HIGHBox()
self.scan_chooser_a = ScanChooser(scans, _(u"A Scan"))
self.scan_chooser_b = ScanChooser(scans, _(u"B Scan"))
self._pack_widgets()
self._connect_widgets()
self.set_default_size(-1, 500)
# Initial Size Request
self.initial_size = self.get_size()
def _pack_widgets(self):
self.main_vbox.set_border_width(6)
self.hbox_selection.pack_start(self.scan_chooser_a, True, True)
self.hbox_selection.pack_start(self.scan_chooser_b, True, True)
self.main_vbox.pack_start(self.hbox_selection, False)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.add(self.diff_view)
self.main_vbox.pack_start(scroll, True, True)
self.progress.hide()
self.progress.set_no_show_all(True)
self.hbox_buttons.pack_start(self.progress, False)
self.hbox_buttons.pack_end(self.btn_close, False)
self.main_vbox._pack_noexpand_nofill(self.hbox_buttons)
self.add(self.main_vbox)
def _connect_widgets(self):
self.connect("delete-event", self.close)
self.btn_close.connect("clicked", self.close)
self.scan_chooser_a.connect('changed', self.refresh_diff)
self.scan_chooser_b.connect('changed', self.refresh_diff)
def refresh_diff(self, widget):
"""This method is called whenever the diff output might have changed,
such as when a different scan was selected in one of the choosers."""
log.debug("Refresh diff.")
if (self.ndiff_process is not None and
self.ndiff_process.poll() is None):
# Put this in the list of old processes we keep track of.
self.old_processes.append(self.ndiff_process)
self.ndiff_process = None
scan_a = self.scan_chooser_a.parsed_scan
scan_b = self.scan_chooser_b.parsed_scan
if scan_a is None or scan_b is None:
self.diff_view.clear()
else:
try:
self.ndiff_process = zenmapCore.Diff.ndiff(scan_a, scan_b)
except OSError, e:
alert = HIGAlertDialog(
message_format=_("Error running ndiff"),
secondary_text=_(
"There was an error running the ndiff program.\n\n"
) + str(e).decode(sys.getdefaultencoding(), "replace"))
alert.run()
alert.destroy()
else:
示例4: TopologyPage
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class TopologyPage(HIGVBox):
def __init__(self, inventory):
HIGVBox.__init__(self)
self.set_border_width(6)
self.set_spacing(4)
self.network_inventory = inventory
self._create_widgets()
self._pack_widgets()
def _create_widgets(self):
self.rn_hbox = gtk.HBox()
self.rn_hbox.set_spacing(4)
self.rn_vbox = gtk.VBox()
# RadialNet's widgets
self.radialnet = RadialNet(LAYOUT_WEIGHTED)
self.control = ControlWidget(self.radialnet)
self.fisheye = ControlFisheye(self.radialnet)
self.rn_toolbar = Toolbar(self.radialnet,
self,
self.control,
self.fisheye)
self.display_panel = HIGVBox()
self.radialnet.set_no_show_all(True)
self.slow_vbox = HIGVBox()
self.slow_label = gtk.Label()
self.slow_vbox.pack_start(self.slow_label, False, False)
show_button = gtk.Button(_("Show the topology anyway"))
show_button.connect("clicked", self.show_anyway)
self.slow_vbox.pack_start(show_button, False, False)
self.slow_vbox.show_all()
self.slow_vbox.set_no_show_all(True)
self.slow_vbox.hide()
self.radialnet.show()
def _pack_widgets(self):
self.rn_hbox.pack_start(self.display_panel, True, True)
self.rn_hbox.pack_start(self.control, False)
self.rn_vbox.pack_start(self.rn_hbox, True, True)
self.rn_vbox.pack_start(self.fisheye, False)
self.pack_start(self.rn_toolbar, False, False)
self.pack_start(self.rn_vbox, True, True)
self.display_panel.pack_start(self.slow_vbox, True, False)
self.display_panel.pack_start(self.radialnet, True, True)
def add_scan(self, scan):
"""Parses a given XML file and adds the parsed result to the network inventory."""
self.network_inventory.add_scan(scan)
self.update_radialnet()
def update_radialnet(self):
"""Creates a graph from network inventory's host list and displays it."""
hosts_up = self.network_inventory.get_hosts_up()
self.slow_label.set_text(_("""\
Topology is disabled because too many hosts can cause it
to run slowly. The limit is %d hosts and there are %d.\
""" % (SLOW_LIMIT, len(hosts_up))))
if len(hosts_up) <= SLOW_LIMIT:
self.radialnet.show()
self.slow_vbox.hide()
self.update_radialnet_unchecked()
else:
self.radialnet.hide()
self.slow_vbox.show()
def update_radialnet_unchecked(self):
hosts_up = self.network_inventory.get_hosts_up()
graph = make_graph_from_hosts(hosts_up)
self.radialnet.set_empty()
self.radialnet.set_graph(graph)
self.radialnet.show()
def show_anyway(self, widget):
self.radialnet.show()
self.slow_vbox.hide()
self.update_radialnet_unchecked()
示例5: NmapOutputProperties
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class NmapOutputProperties(HIGDialog):
def __init__(self, nmap_output_view):
HIGDialog.__init__(self, _("Nmap Output Properties"),
buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
self.nmap_highlight = NmapOutputHighlight()
self.__create_widgets()
self.__pack_widgets()
self.highlight_tab()
self.vbox.show_all()
def __create_widgets(self):
self.properties_notebook = HIGNotebook()
def __pack_widgets(self):
self.vbox.pack_start(self.properties_notebook)
def highlight_tab(self):
# Creating highlight tab main box
self.highlight_main_vbox = HIGVBox()
# Creating highlight tab main table
self.highlight_main_table = HIGTable()
self.highlight_main_table.set_border_width(6)
#############
# Properties:
self.property_names = {"details": [_("details"), "MAC Address:"],
"port_list": [_("port listing title"),
"PORT STATE SERVICE"],
"open_port": [_("open port"),
"22/tcp open ssh"],
"closed_port": [_("closed port"),
"70/tcp closed gopher"],
"filtered_port": [_("filtered port"),
"80/tcp filtered http"],
"date": [_("date"), "2006-05-26 11:14 BRT"],
"hostname": [_("hostname"), "scanme.nmap.org"],
"ip": [_("ip"), "127.0.0.1"]}
for p in self.property_names:
settings = self.nmap_highlight.__getattribute__(p)
self.property_names[p].append(settings[0])
self.property_names[p].append(settings[1])
self.property_names[p].append(settings[2])
self.property_names[p].append(gtk.gdk.Color(*settings[3]))
self.property_names[p].append(gtk.gdk.Color(*settings[4]))
self.property_names[p].append(settings[5])
# Creating properties and related widgets and attaching it to main
# table
y1 = 0
y2 = 1
for p in self.property_names:
hp = HighlightProperty(p, self.property_names[p])
self.highlight_main_table.attach(
hp.property_name_label, 0, 1, y1, y2)
self.highlight_main_table.attach(hp.example_label, 1, 2, y1, y2)
self.highlight_main_table.attach(hp.bold_tg_button, 2, 3, y1, y2)
self.highlight_main_table.attach(hp.italic_tg_button, 3, 4, y1, y2)
self.highlight_main_table.attach(
hp.underline_tg_button, 4, 5, y1, y2)
self.highlight_main_table.attach(
hp.text_color_button, 5, 6, y1, y2)
self.highlight_main_table.attach(
hp.highlight_color_button, 6, 7, y1, y2)
# Setting example styles and colors
hp.update_example()
self.property_names[p].append(hp)
y1 += 1
y2 += 1
# Packing main table into main vbox
self.highlight_main_vbox.pack_start(self.highlight_main_table)
# Adding color tab
self.properties_notebook.append_page(
self.highlight_main_vbox,
gtk.Label(_("Highlight definitions")))
示例6: SearchWindow
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class SearchWindow(BaseSearchWindow, object):
def __init__(self, load_method, append_method):
BaseSearchWindow.__init__(self)
self.set_default_size(600, 400)
self.load_method = load_method
self.append_method = append_method
self._create_widgets()
self._pack_widgets()
self._connect_widgets()
def _create_widgets(self):
self.vbox = HIGVBox()
self.bottom_hbox = gtk.HBox()
self.bottom_label = gtk.Label()
self.btn_box = gtk.HButtonBox()
self.btn_open = HIGButton(stock=gtk.STOCK_OPEN)
self.btn_append = HIGButton(_("Append"), gtk.STOCK_ADD)
self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
self.search_gui = SearchGUI(self)
def _pack_widgets(self):
BaseSearchWindow._pack_widgets(self)
self.btn_box.set_layout(gtk.BUTTONBOX_END)
self.btn_box.set_spacing(4)
self.btn_box.pack_start(self.btn_close)
self.btn_box.pack_start(self.btn_append)
self.btn_box.pack_start(self.btn_open)
self.bottom_label.set_alignment(0.0, 0.5)
self.bottom_label.set_use_markup(True)
self.bottom_hbox.set_spacing(4)
self.bottom_hbox.pack_start(self.bottom_label, True)
self.bottom_hbox.pack_start(self.btn_box, False)
self.vbox.set_spacing(4)
self.vbox.pack_start(self.search_gui, True, True)
self.vbox.pack_start(self.bottom_hbox, False)
self.add(self.vbox)
def _connect_widgets(self):
# Double click on result, opens it
self.search_gui.result_view.connect("row-activated", self.open_selected)
self.btn_open.connect("clicked", self.open_selected)
self.btn_append.connect("clicked", self.append_selected)
self.btn_close.connect("clicked", self.close)
self.connect("delete-event", self.close)
def close(self, widget=None, event=None):
self.search_gui.close()
self.destroy()
def set_label_text(self, text):
self.bottom_label.set_label(text)
def open_selected(self, widget=None, path=None, view_column=None, extra=None):
# Open selected results
self.load_method(self.results)
# Close Search Window
self.close()
def append_selected(self, widget=None, path=None, view_column=None, extra=None):
# Append selected results
self.append_method(self.results)
# Close Search Window
self.close()
def get_results(self):
# Return list with parsed objects from result list store
return self.search_gui.selected_results
results = property(get_results)
示例7: DiffWindow
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import pack_start [as 别名]
class DiffWindow(gtk.Window):
def __init__(self, scans):
gtk.Window.__init__(self)
self.set_title(_("Compare Results"))
self.ndiff_process = None
# We allow the user to start a new diff before the old one has
# finished. We have to keep references to old processes until they
# finish to avoid problems when tearing down the Python interpreter at
# program exit.
self.old_processes = []
self.timer_id = None
self.main_vbox = HIGVBox()
self.diff_view = DiffView()
self.diff_view.set_size_request(-1, 100)
self.hbox_buttons = HIGHBox()
self.progress = gtk.ProgressBar()
self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
self.hbox_selection = HIGHBox()
self.scan_chooser_a = ScanChooser(scans, _(u"A Scan"))
self.scan_chooser_b = ScanChooser(scans, _(u"B Scan"))
self._pack_widgets()
self._connect_widgets()
self.set_default_size(-1, 500)
# Initial Size Request
self.initial_size = self.get_size()
def _pack_widgets(self):
self.main_vbox.set_border_width(6)
self.hbox_selection.pack_start(self.scan_chooser_a, True, True)
self.hbox_selection.pack_start(self.scan_chooser_b, True, True)
self.main_vbox.pack_start(self.hbox_selection, False)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.add(self.diff_view)
self.main_vbox.pack_start(scroll, True, True)
self.progress.hide()
self.progress.set_no_show_all(True)
self.hbox_buttons.pack_start(self.progress, False)
self.hbox_buttons.pack_end(self.btn_close, False)
self.main_vbox._pack_noexpand_nofill(self.hbox_buttons)
self.add(self.main_vbox)
def _connect_widgets(self):
self.connect("delete-event", self.close)
self.btn_close.connect("clicked", self.close)
self.scan_chooser_a.connect('changed', self.refresh_diff)
self.scan_chooser_b.connect('changed', self.refresh_diff)
def refresh_diff(self, widget):
"""This method is called whenever the diff output might have changed,
such as when a different scan was selected in one of the choosers."""
log.debug("Refresh diff.")
if (self.ndiff_process is not None and
self.ndiff_process.poll() is None):
# Put this in the list of old processes we keep track of.
self.old_processes.append(self.ndiff_process)
self.ndiff_process = None
scan_a = self.scan_chooser_a.parsed_scan
scan_b = self.scan_chooser_b.parsed_scan
if scan_a is None or scan_b is None:
self.diff_view.clear()
else:
try:
self.ndiff_process = zenmapCore.Diff.ndiff(scan_a, scan_b)
except OSError as e:
alert = HIGAlertDialog(
message_format=_("Error running ndiff"),
secondary_text=_(
"There was an error running the ndiff program.\n\n"
) + str(e).decode(sys.getdefaultencoding(), "replace"))
alert.run()
alert.destroy()
else:
self.progress.show()
if self.timer_id is None:
self.timer_id = gobject.timeout_add(
NDIFF_CHECK_TIMEOUT, self.check_ndiff_process)
def check_ndiff_process(self):
"""Check if the ndiff subprocess is done and show the diff if it is.
Also remove any finished processes from the old process list."""
# Check if any old background processes have finished.
for p in self.old_processes[:]:
if p.poll() is not None:
p.close()
self.old_processes.remove(p)
#.........这里部分代码省略.........