diff --git a/openlp.pyw b/openlp.pyw index 805181c11..80b49321e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -147,6 +147,9 @@ class OpenLP(QtGui.QApplication): return self.exec_() def hookException(self, exctype, value, traceback): + if not hasattr(self, u'mainWindow'): + log.exception(''.join(format_exception(exctype, value, traceback))) + return if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm.exceptionTextEdit.setPlainText( @@ -159,18 +162,18 @@ def main(): the PyQt4 Application. """ # Set up command line options. - usage = u'Usage: %prog [options] [qt-options]' + usage = 'Usage: %prog [options] [qt-options]' parser = OptionParser(usage=usage) - parser.add_option("-l", "--log-level", dest="loglevel", - default="warning", metavar="LEVEL", - help="Set logging to LEVEL level. Valid values are " - "\"debug\", \"info\", \"warning\".") - parser.add_option("-p", "--portable", dest="portable", - action="store_true", - help="Specify if this should be run as a portable app, " - "off a USB flash drive.") - parser.add_option("-s", "--style", dest="style", - help="Set the Qt4 style (passed directly to Qt4).") + parser.add_option('-e', '--no-error-form', dest='no_error_form', + action='store_true', help='Disable the error notification form.') + parser.add_option('-l', '--log-level', dest='loglevel', + default='warning', metavar='LEVEL', help='Set logging to LEVEL ' + 'level. Valid values are "debug", "info", "warning".') + parser.add_option('-p', '--portable', dest='portable', + action='store_true', help='Specify if this should be run as a ' + 'portable app, off a USB flash drive (not implemented).') + parser.add_option('-s', '--style', dest='style', + help='Set the Qt4 style (passed directly to Qt4).') # Set up logging log_path = AppLocation.get_directory(AppLocation.CacheDir) if not os.path.exists(log_path): @@ -203,7 +206,8 @@ def main(): language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) - sys.excepthook = app.hookException + if not options.no_error_form: + sys.excepthook = app.hookException sys.exit(app.run()) if __name__ == u'__main__': diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 1f911491f..b325f0c6c 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -38,63 +38,48 @@ log = logging.getLogger(__name__) # TODO make external and configurable in alpha 4 via a settings dialog html_expands = [] -html_expands.append({u'desc':u'Red', u'start tag':u'{r}', \ - u'start html':u'', \ - u'end tag':u'{/r}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Black', u'start tag':u'{b}', \ - u'start html':u'', \ - u'end tag':u'{/b}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', \ - u'start html':u'', \ - u'end tag':u'{/bl}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', \ - u'start html':u'', \ - u'end tag':u'{/y}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Green', u'start tag':u'{g}', \ - u'start html':u'', \ - u'end tag':u'{/g}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', \ - u'start html':u'', \ - u'end tag':u'{/pk}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', \ - u'start html':u'', \ - u'end tag':u'{/o}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', \ - u'start html':u'', \ - u'end tag':u'{/pp}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'White', u'start tag':u'{w}', \ - u'start html':u'', \ - u'end tag':u'{/w}', u'end html':u'', \ - u'protected':False}) -html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', \ - u'start html':u'', \ - u'end tag':u'{/su}', u'end html':u'', \ - u'protected':True}) -html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', \ - u'start html':u'', \ - u'end tag':u'{/sb}', u'end html':u'', \ - u'protected':True}) -html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', \ - u'start html':u'

', \ - u'end tag':u'{/p}', u'end html':u'

', \ - u'protected':True}) -html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', \ - u'start html':u'', \ - u'end tag':u'{/st}', \ - u'end html':u'', \ - u'protected':True}) -html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', \ - u'start html':u'', \ - u'end tag':u'{/it}', u'end html':u'', \ - u'protected':True}) +html_expands.append({u'desc':u'Red', u'start tag':u'{r}', + u'start html':u'', + u'end tag':u'{/r}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Black', u'start tag':u'{b}', + u'start html':u'', + u'end tag':u'{/b}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', + u'start html':u'', + u'end tag':u'{/bl}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', + u'start html':u'', + u'end tag':u'{/y}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Green', u'start tag':u'{g}', + u'start html':u'', + u'end tag':u'{/g}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', + u'start html':u'', + u'end tag':u'{/pk}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', + u'start html':u'', + u'end tag':u'{/o}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', + u'start html':u'', + u'end tag':u'{/pp}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'White', u'start tag':u'{w}', + u'start html':u'', + u'end tag':u'{/w}', u'end html':u'', u'protected':False}) +html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', + u'start html':u'', u'end tag':u'{/su}', u'end html':u'', + u'protected':True}) +html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', + u'start html':u'', u'end tag':u'{/sb}', u'end html':u'', + u'protected':True}) +html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', + u'start html':u'

', u'end tag':u'{/p}', u'end html':u'

', + u'protected':True}) +html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', + u'start html':u'', u'end tag':u'{/st}', u'end html':u'', + u'protected':True}) +html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', + u'start html':u'', u'end tag':u'{/it}', u'end html':u'', + u'protected':True}) def translate(context, text, comment=None): """ diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 7f4fc5082..906ebb987 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -81,17 +81,14 @@ body {