Fix Session Log for exception on closed db reference click

This commit is contained in:
prculley 2017-11-07 14:10:03 -06:00 committed by Nick Hall
parent 45e0b9d571
commit f9da7ec19a
2 changed files with 14 additions and 0 deletions

View File

@ -638,6 +638,8 @@ class GuiGramplet:
for (tag, link_type, handle, tooltip) in self._tags:
if iter.has_tag(tag):
if link_type == 'Person':
if not self.dbstate.db.has_person_handle(handle):
return True
person = self.dbstate.db.get_person_from_handle(handle)
if person is not None:
if event.button == 1: # left mouse
@ -699,6 +701,8 @@ class GuiGramplet:
display_help(handle)
return True
elif link_type == 'Family':
if not self.dbstate.db.has_family_handle(handle):
return True
family = self.dbstate.db.get_family_from_handle(handle)
if family is not None:
if event.button == 1: # left mouse

View File

@ -69,11 +69,17 @@ class LogGramplet(Gramplet):
lambda handles: self.log('Family', 'Deleted', handles))
self.connect(self.dbstate.db, 'family-update',
lambda handles: self.log('Family', 'Edited', handles))
self.connect_signal('Person', self.active_changed)
self.connect_signal('Family', self.active_changed_family)
def active_changed(self, handle):
if handle:
self.log('Person', 'Selected', [handle])
def active_changed_family(self, handle):
if handle:
self.log('Family', 'Selected', [handle])
def log(self, ltype, action, handles):
for handle in set(handles):
if self.last_log == (ltype, action, handle):
@ -90,6 +96,8 @@ class LogGramplet(Gramplet):
for i in transaction.get_recnos(reverse=True):
(obj_type, trans_type, hndl, old_data, dummy) = \
transaction.get_record(i)
if isinstance(hndl, bytes):
hndl = str(hndl, "utf-8")
if (obj_type == PERSON_KEY and trans_type == TXNDEL
and hndl == handle):
person = Person()
@ -102,6 +110,8 @@ class LogGramplet(Gramplet):
for i in transaction.get_recnos(reverse=True):
(obj_type, trans_type, hndl, old_data, dummy) = \
transaction.get_record(i)
if isinstance(hndl, bytes):
hndl = str(hndl, "utf-8")
if (obj_type == FAMILY_KEY and trans_type == TXNDEL
and hndl == handle):
family = Family()