本文整理汇总了Python中zenmapGUI.higwidgets.higtables.HIGTable.attach_entry方法的典型用法代码示例。如果您正苦于以下问题:Python HIGTable.attach_entry方法的具体用法?Python HIGTable.attach_entry怎么用?Python HIGTable.attach_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higtables.HIGTable
的用法示例。
在下文中一共展示了HIGTable.attach_entry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CrashReport
# 需要导入模块: from zenmapGUI.higwidgets.higtables import HIGTable [as 别名]
# 或者: from zenmapGUI.higwidgets.higtables.HIGTable import attach_entry [as 别名]
class CrashReport(HIGWindow):
def __init__(self, summary, description):
HIGWindow.__init__(self)
gtk.Window.__init__(self)
self.set_title(_('Crash Report'))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.response_id = False
self._create_widgets()
self._pack_widgets()
self._connect_widgets()
self.summary = summary
self.description = "\n----\n" + description
def _create_widgets(self):
self.vbox = HIGVBox()
self.button_box = gtk.HButtonBox()
self.email_label = gtk.Label(_("""\
An email address is optional. Sometimes we use it to get more information. If \
you provide an email address your report will be marked private so only \
project developers can read it.\
"""))
self.email_entry = gtk.Entry()
self.summary_entry = gtk.Entry()
self.description_label = gtk.Label(_("\
What were you doing when the crash happened?\
"))
self.description_scrolled = gtk.ScrolledWindow()
self.description_text = gtk.TextView()
self.bug_text = gtk.Label(_("""\
An unhandled exception has crashed Zenmap. This dialog allows you to tell us \
what you did to cause the crash and help us to fix it. Submitting the report \
will open a description of the new bug at the bug tracker. Feel free to edit \
the report to remove any identifying information such as your home directory.\
"""))
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.description_label.set_line_wrap(True)
self.description_label.set_alignment(0.0, 0.5)
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.email_label.set_line_wrap(True)
self.email_label.set_alignment(0.0, 0.5)
self.bug_text.set_line_wrap(True)
self.hbox.set_border_width(12)
self.vbox.set_border_width(6)
self.table.attach_label(gtk.Label(_("Summary")), 0, 1, 0, 1)
self.table.attach_entry(self.summary_entry, 1, 2, 0, 1)
self.table.attach_entry(self.description_label, 0, 2, 1, 2)
self.table.attach_entry(self.description_scrolled, 0, 2, 2, 3)
self.table.attach(self.email_label, 0, 2, 3, 4)
self.table.attach_label(gtk.Label(_("Email")), 0, 1, 4, 5)
self.table.attach_entry(self.email_entry, 1, 2, 4, 5)
self.hbox._pack_expand_fill(self.bug_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._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 send_report(self, widget):
bug_register = BugRegister()
description_text = self.description
private = False
if self.email != "":
description_text += "\n\n" + self.email
private = True
report_url = bug_register.get_report_url(self.summary,
description_text, private = private)
#.........这里部分代码省略.........