From 7d6113cf38126fd9d3833175b85def299114c04b Mon Sep 17 00:00:00 2001 From: prculley Date: Sat, 18 Jan 2020 14:02:20 -0600 Subject: [PATCH] Speed up Place Reference Editor and Listview for enclose place Fixes #11531 --- gramps/gui/editors/editplaceref.py | 7 +++++-- gramps/gui/views/listview.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index 34d2e2619..8e9c4f2f5 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -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 diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index c1d4ba3e9..fbe5f2fd0 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -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)