diff --git a/openlp.pyw b/openlp.pyw
index dfe973ceb..805181c11 100755
--- a/openlp.pyw
+++ b/openlp.pyw
@@ -29,12 +29,14 @@ import os
import sys
import logging
from optparse import OptionParser
+from traceback import format_exception
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
+from openlp.core.ui.exceptionform import ExceptionForm
from openlp.core.ui import SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager, VersionThread
@@ -144,6 +146,13 @@ class OpenLP(QtGui.QApplication):
VersionThread(self.mainWindow, app_version).start()
return self.exec_()
+ def hookException(self, exctype, value, traceback):
+ if not hasattr(self, u'exceptionForm'):
+ self.exceptionForm = ExceptionForm(self.mainWindow)
+ self.exceptionForm.exceptionTextEdit.setPlainText(
+ ''.join(format_exception(exctype, value, traceback)))
+ self.exceptionForm.exec_()
+
def main():
"""
The main function which parses command line options and then runs
@@ -194,7 +203,7 @@ def main():
language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language)
app.installTranslator(appTranslator)
-
+ sys.excepthook = app.hookException
sys.exit(app.run())
if __name__ == u'__main__':
diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py
new file mode 100644
index 000000000..28097e938
--- /dev/null
+++ b/openlp/core/ui/exceptiondialog.py
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import translate
+
+class Ui_ExceptionDialog(object):
+ def setupUi(self, exceptionDialog):
+ exceptionDialog.setObjectName(u'exceptionDialog')
+ exceptionDialog.resize(580, 407)
+ self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog)
+ self.exceptionLayout.setSpacing(8)
+ self.exceptionLayout.setMargin(8)
+ self.exceptionLayout.setObjectName(u'exceptionLayout')
+ self.messageLayout = QtGui.QHBoxLayout()
+ self.messageLayout.setSpacing(0)
+ self.messageLayout.setContentsMargins(0, -1, 0, -1)
+ self.messageLayout.setObjectName(u'messageLayout')
+ self.bugLabel = QtGui.QLabel(exceptionDialog)
+ self.bugLabel.setMinimumSize(QtCore.QSize(64, 64))
+ self.bugLabel.setMaximumSize(QtCore.QSize(64, 64))
+ self.bugLabel.setText(u'')
+ self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
+ self.bugLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.bugLabel.setObjectName(u'bugLabel')
+ self.messageLayout.addWidget(self.bugLabel)
+ self.messageLabel = QtGui.QLabel(exceptionDialog)
+ self.messageLabel.setWordWrap(True)
+ self.messageLabel.setObjectName(u'messageLabel')
+ self.messageLayout.addWidget(self.messageLabel)
+ self.exceptionLayout.addLayout(self.messageLayout)
+ self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
+ self.exceptionTextEdit.setReadOnly(True)
+ self.exceptionTextEdit.setBackgroundVisible(False)
+ self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
+ self.exceptionLayout.addWidget(self.exceptionTextEdit)
+ self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog)
+ self.exceptionButtonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
+ self.exceptionButtonBox.setObjectName(u'exceptionButtonBox')
+ self.exceptionLayout.addWidget(self.exceptionButtonBox)
+
+ self.retranslateUi(exceptionDialog)
+ QtCore.QObject.connect(self.exceptionButtonBox,
+ QtCore.SIGNAL(u'accepted()'), exceptionDialog.accept)
+ QtCore.QObject.connect(self.exceptionButtonBox,
+ QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject)
+ QtCore.QMetaObject.connectSlotsByName(exceptionDialog)
+
+ def retranslateUi(self, exceptionDialog):
+ exceptionDialog.setWindowTitle(
+ translate('OpenLP.ExceptionDialog', 'Error Occured'))
+ self.messageLabel.setText(translate('OpenLP.ExceptionDialog', '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.'))
diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py
new file mode 100644
index 000000000..d181ad0d1
--- /dev/null
+++ b/openlp/core/ui/exceptionform.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+
+from PyQt4 import QtCore, QtGui
+
+from exceptiondialog import Ui_ExceptionDialog
+from openlp.core.lib import translate
+
+class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
+ """
+ The exception dialog
+ """
+ def __init__(self, parent):
+ QtGui.QDialog.__init__(self, parent)
+ self.setupUi(self)
diff --git a/resources/forms/exceptiondialog.ui b/resources/forms/exceptiondialog.ui
new file mode 100644
index 000000000..f6f15cdc7
--- /dev/null
+++ b/resources/forms/exceptiondialog.ui
@@ -0,0 +1,130 @@
+
+
+ ExceptionDialog
+
+
+
+ 0
+ 0
+ 580
+ 407
+
+
+
+ Dialog
+
+
+
+ 8
+
+
+ 8
+
+ -
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 64
+ 64
+
+
+
+
+ 64
+ 64
+
+
+
+
+
+
+ :/graphics/exception.png
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 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.
+
+
+ true
+
+
+
+
+
+ -
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Close
+
+
+
+
+
+
+
+
+
+
+ exceptionButtonBox
+ accepted()
+ ExceptionDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ exceptionButtonBox
+ rejected()
+ ExceptionDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/resources/images/exception.png b/resources/images/exception.png
new file mode 100644
index 000000000..c7ace707e
Binary files /dev/null and b/resources/images/exception.png differ
diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc
index c9277c3cf..78d74cf7e 100644
--- a/resources/images/openlp-2.qrc
+++ b/resources/images/openlp-2.qrc
@@ -62,6 +62,7 @@
openlp-logo-256x256.png
+ exception.png
openlp-about-logo.png
openlp-splash-screen.png