Fix up exception form

This commit is contained in:
Tim Bentley 2011-02-03 17:11:20 +00:00
parent 4f3e71e268
commit c0de5cfd88
4 changed files with 170 additions and 78 deletions

View File

@ -196,6 +196,7 @@ class OpenLP(QtGui.QApplication):
self.mainWindow.repaint() self.mainWindow.repaint()
update_check = QtCore.QSettings().value( update_check = QtCore.QSettings().value(
u'general/update check', QtCore.QVariant(True)).toBool() u'general/update check', QtCore.QVariant(True)).toBool()
a=c
if update_check: if update_check:
VersionThread(self.mainWindow, app_version).start() VersionThread(self.mainWindow, app_version).start()
return self.exec_() return self.exec_()

View File

@ -46,6 +46,15 @@ class Ui_ExceptionDialog(object):
self.messageLabel.setObjectName(u'messageLabel') self.messageLabel.setObjectName(u'messageLabel')
self.messageLayout.addWidget(self.messageLabel) self.messageLayout.addWidget(self.messageLabel)
self.exceptionLayout.addLayout(self.messageLayout) self.exceptionLayout.addLayout(self.messageLayout)
self.descriptionExplanation = QtGui.QLabel(exceptionDialog)
self.descriptionExplanation.setObjectName(u'descriptionExplanation')
self.exceptionLayout.addWidget(self.descriptionExplanation)
self.descriptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
self.descriptionTextEdit.setObjectName(u'descriptionTextEdit')
self.exceptionLayout.addWidget(self.descriptionTextEdit)
self.descriptionWordCount = QtGui.QLabel(exceptionDialog)
self.descriptionWordCount.setObjectName(u'descriptionWordCount')
self.exceptionLayout.addWidget(self.descriptionWordCount)
self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog) self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
self.exceptionTextEdit.setReadOnly(True) self.exceptionTextEdit.setReadOnly(True)
self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
@ -65,19 +74,31 @@ class Ui_ExceptionDialog(object):
self.saveReportButton.setObjectName(u'saveReportButton') self.saveReportButton.setObjectName(u'saveReportButton')
self.exceptionButtonBox.addButton(self.saveReportButton, self.exceptionButtonBox.addButton(self.saveReportButton,
QtGui.QDialogButtonBox.ActionRole) QtGui.QDialogButtonBox.ActionRole)
self.attachFileButton = QtGui.QPushButton(exceptionDialog)
self.attachFileButton.setIcon(build_icon(u':/general/general_open.png'))
self.attachFileButton.setObjectName(u'attachFileButton')
self.exceptionButtonBox.addButton(self.attachFileButton,
QtGui.QDialogButtonBox.ActionRole)
self.retranslateUi(exceptionDialog) self.retranslateUi(exceptionDialog)
QtCore.QObject.connect(self.descriptionTextEdit,
QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated)
QtCore.QObject.connect(self.exceptionButtonBox, QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject) QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject)
QtCore.QObject.connect(self.sendReportButton, QtCore.QObject.connect(self.sendReportButton,
QtCore.SIGNAL(u'pressed()'), self.onSendReportButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onSendReportButtonPressed)
QtCore.QObject.connect(self.saveReportButton, QtCore.QObject.connect(self.saveReportButton,
QtCore.SIGNAL(u'pressed()'), self.onSaveReportButtonPressed) QtCore.SIGNAL(u'pressed()'), self.onSaveReportButtonPressed)
QtCore.QObject.connect(self.attachFileButton,
QtCore.SIGNAL(u'pressed()'), self.onAttachFileButtonPressed)
QtCore.QMetaObject.connectSlotsByName(exceptionDialog) QtCore.QMetaObject.connectSlotsByName(exceptionDialog)
def retranslateUi(self, exceptionDialog): def retranslateUi(self, exceptionDialog):
exceptionDialog.setWindowTitle( exceptionDialog.setWindowTitle(
translate('OpenLP.ExceptionDialog', 'Error Occurred')) translate('OpenLP.ExceptionDialog', 'Error Occurred'))
self.descriptionExplanation.setText(translate('OpenLP.ExceptionDialog',
'Please enter a description of what you were doing to cause this '
'error'))
self.messageLabel.setText(translate('OpenLP.ExceptionDialog', 'Oops! ' self.messageLabel.setText(translate('OpenLP.ExceptionDialog', 'Oops! '
'OpenLP hit a problem, and couldn\'t recover. The text in the box ' 'OpenLP hit a problem, and couldn\'t recover. The text in the box '
'below contains information that might be helpful to the OpenLP ' 'below contains information that might be helpful to the OpenLP '
@ -88,3 +109,5 @@ class Ui_ExceptionDialog(object):
'Send E-Mail')) 'Send E-Mail'))
self.saveReportButton.setText(translate('OpenLP.ExceptionDialog', self.saveReportButton.setText(translate('OpenLP.ExceptionDialog',
'Save to File')) 'Save to File'))
self.attachFileButton.setText(translate('OpenLP.ExceptionDialog',
'Attach File'))

View File

@ -70,8 +70,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
self.setupUi(self) self.setupUi(self)
self.settingsSection = u'crashreport' self.settingsSection = u'crashreport'
def exec_(self):
self.onDescriptionUpdated()
return QtGui.QDialog.exec_(self)
def _createReport(self): def _createReport(self):
openlp_version = self.parent().applicationVersion[u'full'] openlp_version = self.parent().applicationVersion[u'full']
description = unicode(self.descriptionTextEdit.toPlainText())
traceback = unicode(self.exceptionTextEdit.toPlainText()) traceback = unicode(self.exceptionTextEdit.toPlainText())
system = unicode(translate('OpenLP.ExceptionForm', system = unicode(translate('OpenLP.ExceptionForm',
'Platform: %s\n')) % platform.platform() 'Platform: %s\n')) % platform.platform()
@ -90,7 +95,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
system = system + u'Desktop: KDE SC\n' system = system + u'Desktop: KDE SC\n'
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'): elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
system = system + u'Desktop: GNOME\n' system = system + u'Desktop: GNOME\n'
return (openlp_version, traceback, system, libraries) return (openlp_version, description, traceback, system, libraries)
def onSaveReportButtonPressed(self): def onSaveReportButtonPressed(self):
""" """
@ -99,6 +104,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
report = unicode(translate('OpenLP.ExceptionForm', report = unicode(translate('OpenLP.ExceptionForm',
'**OpenLP Bug Report**\n' '**OpenLP Bug Report**\n'
'Version: %s\n\n' 'Version: %s\n\n'
'--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')) '--- Library Versions ---\n%s\n'))
@ -129,10 +135,11 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
Opening systems default email client and inserting exception log and Opening systems default email client and inserting exception log and
system informations. system informations.
""" """
attach = None
body = unicode(translate('OpenLP.ExceptionForm', body = unicode(translate('OpenLP.ExceptionForm',
'*OpenLP Bug Report*\n' '*OpenLP Bug Report*\n'
'Version: %s\n\n' 'Version: %s\n\n'
'--- Please enter the report below this line. ---\n\n\n' '--- Details of the Exception. ---\n\n%s\n\n '
'--- Exception Traceback ---\n%s\n' '--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n' '--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n', '--- Library Versions ---\n%s\n',
@ -145,5 +152,20 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
if u':' in line: if u':' in line:
exception = line.split(u'\n')[-1].split(u':')[0] exception = line.split(u'\n')[-1].split(u':')[0]
subject = u'Bug report: %s in %s' % (exception, source) subject = u'Bug report: %s in %s' % (exception, source)
mailto(address=u'bugs@openlp.org', subject=subject, if attach:
body=body % content) mailto(address=u'bugs@openlp.org', subject=subject,
body=body % content, attach=attach)
else:
mailto(address=u'bugs@openlp.org', subject=subject,
body=body % content)
def onDescriptionUpdated(self):
count = int(20 - len(self.descriptionTextEdit.toPlainText()))
if count < 0:
count = 0
self.descriptionWordCount.setText(
unicode(translate('OpenLP.ExceptionDialog',
'Characters to Enter : %s')) % count )
def onAttachFileButtonPressed(self):
print self.descriptionTextEdit.toPlainText()

View File

@ -13,82 +13,128 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="exceptionLayout"> <widget class="QPlainTextEdit" name="exceptionTextEdit">
<property name="spacing"> <property name="geometry">
<number>8</number> <rect>
<x>8</x>
<y>194</y>
<width>564</width>
<height>171</height>
</rect>
</property> </property>
<property name="margin"> <property name="readOnly">
<number>8</number> <bool>true</bool>
</property> </property>
<item> <property name="backgroundVisible">
<layout class="QHBoxLayout" name="messageLayout"> <bool>false</bool>
<property name="spacing"> </property>
<number>0</number> </widget>
</property> <widget class="QDialogButtonBox" name="exceptionButtonBox">
<property name="leftMargin"> <property name="geometry">
<number>0</number> <rect>
</property> <x>8</x>
<property name="rightMargin"> <y>373</y>
<number>0</number> <width>83</width>
</property> <height>26</height>
<item> </rect>
<widget class="QLabel" name="bugLabel"> </property>
<property name="minimumSize"> <property name="orientation">
<size> <enum>Qt::Horizontal</enum>
<width>64</width> </property>
<height>64</height> <property name="standardButtons">
</size> <set>QDialogButtonBox::Close</set>
</property> </property>
<property name="maximumSize"> </widget>
<size> <widget class="QPlainTextEdit" name="discriptionplainTextEdit">
<width>64</width> <property name="geometry">
<height>64</height> <rect>
</size> <x>8</x>
</property> <y>103</y>
<property name="text"> <width>561</width>
<string/> <height>71</height>
</property> </rect>
<property name="pixmap"> </property>
<pixmap resource="../images/openlp-2.qrc">:/graphics/exception.png</pixmap> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<property name="alignment"> <horstretch>0</horstretch>
<set>Qt::AlignCenter</set> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> </widget>
<item> <widget class="QLabel" name="characterCount">
<widget class="QLabel" name="messageLabel"> <property name="geometry">
<property name="text"> <rect>
<string>Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs@openlp.org, along with a detailed description of what you were doing when the problem occurred.</string> <x>10</x>
</property> <y>170</y>
<property name="wordWrap"> <width>301</width>
<bool>true</bool> <height>17</height>
</property> </rect>
</widget> </property>
</item> <property name="text">
</layout> <string>TextLabel</string>
</item> </property>
<item> </widget>
<widget class="QPlainTextEdit" name="exceptionTextEdit"> <widget class="QLabel" name="whatyouweredoinglabel">
<property name="readOnly"> <property name="geometry">
<bool>true</bool> <rect>
</property> <x>10</x>
<property name="backgroundVisible"> <y>80</y>
<bool>false</bool> <width>59</width>
</property> <height>17</height>
</widget> </rect>
</item> </property>
<item> <property name="text">
<widget class="QDialogButtonBox" name="exceptionButtonBox"> <string>TextLabel</string>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> </widget>
</property> <widget class="QWidget" name="">
<property name="standardButtons"> <layout class="QHBoxLayout" name="messageLayout">
<set>QDialogButtonBox::Close</set> <property name="spacing">
</property> <number>0</number>
</widget> </property>
</item> <property name="leftMargin">
</layout> <number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="bugLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images/openlp-2.qrc">:/graphics/exception.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="messageLabel">
<property name="text">
<string>Oops! OpenLP hit a problem, and couldn't recover. The text in the box below contains information that might be helpful to the OpenLP developers, so please e-mail it to bugs@openlp.org, along with a detailed description of what you were doing when the problem occurred.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<resources> <resources>
<include location="../images/openlp-2.qrc"/> <include location="../images/openlp-2.qrc"/>