From b4f5e1d1984be685906230fdfbb2e70db7070de8 Mon Sep 17 00:00:00 2001 From: Zach Tibbitts Date: Thu, 1 Mar 2007 22:43:25 +0000 Subject: [PATCH] load blank_state if restoring session screws up --- src/delugegtk.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/delugegtk.py b/src/delugegtk.py index 9ac537aa4..3d0ded7fe 100644 --- a/src/delugegtk.py +++ b/src/delugegtk.py @@ -45,7 +45,17 @@ class DelugeGTK: f.flush() f.close() #Start the Deluge Manager: - self.manager = deluge.Manager("DE", "0490", "Deluge 0.4.90.1", dcommon.CONFIG_DIR) + p = "DE" + v = "0490" + s = "Deluge 0.4.90.2" + try: + self.manager = deluge.Manager(p, v, s, dcommon.CONFIG_DIR) + except AssertionError: + # If something goes wrong while restoring the session, then load + # a blank state rather than crash and exit + self.manager = deluge.Manager(p, v, s, dcommon.CONFIG_DIR, blank_slate=True) + self.something_screwed_up = True + else: self.something_screwed_up = False self.plugins = delugeplugins.PluginManager(self.manager, self) self.plugins.add_plugin_dir(dcommon.PLUGIN_DIR) if os.path.isdir(dcommon.CONFIG_DIR + '/plugins'): @@ -611,6 +621,11 @@ class DelugeGTK: except AttributeError: return False + if self.something_screwed_up: + dgtk.show_popup_warning(self.window, "For some reason, the previous state could not be loaded, " + \ + "so a blank state has been loaded for you.") + self.something_screwed_up = False + # Update Statusbar and Tray Tips core_state = self.manager.get_state() connections = core_state['num_peers']