Faster load times for places

svn: r1364
This commit is contained in:
Don Allingham 2003-03-20 02:54:28 +00:00
parent 17ea913e6e
commit 4244c803a0
4 changed files with 37 additions and 10 deletions

View File

@ -372,7 +372,10 @@ class SingleDate:
vals = string.split(v,'-') vals = string.split(v,'-')
self.setYearVal(vals[0]) self.setYearVal(vals[0])
if len(vals) > 1: if len(vals) > 1:
try:
self.setMonthVal(int(vals[1])) self.setMonthVal(int(vals[1]))
except:
self.month = UNDEF
else: else:
self.month = UNDEF self.month = UNDEF
if len(vals) > 2: if len(vals) > 2:

View File

@ -110,7 +110,13 @@ class PlaceView:
on large databases, and should only be called when absolutely on large databases, and should only be called when absolutely
necessary""" 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 = {} self.id2col = {}
for key in self.db.getPlaceKeys(): for key in self.db.getPlaceKeys():
@ -124,7 +130,8 @@ class PlaceView:
8, val[8], 9, val[9], 10, val[10], 11, val[11], 8, val[8], 9, val[9], 10, val[10], 11, val[11],
12, val[12] 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): def merge(self):

View File

@ -109,6 +109,7 @@ class Gramps:
self.DataFilter = Filter.Filter("") self.DataFilter = Filter.Filter("")
self.parents_index = 0 self.parents_index = 0
self.active_person = None self.active_person = None
self.place_loaded = 0
self.bookmarks = None self.bookmarks = None
self.c_details = 6 self.c_details = 6
self.id2col = {} self.id2col = {}
@ -627,6 +628,7 @@ class Gramps:
self.pedigree_view.clear() self.pedigree_view.clear()
self.source_view.load_sources() self.source_view.load_sources()
self.place_view.load_places() self.place_view.load_places()
self.place_loaded = 0
self.media_view.load_media() self.media_view.load_media()
def tool_callback(self,val): def tool_callback(self,val):
@ -638,16 +640,25 @@ class Gramps:
"""Brute force display update, updating all the pages""" """Brute force display update, updating all the pages"""
self.complete_rebuild() self.complete_rebuild()
page = self.notebook.get_current_page()
if page == 1:
self.family_view.load_family() self.family_view.load_family()
self.source_view.load_sources() elif page == 2:
self.place_view.load_places()
self.pedigree_view.load_canvas(self.active_person) 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.media_view.load_media()
self.toolbar.set_style(GrampsCfg.toolbar) self.toolbar.set_style(GrampsCfg.toolbar)
def update_display(self,changed): def update_display(self,changed):
"""Incremental display update, update only the displayed page""" """Incremental display update, update only the displayed page"""
page = self.notebook.get_current_page() page = self.notebook.get_current_page()
if page == 0: if page == 0:
if changed: if changed:
self.apply_filter() self.apply_filter()
@ -661,6 +672,7 @@ class Gramps:
self.source_view.load_sources() self.source_view.load_sources()
elif page == 4: elif page == 4:
self.place_view.load_places() self.place_view.load_places()
self.place_loaded = 1
else: else:
self.media_view.load_media() self.media_view.load_media()
@ -721,6 +733,7 @@ class Gramps:
self.loadsaved_file) self.loadsaved_file)
else: else:
self.active_person = None self.active_person = None
self.place_loaded = 0
self.read_file(filename) self.read_file(filename)
def autosave_query(self): def autosave_query(self):
@ -1040,6 +1053,7 @@ class Gramps:
file = self.db.getSavePath() file = self.db.getSavePath()
self.db.new() self.db.new()
self.active_person = None self.active_person = None
self.place_loaded = 0
self.id2col = {} self.id2col = {}
self.read_file(file) self.read_file(file)
Utils.clearModified() Utils.clearModified()
@ -1103,6 +1117,9 @@ class Gramps:
def on_places_activate(self,obj): def on_places_activate(self,obj):
"""Switches to the places view""" """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) self.notebook.set_current_page(4)
def on_media_activate(self,obj): def on_media_activate(self,obj):