* src/Lru.py: Added least-recently-used module from
the PyPE program * src/DisplayModels/_PeopleModel.py: use LRU module to speed up name displays svn: r7504
This commit is contained in:
parent
f46ab3f17a
commit
3c5983b25f
@ -1,4 +1,8 @@
|
|||||||
2006-10-29 Don Allingham <don@gramps-project.org>
|
2006-10-29 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Lru.py: Added least-recently-used module from
|
||||||
|
the PyPE program
|
||||||
|
* src/DisplayModels/_PeopleModel.py: use LRU module to speed up
|
||||||
|
name displays
|
||||||
* configure.in: post 2.2.1 release update
|
* configure.in: post 2.2.1 release update
|
||||||
* src/GrampsDb/_ReadXML.py: handle broken events
|
* src/GrampsDb/_ReadXML.py: handle broken events
|
||||||
* help/C/gramps.xml: fix <warning>
|
* help/C/gramps.xml: fix <warning>
|
||||||
|
@ -66,6 +66,7 @@ import ToolTips
|
|||||||
import GrampsLocale
|
import GrampsLocale
|
||||||
import Config
|
import Config
|
||||||
from Filters import SearchFilter
|
from Filters import SearchFilter
|
||||||
|
from lru import LRU
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -158,6 +159,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.iter2path = {}
|
self.iter2path = {}
|
||||||
self.path2iter = {}
|
self.path2iter = {}
|
||||||
self.sname_sub = {}
|
self.sname_sub = {}
|
||||||
|
|
||||||
if filter_info:
|
if filter_info:
|
||||||
if filter_info[0] == PeopleModel.GENERIC:
|
if filter_info[0] == PeopleModel.GENERIC:
|
||||||
data_filter = filter_info[1]
|
data_filter = filter_info[1]
|
||||||
@ -242,6 +244,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.lru = LRU(500)
|
||||||
if dfilter:
|
if dfilter:
|
||||||
self.dfilter = dfilter
|
self.dfilter = dfilter
|
||||||
self.temp_iter2path = {}
|
self.temp_iter2path = {}
|
||||||
@ -258,6 +261,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.build_sub_entry(name)
|
self.build_sub_entry(name)
|
||||||
|
|
||||||
def clear_cache(self):
|
def clear_cache(self):
|
||||||
|
self.lru = LRU(500)
|
||||||
self.prev_handle = None
|
self.prev_handle = None
|
||||||
|
|
||||||
def build_sub_entry(self, name):
|
def build_sub_entry(self, name):
|
||||||
@ -411,7 +415,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
return spouses_names
|
return spouses_names
|
||||||
|
|
||||||
def column_name(self, data, node):
|
def column_name(self, data, node):
|
||||||
return NameDisplay.displayer.raw_sorted_name(data[PeopleModel._NAME_COL])
|
try:
|
||||||
|
name = self.lru[node]
|
||||||
|
except:
|
||||||
|
name = NameDisplay.displayer.raw_sorted_name(data[PeopleModel._NAME_COL])
|
||||||
|
self.lru[node] = name
|
||||||
|
return name
|
||||||
|
|
||||||
def column_id(self, data, node):
|
def column_id(self, data, node):
|
||||||
return data[PeopleModel._ID_COL]
|
return data[PeopleModel._ID_COL]
|
||||||
|
Loading…
Reference in New Issue
Block a user