From c9867cd599d4d0fa02383170f5a0a02d1e0af746 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 18 Aug 2013 11:17:53 +0530 Subject: [PATCH] Report errors during UI initialization Exceptions raised during UI initialization were not being reported to the user, leaving a partially functioning UI with no apparent cause. --- src/calibre/gui2/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index fc9c542b92..d6d6abcf26 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -177,7 +177,7 @@ class GuiRunner(QObject): def start_gui(self, db): from calibre.gui2.ui import Main - main = Main(self.opts, gui_debug=self.gui_debug) + main = self.main = Main(self.opts, gui_debug=self.gui_debug) if self.splash_screen is not None: self.splash_screen.showMessage(_('Initializing user interface...')) with gprefs: # Only write gui.json after initialization is complete @@ -199,7 +199,6 @@ class GuiRunner(QObject): for event in self.app.file_event_hook.events: add_filesystem_book(event) self.app.file_event_hook = add_filesystem_book - self.main = main def initialization_failed(self): print 'Catastrophic failure initializing GUI, bailing out...' @@ -231,7 +230,13 @@ class GuiRunner(QObject): det_msg=traceback.format_exc(), show=True) self.initialization_failed() - self.start_gui(db) + try: + self.start_gui(db) + except Exception: + error_dialog(self.main, _('Startup error'), + _('There was an error during {0} startup.' + ' Parts of {0} may not function. Click Show details to learn more.').format(__appname__), + det_msg=traceback.format_exc(), show=True) def initialize_db(self): from calibre.db import get_db_loader