2007-01-16 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: optimization * src/ViewManager.py: remove double build call * src/DisplayModels/_PeopleModel.py: optimization svn: r7920
This commit is contained in:
parent
8fea958789
commit
e76a51da60
@ -1,3 +1,8 @@
|
|||||||
|
2007-01-16 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/DataViews/_PersonView.py: optimization
|
||||||
|
* src/ViewManager.py: remove double build call
|
||||||
|
* src/DisplayModels/_PeopleModel.py: optimization
|
||||||
|
|
||||||
2007-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2007-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/NameDisplay.py: fast implementation
|
* src/NameDisplay.py: fast implementation
|
||||||
|
|
||||||
|
@ -422,6 +422,21 @@ class PersonView(PageView.PersonNavView):
|
|||||||
db.connect('person-update', self.person_updated)
|
db.connect('person-update', self.person_updated)
|
||||||
db.connect('person-delete', self.person_removed)
|
db.connect('person-delete', self.person_removed)
|
||||||
db.connect('person-rebuild', self.build_tree)
|
db.connect('person-rebuild', self.build_tree)
|
||||||
|
|
||||||
|
# import hotshot, hotshot.stats
|
||||||
|
|
||||||
|
# pr = hotshot.Profile('mystats.profile')
|
||||||
|
# print "Start"
|
||||||
|
# pr.runcall(self.build_tree)
|
||||||
|
# print "Finished"
|
||||||
|
# pr.close()
|
||||||
|
# print "Loading profile"
|
||||||
|
# stats = hotshot.stats.load('mystats.profile')
|
||||||
|
# print "done"
|
||||||
|
# stats.strip_dirs()
|
||||||
|
# stats.sort_stats('time','calls')
|
||||||
|
# stats.print_stats(100)
|
||||||
|
|
||||||
self.build_tree()
|
self.build_tree()
|
||||||
self.bookmarks.update_bookmarks(db.get_bookmarks())
|
self.bookmarks.update_bookmarks(db.get_bookmarks())
|
||||||
if self.active:
|
if self.active:
|
||||||
@ -510,7 +525,6 @@ class PersonView(PageView.PersonNavView):
|
|||||||
since it can change when rows are unselected when the model is set.
|
since it can change when rows are unselected when the model is set.
|
||||||
"""
|
"""
|
||||||
if self.active:
|
if self.active:
|
||||||
|
|
||||||
if Config.get(Config.FILTER):
|
if Config.get(Config.FILTER):
|
||||||
filter_info = (PeopleModel.GENERIC, self.generic_filter)
|
filter_info = (PeopleModel.GENERIC, self.generic_filter)
|
||||||
else:
|
else:
|
||||||
|
@ -140,6 +140,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
gtk.GenericTreeModel.__init__(self)
|
gtk.GenericTreeModel.__init__(self)
|
||||||
|
|
||||||
self.db = db
|
self.db = db
|
||||||
|
self.in_build = False
|
||||||
|
|
||||||
Config.client.notify_add("/apps/gramps/preferences/todo-color",
|
Config.client.notify_add("/apps/gramps/preferences/todo-color",
|
||||||
self.update_todo)
|
self.update_todo)
|
||||||
@ -160,7 +161,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.path2iter = {}
|
self.path2iter = {}
|
||||||
self.sname_sub = {}
|
self.sname_sub = {}
|
||||||
|
|
||||||
if filter_info:
|
if filter_info and filter_info != (1, (0, u'', False)):
|
||||||
if filter_info[0] == PeopleModel.GENERIC:
|
if filter_info[0] == PeopleModel.GENERIC:
|
||||||
data_filter = filter_info[1]
|
data_filter = filter_info[1]
|
||||||
self._build_data = self._build_filter_sub
|
self._build_data = self._build_filter_sub
|
||||||
@ -248,6 +249,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
"""
|
"""
|
||||||
Calculates the new path to node values for the model.
|
Calculates the new path to node values for the model.
|
||||||
"""
|
"""
|
||||||
|
self.in_build = True
|
||||||
self.lru_data = LRU(_CACHE_SIZE)
|
self.lru_data = LRU(_CACHE_SIZE)
|
||||||
self.lru_name = LRU(_CACHE_SIZE)
|
self.lru_name = LRU(_CACHE_SIZE)
|
||||||
self.lru_bdate = LRU(_CACHE_SIZE)
|
self.lru_bdate = LRU(_CACHE_SIZE)
|
||||||
@ -267,6 +269,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.temp_top_path2iter = locale_sort(self.temp_sname_sub.keys())
|
self.temp_top_path2iter = locale_sort(self.temp_sname_sub.keys())
|
||||||
for name in self.temp_top_path2iter:
|
for name in self.temp_top_path2iter:
|
||||||
self.build_sub_entry(name)
|
self.build_sub_entry(name)
|
||||||
|
self.in_build = False
|
||||||
|
|
||||||
def clear_cache(self):
|
def clear_cache(self):
|
||||||
self.lru_data = LRU(_CACHE_SIZE)
|
self.lru_data = LRU(_CACHE_SIZE)
|
||||||
@ -350,7 +353,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
data = self.lru_data[node]
|
data = self.lru_data[node]
|
||||||
except:
|
except:
|
||||||
data = self.db.get_raw_person_data(str(node))
|
data = self.db.get_raw_person_data(str(node))
|
||||||
self.lru_data[node] = data
|
if not self.in_build:
|
||||||
|
self.lru_data[node] = data
|
||||||
return PeopleModel.COLUMN_DEFS[col][PeopleModel.COLUMN_DEF_LIST](self,
|
return PeopleModel.COLUMN_DEFS[col][PeopleModel.COLUMN_DEF_LIST](self,
|
||||||
data, node)
|
data, node)
|
||||||
except:
|
except:
|
||||||
@ -431,11 +435,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
return spouses_names
|
return spouses_names
|
||||||
|
|
||||||
def column_name(self, data, node):
|
def column_name(self, data, node):
|
||||||
try:
|
try:
|
||||||
name = self.lru_name[node]
|
name = self.lru_name[node]
|
||||||
except:
|
except:
|
||||||
name = NameDisplay.displayer.raw_sorted_name(data[PeopleModel._NAME_COL])
|
name = NameDisplay.displayer.raw_sorted_name(data[PeopleModel._NAME_COL])
|
||||||
self.lru_name[node] = name
|
if not self.in_build:
|
||||||
|
self.lru_name[node] = name
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def column_id(self, data, node):
|
def column_id(self, data, node):
|
||||||
@ -451,11 +456,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
return PeopleModel._GENDER[data[PeopleModel._GENDER_COL]]
|
return PeopleModel._GENDER[data[PeopleModel._GENDER_COL]]
|
||||||
|
|
||||||
def column_birth_day(self, data, node):
|
def column_birth_day(self, data, node):
|
||||||
try:
|
try:
|
||||||
value = self.lru_bdate[node]
|
value = self.lru_bdate[node]
|
||||||
except:
|
except:
|
||||||
value = self._get_birth_data(data,node)
|
value = self._get_birth_data(data,node)
|
||||||
self.lru_bdate[node] = value
|
if not self.in_build:
|
||||||
|
self.lru_bdate[node] = value
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _get_birth_data(self, data, node):
|
def _get_birth_data(self, data, node):
|
||||||
@ -486,11 +492,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
return u""
|
return u""
|
||||||
|
|
||||||
def column_death_day(self, data, node):
|
def column_death_day(self, data, node):
|
||||||
try:
|
try:
|
||||||
value = self.lru_ddate[node]
|
value = self.lru_ddate[node]
|
||||||
except:
|
except:
|
||||||
value = self._get_death_data(data,node)
|
value = self._get_death_data(data,node)
|
||||||
self.lru_ddate[node] = value
|
if not self.in_build:
|
||||||
|
self.lru_ddate[node] = value
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _get_death_data(self, data, node):
|
def _get_death_data(self, data, node):
|
||||||
|
@ -935,7 +935,7 @@ class ViewManager:
|
|||||||
|
|
||||||
self.state.db.enable_signals()
|
self.state.db.enable_signals()
|
||||||
self.state.signal_change()
|
self.state.signal_change()
|
||||||
self.state.db.request_rebuild()
|
# self.state.db.request_rebuild()
|
||||||
|
|
||||||
Config.set(Config.RECENT_FILE,filename)
|
Config.set(Config.RECENT_FILE,filename)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user