From 64de2e6acf918fff99b0c7ae467275f2d7451cb3 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 20 Mar 2003 02:54:28 +0000 Subject: [PATCH] Faster load times for places svn: r1364 --- src/Date.py | 5 ++++- src/PlaceView.py | 11 +++++++++-- src/Witness.py | 2 +- src/gramps_main.py | 29 +++++++++++++++++++++++------ 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/Date.py b/src/Date.py index 7a7625969..35ee4b92d 100644 --- a/src/Date.py +++ b/src/Date.py @@ -372,7 +372,10 @@ class SingleDate: vals = string.split(v,'-') self.setYearVal(vals[0]) if len(vals) > 1: - self.setMonthVal(int(vals[1])) + try: + self.setMonthVal(int(vals[1])) + except: + self.month = UNDEF else: self.month = UNDEF if len(vals) > 2: diff --git a/src/PlaceView.py b/src/PlaceView.py index 61309d64e..bdf80be6f 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -110,7 +110,13 @@ class PlaceView: on large databases, and should only be called when absolutely necessary""" - self.model.clear() + self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING) self.id2col = {} for key in self.db.getPlaceKeys(): @@ -124,7 +130,8 @@ class PlaceView: 8, val[8], 9, val[9], 10, val[10], 11, val[11], 12, val[12] ) - self.list.connect('button-press-event',self.button_press) + self.list.set_model(self.model) + self.list.get_column(0).clicked() def merge(self): diff --git a/src/Witness.py b/src/Witness.py index 9ae2d6d78..8b8adf6d0 100644 --- a/src/Witness.py +++ b/src/Witness.py @@ -153,7 +153,7 @@ class WitnessEditor: else: self.ok.set_sensitive(0) else: - self.ok.set_sensitive(1) + self.ok.set_sensitive(1) def on_toggled(self,obj): if self.in_db.get_active(): diff --git a/src/gramps_main.py b/src/gramps_main.py index ad0ecb378..19cf5f23a 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -109,6 +109,7 @@ class Gramps: self.DataFilter = Filter.Filter("") self.parents_index = 0 self.active_person = None + self.place_loaded = 0 self.bookmarks = None self.c_details = 6 self.id2col = {} @@ -627,6 +628,7 @@ class Gramps: self.pedigree_view.clear() self.source_view.load_sources() self.place_view.load_places() + self.place_loaded = 0 self.media_view.load_media() def tool_callback(self,val): @@ -638,16 +640,25 @@ class Gramps: """Brute force display update, updating all the pages""" self.complete_rebuild() - self.family_view.load_family() - self.source_view.load_sources() - self.place_view.load_places() - self.pedigree_view.load_canvas(self.active_person) - self.media_view.load_media() + page = self.notebook.get_current_page() + + if page == 1: + self.family_view.load_family() + elif page == 2: + self.pedigree_view.load_canvas(self.active_person) + elif page == 3: + self.source_view.load_sources() + elif page == 4: + self.place_view.load_places() + self.place_loaded = 1 + elif page == 5: + self.media_view.load_media() self.toolbar.set_style(GrampsCfg.toolbar) def update_display(self,changed): """Incremental display update, update only the displayed page""" page = self.notebook.get_current_page() + if page == 0: if changed: self.apply_filter() @@ -661,6 +672,7 @@ class Gramps: self.source_view.load_sources() elif page == 4: self.place_view.load_places() + self.place_loaded = 1 else: self.media_view.load_media() @@ -721,6 +733,7 @@ class Gramps: self.loadsaved_file) else: self.active_person = None + self.place_loaded = 0 self.read_file(filename) def autosave_query(self): @@ -763,7 +776,7 @@ class Gramps: self.topWindow.set_title("%s - GRAMPS" % name) else: GrampsCfg.save_last_file("") - + def on_ok_button2_clicked(self,obj): filename = obj.get_filename() filename = os.path.normpath(os.path.abspath(filename)) @@ -1040,6 +1053,7 @@ class Gramps: file = self.db.getSavePath() self.db.new() self.active_person = None + self.place_loaded = 0 self.id2col = {} self.read_file(file) Utils.clearModified() @@ -1103,6 +1117,9 @@ class Gramps: def on_places_activate(self,obj): """Switches to the places view""" + if self.place_loaded == 0: + self.place_view.load_places() + self.place_loaded = 1 self.notebook.set_current_page(4) def on_media_activate(self,obj):