本文整理汇总了Python中zenmapGUI.higwidgets.higbuttons.HIGButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python HIGButton.connect方法的具体用法?Python HIGButton.connect怎么用?Python HIGButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higbuttons.HIGButton
的用法示例。
在下文中一共展示了HIGButton.connect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [as 别名]
def __init__(self, option, ops, check):
gtk.HBox.__init__(self)
self.option = option
self.ops = ops
self.check = check
self.entry = gtk.Entry()
self.pack_start(self.entry, True, True)
button = HIGButton(stock=gtk.STOCK_OPEN)
self.pack_start(button, False)
button.connect("clicked", self.clicked_cb)
self.entry.connect("changed", lambda x: self.emit("changed"))
self.entry.connect("changed", self.changed_cb)
self.check.connect("toggled", self.check_toggled_cb)
self.update()
示例2: ProfileEditor
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [as 别名]
class ProfileEditor(HIGWindow):
def __init__(self, command=None, profile_name=None,
deletable=True, overwrite=False):
HIGWindow.__init__(self)
self.connect("delete_event", self.exit)
self.set_title(_('Profile Editor'))
self.set_position(gtk.WIN_POS_CENTER)
self.deletable = deletable
self.profile_name = profile_name
self.overwrite = overwrite
# Used to block recursive updating of the command entry when the
# command entry causes the OptionBuilder widgets to change.
self.inhibit_command_update = False
self.__create_widgets()
self.__pack_widgets()
self.profile = CommandProfile()
self.ops = NmapOptions()
if profile_name:
log.debug("Showing profile %s" % profile_name)
prof = self.profile.get_profile(profile_name)
# Interface settings
self.profile_name_entry.set_text(profile_name)
self.profile_description_text.get_buffer().set_text(
prof['description'])
command_string = prof['command']
self.ops.parse_string(command_string)
if command:
self.ops.parse_string(command)
self.option_builder = OptionBuilder(
Path.profile_editor, self.ops,
self.update_command, self.help_field.get_buffer())
log.debug("Option groups: %s" % str(self.option_builder.groups))
log.debug("Option section names: %s" % str(
self.option_builder.section_names))
#log.debug("Option tabs: %s" % str(self.option_builder.tabs))
for tab in self.option_builder.groups:
self.__create_tab(
_(tab),
_(self.option_builder.section_names[tab]),
self.option_builder.tabs[tab])
self.update_command()
def command_entry_changed_cb(self, widget):
command_string = self.command_entry.get_text().decode("UTF-8")
self.ops.parse_string(command_string)
self.inhibit_command_update = True
self.option_builder.update()
self.inhibit_command_update = False
def update_command(self):
"""Regenerate and display the command."""
if not self.inhibit_command_update:
# Block recursive updating of the OptionBuilder widgets when they
# cause a change in the command entry.
self.command_entry.handler_block(self.command_entry_changed_cb_id)
self.command_entry.set_text(self.ops.render_string())
self.command_entry.handler_unblock(
self.command_entry_changed_cb_id)
def update_help_name(self, widget, extra):
self.help_field.get_buffer().set_text(
"Profile name\n\nThis is how the profile will be identified "
"in the drop-down combo box in the scan tab.")
def update_help_desc(self, widget, extra):
self.help_field.get_buffer().set_text(
"Description\n\nThe description is a full description of what "
"the scan does, which may be long.")
def __create_widgets(self):
###
# Vertical box to keep 3 boxes
self.main_whole_box = HIGVBox()
self.upper_box = HIGHBox()
self.middle_box = HIGHBox()
self.lower_box = HIGHBox()
#self.main_vbox = HIGVBox()
self.command_entry = gtk.Entry()
self.command_entry_changed_cb_id = self.command_entry.connect(
"changed", self.command_entry_changed_cb)
self.scan_button = HIGButton(_("Scan"))
self.scan_button.connect("clicked", self.run_scan)
self.notebook = gtk.Notebook()
# Profile info page
#.........这里部分代码省略.........
示例3: DiffWindow
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [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: HighlightProperty
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [as 别名]
class HighlightProperty(object):
def __init__(self, property_name, property):
self.__create_widgets()
self.property_name = property_name
self.property_label = property[0].capitalize()
self.example = property[1]
self.bold = property[2]
self.italic = property[3]
self.underline = property[4]
self.text_color = property[5]
self.highlight_color = property[6]
self.__connect_buttons()
def __create_widgets(self):
self.property_name_label = HIGEntryLabel("")
self.example_label = HIGEntryLabel("")
self.bold_tg_button = HIGToggleButton("", gtk.STOCK_BOLD)
self.italic_tg_button = HIGToggleButton("", gtk.STOCK_ITALIC)
self.underline_tg_button = HIGToggleButton("", gtk.STOCK_UNDERLINE)
self.text_color_button = HIGButton(
_("Text"), stock=gtk.STOCK_SELECT_COLOR)
self.highlight_color_button = HIGButton(
_("Highlight"), stock=gtk.STOCK_SELECT_COLOR)
def __connect_buttons(self):
self.bold_tg_button.connect("toggled", self.update_example)
self.italic_tg_button.connect("toggled", self.update_example)
self.underline_tg_button.connect("toggled", self.update_example)
self.text_color_button.connect("clicked", self.text_color_dialog)
self.highlight_color_button.connect(
"clicked", self.highlight_color_dialog)
####################################
# Text color dialog
def text_color_dialog(self, widget):
color_dialog = gtk.ColorSelectionDialog(
"%s %s" % (self.label, _("text color")))
color_dialog.colorsel.set_current_color(self.text_color)
color_dialog.ok_button.connect(
"clicked", self.text_color_dialog_ok, color_dialog)
color_dialog.cancel_button.connect(
"clicked", self.text_color_dialog_cancel, color_dialog)
color_dialog.connect(
"delete-event", self.text_color_dialog_close, color_dialog)
color_dialog.run()
def text_color_dialog_ok(self, widget, color_dialog):
self.text_color = color_dialog.colorsel.get_current_color()
color_dialog.destroy()
self.update_example()
def text_color_dialog_cancel(self, widget, color_dialog):
color_dialog.destroy()
def text_color_dialog_close(self, widget, extra, color_dialog):
color_dialog.destroy()
#########################################
# Highlight color dialog
def highlight_color_dialog(self, widget):
color_dialog = gtk.ColorSelectionDialog(
"%s %s" % (self.property_name, _("highlight color")))
color_dialog.colorsel.set_current_color(self.highlight_color)
color_dialog.ok_button.connect(
"clicked", self.highlight_color_dialog_ok, color_dialog)
color_dialog.cancel_button.connect(
"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()
#.........这里部分代码省略.........
示例5: UmitCredits
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [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:
#.........这里部分代码省略.........
示例6: SearchWindow
# 需要导入模块: from zenmapGUI.higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [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.higbuttons import HIGButton [as 别名]
# 或者: from zenmapGUI.higwidgets.higbuttons.HIGButton import connect [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)
#.........这里部分代码省略.........