From a84b54901aff08a9c9eb6e767cf4c9627e877496 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 15 Oct 2010 16:58:41 +0000 Subject: [PATCH] 4273: Error during execution of CLI command (part 1, Verify) svn: r15990 --- src/ManagedWindow.py | 12 +++++++++--- src/plugins/tool/Verify.py | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index 4b7d9b0c4..b840b4740 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -355,7 +355,7 @@ class ManagedWindow(object): self.height_key = None self.__refs_for_deletion = [] - if uistate.gwm.get_item_from_id(window_key): + if uistate and uistate.gwm.get_item_from_id(window_key): uistate.gwm.get_item_from_id(window_key).present() raise Errors.WindowActiveError('This window is already active') else: @@ -363,7 +363,10 @@ class ManagedWindow(object): self.submenu_label = submenu_label self.menu_label = menu_label self.uistate = uistate - self.track = self.uistate.gwm.add_item(track, self) + if uistate: + self.track = self.uistate.gwm.add_item(track, self) + else: + self.track = [] # Work out parent_window if len(self.track) > 1: # We don't belong to the lop level @@ -383,7 +386,10 @@ class ManagedWindow(object): parent_item_track).window else: # On the top level: we use gramps top window - self.parent_window = self.uistate.window + if self.uistate: + self.parent_window = self.uistate.window + else: + self.parent_window = None def set_window(self, window, title, text, msg=None, isWindow=False): """ diff --git a/src/plugins/tool/Verify.py b/src/plugins/tool/Verify.py index 7a8fbeb0e..2f7bfcc1a 100644 --- a/src/plugins/tool/Verify.py +++ b/src/plugins/tool/Verify.py @@ -227,9 +227,11 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback): def __init__(self, dbstate, uistate, options_class, name, callback=None): self.label = _('Database Verify tool') + self.vr = None tool.Tool.__init__(self, dbstate, options_class, name) ManagedWindow.__init__(self, uistate,[], self.__class__) - UpdateCallback.__init__(self, self.uistate.pulse_progressbar) + if uistate: + UpdateCallback.__init__(self, self.uistate.pulse_progressbar) self.dbstate = dbstate if uistate: @@ -326,7 +328,8 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback): self.options.handler.options_dict.iteritems(): exec '%s = %s' % (option, value) - self.vr.real_model.clear() + if self.vr: + self.vr.real_model.clear() self.set_total(self.db.get_number_of_people() + self.db.get_number_of_families())