Example #1
0
 def _showexceptiondialog(self):
     from tortoisehg.hgqt.bugreport import BugReport, ExceptionMsgBox
     opts = {}
     opts['cmd'] = ' '.join(sys.argv[1:])
     opts['error'] = ''.join(''.join(traceback.format_exception(*args))
                             for args in self.errors)
     etype, evalue = self.errors[0][:2]
     if len(self.errors) == 1 and etype in self._recoverableexc:
         opts['values'] = evalue
         errstr = self._recoverableexc[etype]
         if etype == error.Abort and evalue.hint:
             errstr = u''.join([errstr, u'<br><b>', _('hint:'),
                                u'</b> %(arg1)s'])
             opts['values'] = [str(evalue), evalue.hint]
         dlg = ExceptionMsgBox(hglib.tounicode(str(evalue)),
                               hglib.tounicode(errstr), opts,
                               parent=self._mainapp.activeWindow())
     elif etype is KeyboardInterrupt:
         if qtlib.QuestionMsgBox(_('Keyboard interrupt'),
                 _('Close this application?')):
             QApplication.quit()
         else:
             self.errors = []
             return
     else:
         dlg = BugReport(opts, parent=self._mainapp.activeWindow())
     dlg.exec_()
Example #2
0
 def _showexceptiondialog(self):
     from tortoisehg.hgqt.bugreport import BugReport, ExceptionMsgBox
     opts = {}
     opts['cmd'] = ' '.join(sys.argv[1:])
     opts['error'] = ''.join(''.join(traceback.format_exception(*args))
                             for args in self.errors)
     etype, evalue = self.errors[0][:2]
     if (len(set(e[0] for e in self.errors)) == 1
             and etype in self._recoverableexc):
         opts['values'] = evalue
         errstr = self._recoverableexc[etype]
         if etype is error.Abort and evalue.hint:
             errstr = u''.join(
                 [errstr, u'<br><b>',
                  _('hint:'), u'</b> %(arg1)s'])
             opts['values'] = [str(evalue), evalue.hint]
         dlg = ExceptionMsgBox(hglib.tounicode(str(evalue)),
                               hglib.tounicode(errstr),
                               opts,
                               parent=self._mainapp.activeWindow())
     elif etype is KeyboardInterrupt:
         if qtlib.QuestionMsgBox(
                 hglib.tounicode(_('Keyboard interrupt')),
                 hglib.tounicode(_('Close this application?'))):
             QApplication.quit()
         else:
             self.errors = []
             return
     else:
         dlg = BugReport(opts, parent=self._mainapp.activeWindow())
     dlg.exec_()
Example #3
0
def dispatch(args):
    """run the command specified in args"""
    try:
        u = uimod.ui()
        if '--traceback' in args:
            u.setconfig('ui', 'traceback', 'on')
        if '--debugger' in args:
            pdb.set_trace()
        return _runcatch(u, args)
    except error.ParseError, e:
        from tortoisehg.hgqt.bugreport import ExceptionMsgBox
        opts = {}
        opts['cmd'] = ' '.join(sys.argv[1:])
        opts['values'] = e
        opts['error'] = traceback.format_exc()
        opts['nofork'] = True
        errstring = _('Error string "%(arg0)s" at %(arg1)s<br>Please '
                      '<a href="#edit:%(arg1)s">edit</a> your config')
        main = QApplication(sys.argv)
        dlg = ExceptionMsgBox(hglib.tounicode(str(e)), errstring, opts,
                              parent=None)
        dlg.exec_()
Example #4
0
def dispatch(args):
    """run the command specified in args"""
    try:
        u = uimod.ui()
        if '--traceback' in args:
            u.setconfig('ui', 'traceback', 'on')
        if '--debugger' in args:
            pdb.set_trace()
        return _runcatch(u, args)
    except error.ParseError, e:
        from tortoisehg.hgqt.bugreport import ExceptionMsgBox
        opts = {}
        opts['cmd'] = ' '.join(sys.argv[1:])
        opts['values'] = e
        opts['error'] = traceback.format_exc()
        opts['nofork'] = True
        errstring = _('Error string "%(arg0)s" at %(arg1)s<br>Please '
                      '<a href="#edit:%(arg1)s">edit</a> your config')
        main = QApplication(sys.argv)
        dlg = ExceptionMsgBox(hglib.tounicode(str(e)),
                              errstring,
                              opts,
                              parent=None)
        dlg.exec_()