Speed up Place Reference Editor and Listview for enclose place

Fixes #11531
This commit is contained in:
prculley 2020-01-18 14:02:20 -06:00 committed by Paul Culley
parent cc7c0a3f13
commit 7d6113cf38
2 changed files with 8 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class EditPlaceRef(EditReference):
def __init__(self, state, uistate, track, place, place_ref, update):
EditReference.__init__(self, state, uistate, track, place, place_ref,
update)
self.original = place.serialize()
def _local_init(self):
@ -312,8 +313,10 @@ class EditPlaceRef(EditReference):
return
if self.source.handle:
with DbTxn(_("Modify Place"), self.db) as trans:
self.db.commit_place(self.source, trans)
# only commit if it has changed
if self.source.serialize() != self.original:
with DbTxn(_("Modify Place"), self.db) as trans:
self.db.commit_place(self.source, trans)
else:
if self.check_for_duplicate_id('Place'):
return

View File

@ -846,6 +846,9 @@ class ListView(NavigationView):
for cl_name, handle in self.dbstate.db.find_backlink_handles(hndl):
if cl_name == nav_type:
upd_list.append(handle)
if len(upd_list) > 20:
self.dirty = True
return
if (cl_name == 'Place' or cl_name == 'Event' and
nav_type == 'Person'):
queue.append(handle)