4273: Error during execution of CLI command (part 1, Verify)

svn: r15990
This commit is contained in:
Doug Blank 2010-10-15 16:58:41 +00:00
parent 9c89c72ca8
commit a84b54901a
2 changed files with 14 additions and 5 deletions

View File

@ -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
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
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):
"""

View File

@ -227,8 +227,10 @@ 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__)
if uistate:
UpdateCallback.__init__(self, self.uistate.pulse_progressbar)
self.dbstate = dbstate
@ -326,6 +328,7 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback):
self.options.handler.options_dict.iteritems():
exec '%s = %s' % (option, value)
if self.vr:
self.vr.real_model.clear()
self.set_total(self.db.get_number_of_people() +