Kiln » TortoiseHg » TortoiseHg
Clone URL:  
bugreport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# # bugreport.py - Bug report dialog for TortoiseHg # # Copyright (C) 2009 Steve Borho <steve@borho.org> # import pygtk import gtk import pango from mercurial.i18n import _ from hglib import toutf, fromutf, rootpath, diffexpand from gdialog import * from dialog import entry_dialog class BugReport(GDialog): """GTK+ based dialog for displaying traceback info to the user in a cut-paste friendly manner. And include a number of useful bit of information like version numbers, etc. """ def get_title(self): return _('TortoiseHg Bug Report') def get_icon(self): return 'menudelete.ico' def get_body(self): textview = gtk.TextView() textview.set_wrap_mode(gtk.WRAP_NONE) textview.set_editable(False) textview.modify_font(pango.FontDescription(self.fontlist)) scroller = gtk.ScrolledWindow() scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroller.add(textview) self.connect('map-event', self.displayed, textview.get_buffer()) vbox = gtk.VBox() vbox.pack_start(scroller, True, True, 2) hbbox = gtk.HButtonBox() hbbox.set_layout(gtk.BUTTONBOX_END) vbox.pack_start(hbbox, False, False, 2) close = gtk.Button(_('Close')) close.connect('clicked', gtk.main_quit) hbbox.add(close) return vbox def displayed(self, widget, event, buffer): from about import hgversion import shlib text = _('\n\nPlease report this bug to' ' http://bitbucket.org/tortoisehg/stable/issues\n') text += _('Mercurial version (%s). TortoiseHg version (%s)\n') % ( hgversion, shlib.version()) text += _('Command: %s\n') % (self.opts['cmd']) text += self.opts['error'] buffer.set_text(text) def run(**opts): dialog = BugReport(ui.ui(), None, None, None, opts, True) gtk.gdk.threads_init() gtk.gdk.threads_enter() dialog.display() gtk.main() gtk.gdk.threads_leave() if __name__ == "__main__": opts = {} opts['cmd'] = 'command' opts['error'] = 'test error' run(**opts)