handle database switches

svn: r6086
This commit is contained in:
Don Allingham 2006-03-06 03:54:58 +00:00
parent f036c5a44b
commit 51c1f0730a
2 changed files with 9 additions and 2 deletions

View File

@ -38,7 +38,7 @@ the database objects. Read the comments in _GrampsDBCallback.py for more
information. information.
""" """
from _GrampsDbBase import DbState from _GrampsDbBase import DbState, GrampsDbBase
from _GrampsDbFactories import \ from _GrampsDbFactories import \
gramps_db_factory, \ gramps_db_factory, \

View File

@ -713,7 +713,7 @@ class ViewManager:
def read_file(self,filename,callback=None): def read_file(self,filename,callback=None):
mode = "w" mode = "w"
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
if os.path.isdir(filename): if os.path.isdir(filename):
ErrorDialog(_('Cannot open database'), ErrorDialog(_('Cannot open database'),
_('The selected file is a directory, not ' _('The selected file is a directory, not '
@ -736,6 +736,13 @@ class ViewManager:
except: except:
print "could not change directory" print "could not change directory"
# emit the database change signal so the that models do not
# attempt to update the screen while we are loading the
# new data
self.state.emit('database-changed',(GrampsDb.GrampsDbBase(),))
try: try:
if self.load_database(filename,callback,mode=mode): if self.load_database(filename,callback,mode=mode):
if filename[-1] == '/': if filename[-1] == '/':