Source

thg-keyboard-friendly / hggtk / bugreport.py

#
# bugreport.py - Bug report dialog for TortoiseHg
#
# Copyright (C) 2009 Steve Borho <steve@borho.org>
#

import os
import gtk
import pango

from mercurial import extensions
from thgutil.i18n import _
from thgutil import hglib, version
from hggtk import gdialog

class BugReport(gdialog.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_shadow_type(gtk.SHADOW_IN)
        scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroller.add(textview)
        scroller.set_border_width(5)
        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)

        text = '\n{{{\n' # Wrap in Bitbucket wiki preformat markers
        text += _('** Please report this bug to'
                ' tortoisehg-discuss@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}}}\n'
        textview.get_buffer().set_text(text)
        return vbox

def run(_ui, *pats, **opts):
    return BugReport(_ui, None, None, None, opts)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.