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

View File

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