本文整理汇总了Python中higwidgets.higboxes.HIGHBox.set_border_width方法的典型用法代码示例。如果您正苦于以下问题:Python HIGHBox.set_border_width方法的具体用法?Python HIGHBox.set_border_width怎么用?Python HIGHBox.set_border_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higboxes.HIGHBox
的用法示例。
在下文中一共展示了HIGHBox.set_border_width方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
def __init__(self, option=None):
OptionDisplay.__init__(self)
#Profile and Wizard core
self._profilecore = None
self._wizardcore = None
self._notebook= None
self._profile = None
self._wizard = None
self._changed = False
hbox = HIGHBox()
hbox.set_border_width(12)
self.delete_button = HIGButton(stock='gtk-delete')
self.delete_button.connect('clicked', self.delete_option)
self.new_button = HIGButton(stock='gtk-new')
self.new_button.connect('clicked', self.new_option)
self.update_button = HIGButton(stock='gtk-refresh')
self.update_button.connect('clicked', self.update_option)
self.add_button = HIGButton(stock='gtk-add')
self.add_button.connect('clicked', self.add_option)
hbox.pack_end(self.delete_button,False,False)
hbox.pack_end(self.update_button, False, False)
hbox.pack_end(self.add_button, False, False)
hbox.pack_end(self.new_button, False,False)
self.attach(hbox, 1,2,6,7)
self.optionlist = option
示例2: HIGExpander
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class HIGExpander(gtk.Expander):
def __init__(self, label):
gtk.Expander.__init__(self)
self.set_use_markup(True)
self.set_label(label)
self.hbox = HIGHBox()
self.hbox.set_border_width(5)
self.hbox._pack_noexpand_nofill(hig_box_space_holder())
self.add(self.hbox)
def get_container(self):
return self.hbox
示例3: on_delete
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
def on_delete(self, widget=None):
if not self.profile_name:
return self.on_cancel()
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 None
self.deleted = True
self.profile.remove_profile(self.profile_name)
self.on_cancel()
示例4: quit
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
def quit(self, widget=None, extra=None):
if self.deleted:
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 None
self.destroy()
if self.scan_notebook != None:
for i in xrange(self.scan_notebook.get_n_pages()):
page = self.scan_notebook.get_nth_page(i)
page.toolbar.profile_entry.update()
示例5: LoginDialog
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class LoginDialog(HIGDialog):
""""""
#----------------------------------------------------------------------
def __init__(self, title=_('Open Monitor 2012')):
"""Constructor"""
HIGDialog.__init__(self, title=title, flags=gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.set_default_response(gtk.RESPONSE_ACCEPT)
self.set_keep_above(True)
self.set_size_request(480, 240)
self.set_border_width(2)
self._create_widgets()
self._pack_widgets()
self._connect_widgets()
def _create_widgets(self):
#Username
self.username_label = HIGLabel(_("Username"))
self.username_entry = HIGTextEntry()
self.username_entry.set_activates_default(True)
#Password
self.password_label = HIGLabel(_("Password"))
self.password_entry = HIGPasswordEntry()
self.password_entry.set_activates_default(True)
#Logo
self.logo_openmonitor = gtk.gdk.pixbuf_new_from_file\
(os.path.join(IMAGES_DIR, 'logoOM.png'))
self.logo_image = gtk.Image()
self.logo_image.set_from_pixbuf(self.logo_openmonitor)
#self.login_text = gtk.Label(_("Log into your ICM agent."))
#Register
#self.register_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("Register"))
self.register_label = \
gtk.Label(_("<span foreground='blue'>" \
"Register id</span>"))
self.register_label.set_use_markup(True)
self.register_button = gtk.Button()
self.register_button.add(self.register_label)
self.register_button.set_relief(gtk.RELIEF_NONE)
#Forget Password
self.forgot_password_label = \
gtk.Label(_("<span foreground='blue'>" \
"Forgot password?</span>"))
self.forgot_password_label.set_use_markup(True)
self.forgot_password = gtk.Button()
self.forgot_password.add(self.forgot_password_label)
self.forgot_password.set_relief(gtk.RELIEF_NONE)
#Auto Login
self.auto_login_checkbtn = gtk.CheckButton(_("Auto login"))
#Settings
self.settings_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("settings"))
#Container
self.hbox = HIGHBox(False,2)
self.table = HIGTable(8,4,False)
self.table.set_row_spacings(5)
self.table.set_col_spacings(10)
self.action_area.set_homogeneous(False)
#tab orders
self.orders = [self.username_entry, self.password_entry, self.register_button, self.forgot_password]
def _pack_widgets(self):
self.hbox.set_border_width(8)
self.table.set_focus_chain(self.orders)
self.table.attach(self.logo_image,0,7,0,5,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.username_label,0,1,5,6,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.username_entry,1,5,5,6,gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,0,0)
self.table.attach(self.password_label,0,1,6,7,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.password_entry,1,5,6,7,gtk.FILL|gtk.EXPAND,gtk.FILL|gtk.EXPAND,0,0)
self.table.attach(self.register_button,5,6,5,6,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.forgot_password,5,6,6,7,gtk.FILL,gtk.FILL,0,0)
self.table.attach(self.auto_login_checkbtn,1,3,7,8,gtk.FILL,gtk.FILL,0,0)
self.hbox._pack_expand_fill(self.table)
self.vbox.pack_start(self.hbox, False, False)
spaceholder1 = hig_box_space_holder()
spaceholder2 = hig_box_space_holder()
spaceholder3 = hig_box_space_holder()
self.action_area.pack_end(spaceholder1)
self.action_area.pack_end(spaceholder2)
self.action_area.pack_end(spaceholder3)
self.action_area.pack_end(self.settings_button)
self.action_area.reorder_child(self.settings_button, 0)
self.action_area.reorder_child(spaceholder1, 1)
#.........这里部分代码省略.........
示例6: OSFingerprintReport
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
#.........这里部分代码省略.........
can modify it, relicense it, incorporate it into programs such as Nmap, etc."
)
)
self.btn_ok = gtk.Button(stock=gtk.STOCK_OK)
self.btn_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
self.hbox = HIGHBox()
self.table = HIGTable()
def _pack_widgets(self):
self.notes_scrolled.add(self.notes_text)
self.notes_scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.notes_scrolled.set_size_request(400, 150)
self.notes_text.set_wrap_mode(gtk.WRAP_WORD)
self.fingerprint_icon.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG)
self.fingerprint_icon.set_padding(10, 0)
self.fingerprint_text.set_line_wrap(True)
self.fingerprint_text.set_use_markup(True)
self.table.attach_label(self.submitted_label, 0, 1, 0, 1)
self.table.attach_entry(self.submitted_entry, 1, 2, 0, 1)
self.table.attach_label(self.target_device_label, 0, 1, 1, 2)
self.table.attach_entry(self.target_device_entry, 1, 2, 1, 2)
self.table.attach_label(self.classification_label, 0, 1, 2, 3)
self.table.attach_entry(self.classification_combo, 1, 2, 2, 3)
self.table.attach_label(self.notes_label, 0, 2, 3, 4)
self.table.attach_entry(self.notes_scrolled, 0, 2, 4, 5)
self.hbox.set_border_width(12)
self.hbox._pack_noexpand_nofill(self.fingerprint_icon)
self.hbox._pack_expand_fill(self.fingerprint_text)
self.button_box.set_layout(gtk.BUTTONBOX_END)
self.button_box.pack_start(self.btn_ok)
self.button_box.pack_start(self.btn_cancel)
self.vbox.set_border_width(6)
self.vbox._pack_noexpand_nofill(self.hbox)
self.vbox._pack_expand_fill(self.table)
self.vbox._pack_noexpand_nofill(self.button_box)
self.add(self.vbox)
def _connect_widgets(self):
self.btn_ok.connect("clicked", self.send_report)
self.btn_cancel.connect("clicked", self.close)
self.connect("delete-event", self.close)
def close(self, widget=None, event=None):
self.destroy()
def send_report(self, widget):
if self.target_device == "":
cancel_dialog = HIGAlertDialog(
type=gtk.MESSAGE_ERROR,
message_format=_(
"Operating System \
Fingerprint report is incomplete!"
),
secondary_text=_(
"The Operating \
System Fingerprint report is incomplete. Please, try to provide as much \
示例7: BugReport
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class BugReport(HIGDialog):
def __init__(self, title=_('Bug Report'), summary=None, description=None,
category=None, crashreport=False, description_dialog=None,
reuse_mainloop=True):
HIGDialog.__init__(self, title=title,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
# If reuse_mainloop is true, then dialogs created inside this dialog
# will not start another mainloop.
self._reuse_mainloop = reuse_mainloop
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.crashreport = crashreport
self.description_dialog = description_dialog
self._create_widgets()
self._set_category_list()
self._pack_widgets()
self._connect_widgets()
self.summary = summary or ''
self.description_report = description
if self.crashreport:
self.description = _("CrashReport automatically created")
else:
if self.description_dialog is None:
self.description = description or ''
else:
self.description = description_dialog or ''
self.category = category or ''
def _set_category_list(self):
# Obtained at bug tracker page source code
# The following two lines are commented due to component deprecation
#self.category_list.append(["umitCore","umitCore"])
#self.category_list.append(["umitGUI","umitGUI"])
self.category_list.append(["Umit","Umit"])
self.category_list.append(["CrashReport","CrashReport"])
self.category_list.append(["Documentation", "Documentation"])
self.category_list.append(["UmitWeb","UmitWeb"])
self.category_list.append(["InterfaceEditor", "InterfaceEditor"])
self.category_list.append(["NetworkInventory", "NetworkInventory"])
self.category_list.append(["website","website"])
def _create_widgets(self):
self.category_label = HIGHintSectionLabel(_("Category (optional)"),
_("If you know in which section of the program "
"is the bug, please, select it from the choosebox. "
"If you don't know what section to choose, leave it blank."))
self.category_list = gtk.ListStore(str, str)
self.category_combo = gtk.ComboBoxEntry(self.category_list, 0)
self.email_label = HIGHintSectionLabel(_("Email"),
_("Please inform a valid e-mail address from "
"where you can be reached to be notified when the bug gets "
"fixed. Not used for other purposes."))
self.email_entry = gtk.Entry()
self.summary_label = HIGHintSectionLabel(_("Summary"),
_("This should be a quick description of the issue. "
"Try to be clear and concise."))
self.summary_entry = gtk.Entry()
self.description_label = HIGHintSectionLabel(_("Description"),
_("This is where you should write about the bug, "
"describing it as clear as possible and giving as many "
"informations as you can and how to reproduce the bug."))
self.description_scrolled = gtk.ScrolledWindow()
self.description_text = gtk.TextView()
self.bug_icon = gtk.Image()
self.bug_text = gtk.Label(_("This Bug Report dialog allows you "
"to easily tell us about a problem that you may have found on "
"Umit. Doing so, you help us to help you, by fixing and "
"improving Umit faster than usual."))
if self.crashreport:
# Create a button to show details
self.show_details = HIGStockButton(gtk.STOCK_DIALOG_INFO,
_("Show Details"))
self.hbox = HIGHBox()
self.table = HIGTable()
def _pack_widgets(self):
self.description_scrolled.add(self.description_text)
self.description_scrolled.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
self.description_scrolled.set_size_request(400, 150)
self.description_text.set_wrap_mode(gtk.WRAP_WORD)
self.bug_icon.set_from_stock(gtk.STOCK_DIALOG_INFO,
gtk.ICON_SIZE_DIALOG)
self.bug_icon.set_padding(10, 0)
self.bug_text.set_line_wrap(True)
self.hbox.set_border_width(12)
nextpos = (0, 1)
if not self.crashreport:
#.........这里部分代码省略.........
示例8: RegistrationDialog
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class RegistrationDialog(HIGDialog):
""""""
#----------------------------------------------------------------------
def __init__(self, title=_('Registration')):
"""Constructor"""
HIGDialog.__init__(self, title=title,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self._create_widgets()
self._pack_widgets()
# Register callbacks
self.connect("response", self.check_response)
def _create_widgets(self):
self.username_label = HIGLabel(_("Username"))
self.username_entry = gtk.Entry()
self.password_label = HIGLabel(_("Password"))
self.password_entry = HIGPasswordEntry()
self.retype_password_label = HIGLabel(_("Retype password"))
self.retype_password_entry = HIGPasswordEntry()
self.registration_icon = gtk.Image()
self.registration_text = gtk.Label(_("If you don't have an ICM account,"
"please register a new account."))
self.hbox = HIGHBox()
self.table = HIGTable()
def _pack_widgets(self):
self.registration_icon.set_from_stock(gtk.STOCK_DIALOG_INFO,
gtk.ICON_SIZE_DIALOG)
self.registration_icon.set_padding(10, 0)
self.registration_text.set_line_wrap(True)
self.hbox.set_border_width(12)
self.hbox._pack_noexpand_nofill(self.registration_icon)
self.hbox._pack_expand_fill(self.registration_text)
self.vbox.pack_start(self.hbox, False, False)
self.table.attach_label(self.username_label, 0, 1, 0, 1)
self.table.attach_entry(self.username_entry, 1, 2, 0, 1)
self.table.attach_label(self.password_label, 0, 1, 1, 2)
self.table.attach_entry(self.password_entry, 1, 2, 1, 2)
self.table.attach_label(self.retype_password_label, 0, 1, 2, 3)
self.table.attach_entry(self.retype_password_entry, 1, 2, 2, 3)
self.vbox.pack_start(self.table)
def check_response(self, widget, response_id):
if response_id == gtk.RESPONSE_ACCEPT: # clicked on Ok btn
self.register()
elif response_id in (gtk.RESPONSE_DELETE_EVENT, gtk.RESPONSE_CANCEL,
gtk.RESPONSE_NONE):
self.destroy()
def register(self):
username = self.username_entry.get_text()
password = self.password_entry.get_text()
theApp.aggregator.register(username, password)
示例9: ProfileEditor
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
#.........这里部分代码省略.........
#self.profile_annotation_label = HIGHBox()
self.profile_annotation_scroll = HIGScrolledWindow()
self.profile_annotation_text = HIGTextView()
# Buttons
self.buttons_hbox = HIGHBox()
self.help_button = HIGButton(stock=gtk.STOCK_HELP)
self.help_button.connect('clicked', self.help)
#self.delete_button = HIGButton(stock=gtk.STOCK_DELETE)
#self.delete_button.connect('clicked', self.delete_profile)
self.cancel_button = HIGButton(stock=gtk.STOCK_CANCEL)
self.cancel_button.connect('clicked', self.quit_without_saving)
self.ok_button = HIGButton(stock=gtk.STOCK_OK)
self.ok_button.connect('clicked', self.save_profile)
def __pack_widgets(self):
self.add(self.main_vbox)
# Packing widgets to main_vbox
self.main_vbox._pack_noexpand_nofill(self.command_expander)
self.main_vbox._pack_expand_fill(self.notebook)
self.main_vbox._pack_noexpand_nofill(self.buttons_hbox)
# Packing command_entry on command_expander
self.command_expander.hbox.pack_start(self.command_entry)
# 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_noexpand_nofill(HIGSpacer(table))
self.profile_annotation_scroll.add(self.profile_annotation_text)
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_noexpand_nofill(self.profile_annotation_label)
vbox_ann._pack_expand_fill(hig_box_space_holder())
table.attach(self.profile_name_label,0,1,0,1)
table.attach(self.profile_name_entry,1,2,0,1)
#table.attach(self.profile_hint_label,0,1,1,2,xoptions=0)
table.attach(self.profile_hint_label,0,1,1,2)
table.attach(self.profile_hint_entry,1,2,1,2)
table.attach(vbox_desc,0,1,2,3)
table.attach(self.profile_description_scroll,1,2,2,3)
table.attach(vbox_ann,0,1,3,4)
table.attach(self.profile_annotation_scroll,1,2,3,4)
# Packing buttons on button_hbox
self.buttons_hbox.pack_start(self.help_button)
#self.buttons_hbox.pack_start(self.delete_button)
self.buttons_hbox.pack_start(self.cancel_button)
self.buttons_hbox.pack_start(self.ok_button)
self.buttons_hbox.set_border_width(5)
self.buttons_hbox.set_spacing(6)
示例10: DiffText
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class DiffText(HIGVBox, object):
def __init__ (self, colors, check_color):
HIGVBox.__init__(self)
self.set_border_width(5)
self.set_spacing(6)
self.colors = colors
self.check_color = check_color
self._create_widgets()
self._pack_hbox()
self._set_text_view()
self._set_scrolled()
self._pack_noexpand_nofill(self.lbl_diff)
self._pack_expand_fill(self.hbox)
def _create_widgets (self):
self.hbox = HIGHBox ()
self.lbl_diff = HIGSectionLabel ("<b>%s</b>" % _("Diff Result"))
self.scrolled = gtk.ScrolledWindow()
self.txt_diff_result = gtk.TextView()
self.txg_tag = gtk.TextTag ("diff_style")
self.txg_added = gtk.TextTag ('added style')
self.txg_removed = gtk.TextTag ('removed style')
def _pack_hbox (self):
self.hbox.set_border_width(5)
self.hbox._pack_noexpand_nofill (hig_box_space_holder())
self.hbox._pack_expand_fill(self.scrolled)
def _set_scrolled (self):
self.scrolled.set_size_request(-1, 250)
# Packing text view into scrolled window
self.scrolled.add_with_viewport(self.txt_diff_result)
# Setting scrolled window
self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
def activate_color(self, activate):
self.check_color = activate
self._text_changed(None)
def _set_text_view (self):
self.txg_table = self.txt_diff_result.get_buffer().get_tag_table()
self.txg_table.add(self.txg_tag)
self.txg_table.add(self.txg_added)
self.txg_table.add(self.txg_removed)
self.txg_tag.set_property("family", "Monospace")
self.txg_added.set_property("background-gdk", self.colors.added)
self.txg_removed.set_property("background-gdk", self.colors.not_present)
self.txt_diff_result.set_wrap_mode(gtk.WRAP_WORD)
self.txt_diff_result.set_editable(False)
self.txt_diff_result.get_buffer().connect("changed", self._text_changed)
def _text_changed (self, widget):
self.txg_added.set_property("background-gdk", self.colors.added)
self.txg_removed.set_property("background-gdk", self.colors.not_present)
buff = self.txt_diff_result.get_buffer()
buff.apply_tag(self.txg_tag, buff.get_start_iter(), buff.get_end_iter())
if self.check_color:
positions = self._take_changes(buff)
for i in positions['added']:
buff.apply_tag(self.txg_added, i[0],i[1])
for i in positions['removed']:
buff.apply_tag(self.txg_removed, i[0], i[1])
else:
buff.remove_tag(self.txg_added, buff.get_start_iter(),
buff.get_end_iter())
buff.remove_tag(self.txg_removed, buff.get_start_iter(),
buff.get_end_iter())
def _take_changes (self, buffer):
positions = {'added':[], 'removed':[]}
in_line = 0
type = ''
iter = buffer.get_start_iter ()
last_char = '\n'
while iter.forward_char():
char = iter.get_char ()
offset = iter.get_offset()
if not in_line:
pos = []
if char == '+' and last_char == '\n':
pos.append (buffer.get_iter_at_offset(offset))
type = 'added'
in_line = 1
elif char == '-' and last_char == '\n':
pos.append (buffer.get_iter_at_offset(offset))
type = 'removed'
#.........这里部分代码省略.........
示例11: ServiceFingerprintReport
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import set_border_width [as 别名]
class ServiceFingerprintReport(gtk.Window, object):
def __init__(self, service_name, fingerprint, ip):
gtk.Window.__init__(self)
self.set_title(_('Service Fingerprint Report'))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self._create_widgets()
self._pack_widgets()
self._connect_widgets()
self.fingerprint = fingerprint
self.ip = ip
self.service_name = service_name
def _create_widgets(self):
self.vbox = HIGVBox()
self.button_box = gtk.HButtonBox()
self.submitted_label = HIGHintSectionLabel(_("Submitted by (optional)"),
_("Enter your name and \
e-mail address if we can contact you with any questions. (kept private, used \
for nothing else)"))
self.submitted_entry = gtk.Entry()
self.service_name_label = HIGHintSectionLabel(_("Service Name"),
_("E.g. smtp, pop-3, \
http, domain, ssh, etc. Umit tries to automaticly fill this field for you, \
based on the Nmap \"SERVICE\" output field. If it is correct, you don't need \
to worry about filling out this field. "))
self.service_name_entry = gtk.Entry()
self.platform_label = HIGHintSectionLabel(_("Platform/OS"),
_('The operating system \
or embedded device the service is running on - Examples are "Linux 2.4.X", \
"Windows XP", "Cisco 3640 router", "Netgear MR814 WAP"'))
self.platform_entry = gtk.Entry()
self.service_description_label = HIGHintSectionLabel(_("Service \
Description"),
_("Please try to \
include vendor name, app name, and version number as applicable. It is OK to \
leave this blank for embedded devices where you have described the hardware \
above and don't have any further details on the service name/version. Here \
are a few examples: ISC Bind 9.2.2, Sendmail 8.12.9/8.10.2, Microsoft Exchange \
5.5.2656.59, Network Associates WebShield 4.5"))
self.service_description_entry = gtk.Entry()
self.notes_label = HIGHintSectionLabel(_("Notes"),
_("Further info on the device \
or service, any special customizations, etc. If it isn't obvious, please let \
me know what the service is (Virus scanning email gateway, Gnutella-protocol \
P2P app, print server web configuration port, etc"))
self.notes_scrolled = gtk.ScrolledWindow()
self.notes_text = gtk.TextView()
self.fingerprint_icon = gtk.Image()
self.fingerprint_text = gtk.Label(_("This form allows you to \
contribute new service/version fingerprints to the Nmap database. Thanks for \
helping! <b>Please do not fill this out unless you are sure that you know what \
application is running on the machine you are submitting</b>. Incorrect \
entries can pollute the database. By submitting fingerprints you are \
transfering any copyright interest in the data to Fyodor so that he \
can modify it, relicense it, incorporate it into programs such as Nmap, etc."))
self.btn_ok = gtk.Button(stock=gtk.STOCK_OK)
self.btn_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
self.hbox = HIGHBox()
self.table = HIGTable()
def _pack_widgets(self):
self.notes_scrolled.add(self.notes_text)
self.notes_scrolled.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
self.notes_scrolled.set_size_request(400, 150)
self.notes_text.set_wrap_mode(gtk.WRAP_WORD)
self.fingerprint_icon.set_from_stock(gtk.STOCK_DIALOG_INFO,
gtk.ICON_SIZE_DIALOG)
self.fingerprint_icon.set_padding(10, 0)
self.fingerprint_text.set_line_wrap(True)
self.fingerprint_text.set_use_markup(True)
self.table.attach_label(self.submitted_label, 0, 1, 0, 1)
self.table.attach_entry(self.submitted_entry, 1, 2, 0, 1)
self.table.attach_label(self.platform_label, 0, 1, 1, 2)
self.table.attach_entry(self.platform_entry, 1, 2, 1, 2)
self.table.attach_label(self.service_name_label, 0, 1, 2, 3)
self.table.attach_entry(self.service_name_entry, 1, 2, 2, 3)
self.table.attach_label(self.service_description_label, 0, 1, 3, 4)
self.table.attach_entry(self.service_description_entry, 1, 2, 3, 4)
self.table.attach_label(self.notes_label, 0, 2, 4, 5)
self.table.attach_entry(self.notes_scrolled, 0, 2, 5, 6)
self.hbox.set_border_width(12)
self.hbox._pack_noexpand_nofill(self.fingerprint_icon)
#.........这里部分代码省略.........