2 # -*- coding: utf-8 -*-
8 print "Support PyGTK non disponible. Installer le paquet 'python-gtk2'."
11 TITLE = u"AuF — Envoi d'un rapport de bogue"
12 EMAIL_LABEL = u"Entrez votre adresse électronique : "
13 TEXT_LABEL = u"Décrivez votre problème ci-dessous :"
16 REPPORT = "\n".join([HR, "Rapport de bogue de %(email)s :", HR, "%(text)s", HR])
18 def bugreport_print(email, text):
19 print REPPORT % {'email': email, 'text': text}
21 def bugreport_http(email, text):
22 # on imagine ici une procédure d'envoi via HTTP
25 def cancel_clicked(btn):
28 def ok_clicked(btn, email, text):
29 email = email.get_text()
30 start, end = text.get_buffer().get_bounds()
31 text = start.get_text(end)
32 bugreport_print(email, text)
33 bugreport_http(email, text)
37 email_label = gtk.Label(EMAIL_LABEL)
40 email_hbox = gtk.HBox()
41 email_hbox.pack_start(email_label, False)
42 email_hbox.pack_start(email)
45 ruler.set_size_request(0, 1)
47 text_label = gtk.Label(TEXT_LABEL)
50 scroller = gtk.ScrolledWindow()
53 cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
54 cancel.connect("clicked", cancel_clicked)
56 ok = gtk.Button(stock=gtk.STOCK_OK)
57 ok.connect("clicked", ok_clicked, email, text)
59 buttons_hbox = gtk.HBox()
60 buttons_hbox.pack_start(cancel)
61 buttons_hbox.pack_start(ok)
64 vbox.pack_start(email_hbox, False)
65 vbox.pack_start(ruler, False)
66 vbox.pack_start(text_label, False)
67 vbox.pack_start(scroller)
68 vbox.pack_start(buttons_hbox, False)
71 window.set_title(TITLE)
72 window.resize(500, 400)
78 if __name__ == '__main__':