GTK3: errors in callbacks when changing family trees.
This was very hard to debug, the signalling at the moment seems inconsistent. Committing this patch now to avoid problems testing further svn: r20296
This commit is contained in:
parent
8c092746f0
commit
2527c24014
@ -145,15 +145,14 @@ class CLIDbLoader(object):
|
|||||||
mode = 'w'
|
mode = 'w'
|
||||||
|
|
||||||
dbclass = DbBsddb
|
dbclass = DbBsddb
|
||||||
|
dbclass.disable_signals()
|
||||||
self.dbstate.change_database(dbclass())
|
|
||||||
self.dbstate.db.disable_signals()
|
|
||||||
|
|
||||||
self._begin_progress()
|
self._begin_progress()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.dbstate.db.load(filename, self._pulse_progress, mode)
|
dbclass.load(filename, self._pulse_progress, mode)
|
||||||
self.dbstate.db.set_save_path(filename)
|
dbclass.set_save_path(filename)
|
||||||
|
self.dbstate.change_database(dbclass())
|
||||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
|
@ -55,6 +55,7 @@ class DbState(Callback):
|
|||||||
Closes the existing db, and opens a new one.
|
Closes the existing db, and opens a new one.
|
||||||
Retained for backward compatibility.
|
Retained for backward compatibility.
|
||||||
"""
|
"""
|
||||||
|
self.emit('no-database', ())
|
||||||
self.db.close()
|
self.db.close()
|
||||||
self.change_database_noclose(database)
|
self.change_database_noclose(database)
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ class DbState(Callback):
|
|||||||
config.get('preferences.rprefix'),
|
config.get('preferences.rprefix'),
|
||||||
config.get('preferences.nprefix') )
|
config.get('preferences.nprefix') )
|
||||||
self.open = True
|
self.open = True
|
||||||
|
self.signal_change()
|
||||||
|
|
||||||
def signal_change(self):
|
def signal_change(self):
|
||||||
"""
|
"""
|
||||||
@ -85,6 +87,7 @@ class DbState(Callback):
|
|||||||
"""
|
"""
|
||||||
Closes the database without a new database
|
Closes the database without a new database
|
||||||
"""
|
"""
|
||||||
|
self.emit('no-database', ())
|
||||||
self.db.close()
|
self.db.close()
|
||||||
self.db = DbBsddbRead()
|
self.db = DbBsddbRead()
|
||||||
self.db.db_is_open = False
|
self.db.db_is_open = False
|
||||||
|
@ -291,23 +291,28 @@ class DbLoader(CLIDbLoader):
|
|||||||
else:
|
else:
|
||||||
mode = 'w'
|
mode = 'w'
|
||||||
|
|
||||||
self.dbstate.change_database(gen.db.DbBsddb())
|
db = gen.db.DbBsddb()
|
||||||
self.dbstate.db.disable_signals()
|
db.disable_signals()
|
||||||
|
self.dbstate.no_database()
|
||||||
|
|
||||||
self._begin_progress()
|
self._begin_progress()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
self.dbstate.db.load(filename, self._pulse_progress,
|
db.load(filename, self._pulse_progress,
|
||||||
mode, upgrade=False)
|
mode, upgrade=False)
|
||||||
|
self.dbstate.change_database(db)
|
||||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
||||||
if QuestionDialog2(_("Need to upgrade database!"),
|
if QuestionDialog2(_("Need to upgrade database!"),
|
||||||
str(msg),
|
str(msg),
|
||||||
_("Upgrade now"),
|
_("Upgrade now"),
|
||||||
_("Cancel")).run():
|
_("Cancel")).run():
|
||||||
self.dbstate.db.load(filename, self._pulse_progress,
|
db = gen.db.DbBsddb()
|
||||||
|
db.disable_signals()
|
||||||
|
db.load(filename, self._pulse_progress,
|
||||||
mode, upgrade=True)
|
mode, upgrade=True)
|
||||||
self.dbstate.db.set_save_path(filename)
|
db.set_save_path(filename)
|
||||||
|
self.dbstate.change_database(db)
|
||||||
else:
|
else:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
except gen.db.exceptions.BsddbDowngradeError, msg:
|
except gen.db.exceptions.BsddbDowngradeError, msg:
|
||||||
|
@ -122,6 +122,11 @@ class ListView(NavigationView):
|
|||||||
dbstate.connect('database-changed', self.change_db)
|
dbstate.connect('database-changed', self.change_db)
|
||||||
self.connect_signals()
|
self.connect_signals()
|
||||||
|
|
||||||
|
def no_database(self):
|
||||||
|
self.list.set_model(None)
|
||||||
|
self.model = None
|
||||||
|
self.build_tree()
|
||||||
|
|
||||||
def type_list(self):
|
def type_list(self):
|
||||||
"""
|
"""
|
||||||
set the listtype, this governs eg keybinding
|
set the listtype, this governs eg keybinding
|
||||||
|
@ -128,7 +128,8 @@ class BasePersonView(ListView):
|
|||||||
'person-delete' : self.row_delete,
|
'person-delete' : self.row_delete,
|
||||||
'person-rebuild' : self.object_build,
|
'person-rebuild' : self.object_build,
|
||||||
'person-groupname-rebuild' : self.object_build,
|
'person-groupname-rebuild' : self.object_build,
|
||||||
'tag-update' : self.tag_updated
|
'tag-update' : self.tag_updated,
|
||||||
|
'no-database': self.no_database,
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView.__init__(
|
ListView.__init__(
|
||||||
|
Loading…
Reference in New Issue
Block a user