Ejemplo n.º 1
0
    def sendBugReport(self):
        if not self._excInfoSet():
            exctype, excvalue, tracebackobj = sys.exc_info()
        else:
            exctype = self.exctype
            excvalue = self.excvalue
            tracebackobj = self.tracebackobj

        error = traceback.format_exception_only(exctype, excvalue)[-1].strip()
        appname = QtWidgets.QApplication.applicationName()
        if appname:
            subject = '[%s] Bug report - %s' % (appname, error)
        else:
            subject = 'Bug report - %s' % error
        body = '[Please insert your comments and additional info here.]'
        body += '\n\n' + '-' * 80 + '\n'
        body += ''.join(utils.format_bugreport(
            exctype, excvalue, tracebackobj,
            extra_info=qtsupport.format_qt_info()))

        url = QtCore.QUrl('mailto:%s <%s>' % (info.author, info.author_email))
        url.addQueryItem('subject', subject)
        url.addQueryItem('body', body)

        ret = QtGui.QDesktopServices.openUrl(url)
        if not ret:
            msg = self.tr('Unable to send the bug-report.\n'
                          'Please save the bug-report on file and send it '
                          'manually.')
            QtWidgets.QMessageBox.warning(self, self.tr('WARNING'), msg)
Ejemplo n.º 2
0
    def sendBugReport(self):
        if not self._excInfoSet():
            exctype, excvalue, tracebackobj = sys.exc_info()
        else:
            exctype = self.exctype
            excvalue = self.excvalue
            tracebackobj = self.tracebackobj

        error = traceback.format_exception_only(exctype, excvalue)[-1].strip()
        appname = QtWidgets.QApplication.applicationName()
        if appname:
            subject = f'[{appname}] Bug report - {error}'
        else:
            subject = 'Bug report - %s' % error
        body = '[Please insert your comments and additional info here.]'
        body += '\n\n' + '-' * 80 + '\n'
        body += ''.join(
            utils.format_bugreport(exctype,
                                   excvalue,
                                   tracebackobj,
                                   extra_info=qtsupport.format_qt_info()))

        url = QtCore.QUrl(f'mailto:{info.author} <{info.author_email}>')
        url.addQueryItem('subject', subject)
        url.addQueryItem('body', body)

        ret = QtGui.QDesktopServices.openUrl(url)
        if not ret:
            msg = self.tr('Unable to send the bug-report.\n'
                          'Please save the bug-report on file and send it '
                          'manually.')
            QtWidgets.QMessageBox.warning(self, self.tr('WARNING'), msg)
Ejemplo n.º 3
0
    def saveBugReport(self):
        if not self._excInfoSet():
            exctype, excvalue, tracebackobj = sys.exc_info()
        else:
            exctype = self.exctype
            excvalue = self.excvalue
            tracebackobj = self.tracebackobj

        lines = utils.format_bugreport(exctype, excvalue, tracebackobj)
        report = ''.join(lines)
        filename, _ = QtWidgets.QFileDialog.getSaveFileName(self)
        if filename:
            fd = open(filename, 'w')
            try:
                fd.write(report)
            except Exception as e:
                msg = self.tr('Unable to save the bug-report:\n%s' % str(e))
                QtWidgets.QMessageBox.warning(self, self.tr('WARNING'), msg)
            finally:
                fd.close()
Ejemplo n.º 4
0
    def saveBugReport(self):
        if not self._excInfoSet():
            exctype, excvalue, tracebackobj = sys.exc_info()
        else:
            exctype = self.exctype
            excvalue = self.excvalue
            tracebackobj = self.tracebackobj

        lines = utils.format_bugreport(exctype, excvalue, tracebackobj)
        report = ''.join(lines)
        filename, _ = QtWidgets.QFileDialog.getSaveFileName(self)
        if filename:
            fd = open(filename, 'w')
            try:
                fd.write(report)
            except Exception as e:
                msg = self.tr('Unable to save the bug-report:\n%s' % str(e))
                QtWidgets.QMessageBox.warning(self, self.tr('WARNING'), msg)
            finally:
                fd.close()