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.height_key = None
self.__refs_for_deletion = [] 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() uistate.gwm.get_item_from_id(window_key).present()
raise Errors.WindowActiveError('This window is already active') raise Errors.WindowActiveError('This window is already active')
else: else:
@ -363,7 +363,10 @@ class ManagedWindow(object):
self.submenu_label = submenu_label self.submenu_label = submenu_label
self.menu_label = menu_label self.menu_label = menu_label
self.uistate = uistate 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 # Work out parent_window
if len(self.track) > 1: if len(self.track) > 1:
# We don't belong to the lop level # We don't belong to the lop level
@ -383,7 +386,10 @@ class ManagedWindow(object):
parent_item_track).window parent_item_track).window
else: else:
# On the top level: we use gramps top window # 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): def set_window(self, window, title, text, msg=None, isWindow=False):
""" """

View File

@ -227,9 +227,11 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
self.label = _('Database Verify tool') self.label = _('Database Verify tool')
self.vr = None
tool.Tool.__init__(self, dbstate, options_class, name) tool.Tool.__init__(self, dbstate, options_class, name)
ManagedWindow.__init__(self, uistate,[], self.__class__) 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 self.dbstate = dbstate
if uistate: if uistate:
@ -326,7 +328,8 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback):
self.options.handler.options_dict.iteritems(): self.options.handler.options_dict.iteritems():
exec '%s = %s' % (option, value) 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.set_total(self.db.get_number_of_people() +
self.db.get_number_of_families()) self.db.get_number_of_families())