Patch subject is complete summary.
# HG changeset patch
# User Emmanuel Rosa <goaway1...@gmail.com>
# Date 1252888678 14400
# Node ID 36a8fc52fd45198f20ca618ff489b0533de797e3
# Parent b497fc6dfba964a5a545814e74b4f6a1b9c08064
bugreport: add ability to save bug report to a file
diff --git a/tortoisehg/hgtk/bugreport.py b/tortoisehg/hgtk/bugreport.py
--- a/tortoisehg/hgtk/bugreport.py
+++ b/tortoisehg/hgtk/bugreport.py
@@ -12,7 +12,7 @@
from mercurial import extensions
from tortoisehg.util.i18n import _
from tortoisehg.util import hglib, version
-from tortoisehg.hgtk import gdialog
+from tortoisehg.hgtk import gdialog, gtklib
class BugReport(gdialog.GDialog):
"""GTK+ based dialog for displaying traceback info to the user in a
@@ -20,6 +20,8 @@
information like version numbers, etc.
"""
+ __error_text__ = None
+
def get_title(self):
return _('TortoiseHg Bug Report')
@@ -41,24 +43,39 @@
hbbox = gtk.HButtonBox()
hbbox.set_layout(gtk.BUTTONBOX_END)
vbox.pack_start(hbbox, False, False, 2)
+ save = gtk.Button(_('Save as..'))
+ save.connect('clicked', self.save_report_clicked)
+ hbbox.add(save)
close = gtk.Button(_('Close'))
close.connect('clicked', gtk.main_quit)
hbbox.add(close)
+ textview.get_buffer().set_text(self.get_error_text())
+ return vbox
- text = '{{{\n#!python\n' # Wrap in Bitbucket wiki preformat markers
- text += _('** Please report this bug to'
- ' tortoisehg-disc...@lists.sourceforge.net or'
- ' http://bitbucket.org/tortoisehg/stable/issues\n')
- text += '** Mercurial version (%s). TortoiseHg version (%s)\n' % (
- hglib.hgversion, version.version())
- text += '** Command: %s\n' % (self.opts['cmd'])
- text += '** CWD: %s\n' % os.getcwd()
- extlist = [x[0] for x in extensions.extensions()]
- text += '** Extensions loaded: %s\n' % ', '.join(extlist)
- text += self.opts['error']
- text += '\n}}}'
- textview.get_buffer().set_text(text)
- return vbox
+ def get_error_text(self):
+ if self.__error_text__ == None:
+ text = '{{{\n#!python\n' # Wrap in Bitbucket wiki preformat markers
+ text += _('** Please report this bug to'
+ ' tortoisehg-disc...@lists.sourceforge.net or'
+ ' http://bitbucket.org/tortoisehg/stable/issues\n')
+ text += '** Mercurial version (%s). TortoiseHg version (%s)\n' % (
+ hglib.hgversion, version.version())
+ text += '** Command: %s\n' % (self.opts['cmd'])
+ text += '** CWD: %s\n' % os.getcwd()
+ extlist = [x[0] for x in extensions.extensions()]
+ text += '** Extensions loaded: %s\n' % ', '.join(extlist)
+ text += self.opts['error']
+ text += '\n}}}'
+ self.__error_text__ = text
+ return self.__error_text__
+
+ def save_report_clicked(self, button):
+ file_path = gtklib.NativeSaveFileDialogWrapper(Title = _('Save error report to')).run()
+
+ if file_path:
+ fd = file(file_path, 'w')
+ fd.write(self.get_error_text())
+ fd.close()
def run(_ui, *pats, **opts):
return BugReport(_ui, None, None, None, opts)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop