本文整理汇总了Python中zenmapGUI.higwidgets.higboxes.HIGVBox._pack_noexpand_nofill方法的典型用法代码示例。如果您正苦于以下问题:Python HIGVBox._pack_noexpand_nofill方法的具体用法?Python HIGVBox._pack_noexpand_nofill怎么用?Python HIGVBox._pack_noexpand_nofill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higboxes.HIGVBox
的用法示例。
在下文中一共展示了HIGVBox._pack_noexpand_nofill方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __pack_widgets
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [as 别名]
def __pack_widgets(self):
###
self.add(self.main_whole_box)
# Packing command entry to upper box
self.upper_box._pack_expand_fill(self.command_entry)
self.upper_box._pack_noexpand_nofill(self.scan_button)
# Packing notebook (left) and help box (right) to middle box
self.middle_box._pack_expand_fill(self.notebook)
self.middle_box._pack_expand_fill(self.help_vbox)
# Packing buttons to lower box
self.lower_box.pack_end(self.buttons_hbox)
# Packing the three vertical boxes to the main box
self.main_whole_box._pack_noexpand_nofill(self.upper_box)
self.main_whole_box._pack_expand_fill(self.middle_box)
self.main_whole_box._pack_noexpand_nofill(self.lower_box)
###
# Packing profile information tab on notebook
self.notebook.append_page(self.profile_info_vbox, gtk.Label(_('Profile')))
self.profile_info_vbox.set_border_width(5)
table = HIGTable()
self.profile_info_vbox._pack_noexpand_nofill(self.profile_info_label)
self.profile_info_vbox._pack_expand_fill(HIGSpacer(table))
self.profile_description_scroll.add(self.profile_description_text)
vbox_desc = HIGVBox()
vbox_desc._pack_noexpand_nofill(self.profile_description_label)
vbox_desc._pack_expand_fill(hig_box_space_holder())
vbox_ann = HIGVBox()
vbox_ann._pack_expand_fill(hig_box_space_holder())
table.attach(self.profile_name_label,0,1,0,1,xoptions=0,yoptions=0)
table.attach(self.profile_name_entry,1,2,0,1,yoptions=0)
table.attach(vbox_desc,0,1,1,2,xoptions=0)
table.attach(self.profile_description_scroll,1,2,1,2)
# Packing buttons on button_hbox
self.buttons_hbox._pack_expand_fill(hig_box_space_holder())
if self.deletable:
self.buttons_hbox._pack_noexpand_nofill(self.delete_button)
self.buttons_hbox._pack_noexpand_nofill(self.cancel_button)
self.buttons_hbox._pack_noexpand_nofill(self.save_button)
self.buttons_hbox.set_border_width(5)
self.buttons_hbox.set_spacing(6)
###
self.help_vbox._pack_noexpand_nofill(self.help_label)
self.help_vbox._pack_expand_fill(self.help_scroll)
self.help_scroll.add(self.help_field)
self.help_vbox.set_border_width(1)
self.help_vbox.set_spacing(1)
示例2: __create_tab
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [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: ProfileEditor
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [as 别名]
#.........这里部分代码省略.........
'motion-notify-event', self.update_help_desc)
# Buttons
self.buttons_hbox = HIGHBox()
self.cancel_button = HIGButton(stock=gtk.STOCK_CANCEL)
self.cancel_button.connect('clicked', self.exit)
self.delete_button = HIGButton(stock=gtk.STOCK_DELETE)
self.delete_button.connect('clicked', self.delete_profile)
self.save_button = HIGButton(_("Save Changes"), stock=gtk.STOCK_SAVE)
self.save_button.connect('clicked', self.save_profile)
###
self.help_vbox = HIGVBox()
self.help_label = HIGSectionLabel(_('Help'))
self.help_scroll = HIGScrolledWindow()
self.help_scroll.set_border_width(0)
self.help_field = HIGTextView()
self.help_field.set_cursor_visible(False)
self.help_field.set_left_margin(5)
self.help_field.set_editable(False)
self.help_vbox.set_size_request(200, -1)
###
def __pack_widgets(self):
###
self.add(self.main_whole_box)
# Packing command entry to upper box
self.upper_box._pack_expand_fill(self.command_entry)
self.upper_box._pack_noexpand_nofill(self.scan_button)
# Packing notebook (left) and help box (right) to middle box
self.middle_box._pack_expand_fill(self.notebook)
self.middle_box._pack_expand_fill(self.help_vbox)
# Packing buttons to lower box
self.lower_box.pack_end(self.buttons_hbox)
# Packing the three vertical boxes to the main box
self.main_whole_box._pack_noexpand_nofill(self.upper_box)
self.main_whole_box._pack_expand_fill(self.middle_box)
self.main_whole_box._pack_noexpand_nofill(self.lower_box)
###
# Packing profile information tab on notebook
self.notebook.append_page(
self.profile_info_vbox, gtk.Label(_('Profile')))
self.profile_info_vbox.set_border_width(5)
table = HIGTable()
self.profile_info_vbox._pack_noexpand_nofill(self.profile_info_label)
self.profile_info_vbox._pack_expand_fill(HIGSpacer(table))
self.profile_description_scroll.add(self.profile_description_text)
vbox_desc = HIGVBox()
vbox_desc._pack_noexpand_nofill(self.profile_description_label)
vbox_desc._pack_expand_fill(hig_box_space_holder())
vbox_ann = HIGVBox()
vbox_ann._pack_expand_fill(hig_box_space_holder())
table.attach(
示例4: ScanInterface
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [as 别名]
class ScanInterface(HIGVBox):
"""ScanInterface contains the scan toolbar and the scan results. Each
ScanInterface represents a single NetworkInventory as well as a set of
running scans."""
# The time delay between when you stop typing a filter string and filtering
# actually begins, in milliseconds.
FILTER_DELAY = 1000
def __init__(self):
HIGVBox.__init__(self)
# The borders are consuming too much space on Maemo. Setting it to
# 0 pixels while on Maemo
if is_maemo():
self.set_border_width(0)
self.set_spacing(0)
# True if nothing has happened here page yet, i.e., it's okay to load a
# scan from a file here.
self.empty = True
# The most recent name the inventory on this page has been saved under.
self.saved_filename = None
# The network inventory shown by this page. It may consist of multiple
# scans.
self.inventory = FilteredNetworkInventory()
# The list of currently running scans (NmapCommand objects).
self.jobs = []
# The list of running and finished scans shown on the Nmap Output page.
self.scans_store = ScansListStore()
self.top_box = HIGVBox()
self.__create_toolbar()
self.__create_command_toolbar()
self.select_default_profile()
self.scan_result = ScanResult(self.inventory, self.scans_store,
scan_interface=self)
self.host_view_selection = self.scan_result.get_host_selection()
self.service_view_selection = self.scan_result.get_service_selection()
self.host_view_selection.connect(
'changed', self.host_selection_changed)
self.service_view_selection.connect(
'changed', self.service_selection_changed)
host_page = self.scan_result.scan_result_notebook.open_ports.host
host_page.host_view.get_selection().connect(
'changed', self.service_host_selection_changed)
self.host_view_selection.connect(
'changed', self.host_selection_changed)
self.scan_result.scan_result_notebook.nmap_output.connect(
"changed", self._displayed_scan_change_cb)
self.scan_result.scan_result_notebook.scans_list.remove_button.connect(
"clicked", self._remove_scan_cb)
# The hosts dict maps hostnames (as returned by HostInfo.get_hostname)
# to HostInfo objects.
self.hosts = {}
# The services dict maps service names ("http") to lists of dicts of
# the form
# {'host': <HostInfo object>, 'hostname': u'example.com',
# 'port_state': u'open', 'portid': u'22', 'protocol': u'tcp',
# 'service_conf': u'10', 'service_extrainfo': u'protocol 2.0',
# 'service_method': u'probed', 'service_name': u'ssh',
# 'service_product': u'OpenSSH', 'service_version': u'4.3'}
# In other words each dict has the same keys as an entry in
# HostInfo.ports, with the addition of "host" and "hostname" keys.
self.services = {}
self.top_box.set_border_width(6)
self.top_box.set_spacing(5)
self.top_box._pack_noexpand_nofill(self.toolbar)
self.top_box._pack_noexpand_nofill(self.command_toolbar)
self._pack_noexpand_nofill(self.top_box)
self._pack_expand_fill(self.scan_result)
self.scan_result.scan_result_notebook.scans_list.cancel_button.connect(
"clicked", self._cancel_scans_list_cb)
self.update_cancel_button()
# Create the filter GUI
self.filter_bar = FilterBar()
self.pack_start(self.filter_bar, False, True, 0)
self.filter_bar.set_no_show_all(True)
self.filter_timeout_id = None
self.filter_bar.connect("changed", self.filter_changed)
self.scan_result.filter_toggle_button.connect("toggled",
self.filter_toggle_toggled)
self.scan_result.filter_toggle_button.show()
#.........这里部分代码省略.........
示例5: DiffWindow
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [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:
示例6: ScanHostsView
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [as 别名]
class ScanHostsView(HIGVBox, object):
HOST_MODE, SERVICE_MODE = range(2)
def __init__(self, scan_interface):
HIGVBox.__init__(self)
self._scan_interface = scan_interface
self._create_widgets()
self._connect_widgets()
self._pack_widgets()
self._set_scrolled()
self._set_host_list()
self._set_service_list()
self._pack_expand_fill(self.main_vbox)
self.mode = None
# Default mode is host mode
self.host_mode(self.host_mode_button)
self.host_view.show_all()
self.service_view.show_all()
def _create_widgets(self):
# Mode buttons
self.host_mode_button = gtk.ToggleButton(_("Hosts"))
self.service_mode_button = gtk.ToggleButton(_("Services"))
self.buttons_box = gtk.HBox()
# Main window vbox
self.main_vbox = HIGVBox()
# Host list
self.host_list = gtk.ListStore(object, str, str)
self.host_list.set_sort_func(1000, cmp_treemodel_addr)
self.host_list.set_sort_column_id(1000, gtk.SORT_ASCENDING)
self.host_view = gtk.TreeView(self.host_list)
self.pic_column = gtk.TreeViewColumn(_('OS'))
self.host_column = gtk.TreeViewColumn(_('Host'))
self.os_cell = gtk.CellRendererPixbuf()
self.host_cell = gtk.CellRendererText()
# Service list
self.service_list = gtk.ListStore(str)
self.service_list.set_sort_column_id(0, gtk.SORT_ASCENDING)
self.service_view = gtk.TreeView(self.service_list)
self.service_column = gtk.TreeViewColumn(_('Service'))
self.service_cell = gtk.CellRendererText()
self.scrolled = gtk.ScrolledWindow()
def _pack_widgets(self):
self.main_vbox.set_spacing(0)
self.main_vbox.set_border_width(0)
self.main_vbox._pack_noexpand_nofill(self.buttons_box)
self.main_vbox._pack_expand_fill(self.scrolled)
self.host_mode_button.set_active(True)
self.buttons_box.set_border_width(5)
self.buttons_box.pack_start(self.host_mode_button)
self.buttons_box.pack_start(self.service_mode_button)
def _connect_widgets(self):
self.host_mode_button.connect("toggled", self.host_mode)
self.service_mode_button.connect("toggled", self.service_mode)
def host_mode(self, widget):
self._remove_scrolled_child()
if widget.get_active():
self.mode = self.HOST_MODE
self.service_mode_button.set_active(False)
self.scrolled.add(self.host_view)
else:
self.service_mode_button.set_active(True)
def service_mode(self, widget):
self._remove_scrolled_child()
if widget.get_active():
self.mode = self.SERVICE_MODE
self.host_mode_button.set_active(False)
self.scrolled.add(self.service_view)
else:
self.host_mode_button.set_active(True)
def _remove_scrolled_child(self):
try:
child = self.scrolled.get_child()
self.scrolled.remove(child)
except:
pass
def _set_scrolled(self):
self.scrolled.set_border_width(5)
self.scrolled.set_size_request(150, -1)
self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
def _set_service_list(self):
self.service_view.set_enable_search(True)
#.........这里部分代码省略.........
示例7: UmitCredits
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [as 别名]
class UmitCredits(HIGWindow):
def __init__(self):
HIGWindow.__init__(self)
self.set_title(_("%s credits") % UMIT_DISPLAY_NAME)
self.set_size_request(-1, 250)
self.set_position(gtk.WIN_POS_CENTER)
self.__create_widgets()
self.__packing()
self.set_text()
def __create_widgets(self):
self.vbox = HIGVBox()
self.hbox = HIGHBox()
self.notebook = HIGNotebook()
self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
self.written_by_scroll = HIGScrolledWindow()
self.written_by_text = HIGTextView()
self.design_scroll = HIGScrolledWindow()
self.design_text = HIGTextView()
self.soc2007_scroll = HIGScrolledWindow()
self.soc2007_text = HIGTextView()
self.contributors_scroll = HIGScrolledWindow()
self.contributors_text = HIGTextView()
self.translation_scroll = HIGScrolledWindow()
self.translation_text = HIGTextView()
self.nokia_scroll = HIGScrolledWindow()
self.nokia_text = HIGTextView()
def __packing(self):
self.add(self.vbox)
self.vbox.set_spacing(12)
self.vbox._pack_expand_fill(self.notebook)
self.vbox._pack_noexpand_nofill(self.hbox)
self.hbox._pack_expand_fill(hig_box_space_holder())
self.hbox._pack_noexpand_nofill(self.btn_close)
self.notebook.append_page(
self.written_by_scroll, gtk.Label(_("Written by")))
self.notebook.append_page(
self.design_scroll, gtk.Label(_("Design")))
self.notebook.append_page(
self.soc2007_scroll, gtk.Label(_("SoC 2007")))
self.notebook.append_page(
self.contributors_scroll, gtk.Label(_("Contributors")))
self.notebook.append_page(
self.translation_scroll, gtk.Label(_("Translation")))
self.notebook.append_page(
self.nokia_scroll, gtk.Label(_("Maemo")))
self.written_by_scroll.add(self.written_by_text)
self.written_by_text.set_wrap_mode(gtk.WRAP_NONE)
self.design_scroll.add(self.design_text)
self.design_text.set_wrap_mode(gtk.WRAP_NONE)
self.soc2007_scroll.add(self.soc2007_text)
self.soc2007_text.set_wrap_mode(gtk.WRAP_NONE)
self.contributors_scroll.add(self.contributors_text)
self.contributors_text.set_wrap_mode(gtk.WRAP_NONE)
self.translation_scroll.add(self.translation_text)
self.translation_text.set_wrap_mode(gtk.WRAP_NONE)
self.nokia_scroll.add(self.nokia_text)
self.nokia_text.set_wrap_mode(gtk.WRAP_NONE)
self.btn_close.connect('clicked', lambda x, y=None: self.destroy())
def set_text(self):
b = self.written_by_text.get_buffer()
b.set_text("""Adriano Monteiro Marques <[email protected]>""")
b = self.design_text.get_buffer()
b.set_text("""Operating System and Vulnerability Icons:
Takeshi Alexandre Gondo <[email protected]>
Logo, Application Icons and Splash screen:
Virgílio Carlo de Menezes Vasconcelos <[email protected]>
The Umit Project Web Site Design:
Joao Paulo Pacheco <[email protected]>""")
b = self.soc2007_text.get_buffer()
b.set_text("""Independent Features:
Adriano Monteiro Marques <[email protected]>
Frederico Silva Ribeiro <[email protected]>
Network Inventory:
Guilherme Henrique Polo Gonçalves <[email protected]>
Umit Radial Mapper:
#.........这里部分代码省略.........
示例8: DiffWindow
# 需要导入模块: from zenmapGUI.higwidgets.higboxes import HIGVBox [as 别名]
# 或者: from zenmapGUI.higwidgets.higboxes.HIGVBox import _pack_noexpand_nofill [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)
#.........这里部分代码省略.........