cursor cleanup
svn: r6180
This commit is contained in:
parent
0742d69347
commit
d16df0e35a
@ -127,6 +127,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
self.tooltip_column = 12
|
||||
self.prev_handle = None
|
||||
self.prev_data = None
|
||||
self.temp_top_path2iter = []
|
||||
self.rebuild_data(data_filter,skip)
|
||||
|
||||
def rebuild_data(self,data_filter=None,skip=[]):
|
||||
@ -136,7 +137,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
def calculate_data(self,dfilter=None,skip=[]):
|
||||
if dfilter:
|
||||
self.dfilter = dfilter
|
||||
self.temp_top_path2iter = []
|
||||
self.temp_iter2path = {}
|
||||
self.temp_path2iter = {}
|
||||
self.temp_sname_sub = {}
|
||||
@ -147,36 +147,22 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
ngn = NameDisplay.displayer.name_grouping_name
|
||||
nsn = NameDisplay.displayer.raw_sorted_name
|
||||
|
||||
flist = set(skip)
|
||||
self.sortnames = {}
|
||||
|
||||
cursor = self.db.surnames.cursor()
|
||||
cursor = self.db.person_map.db.cursor()
|
||||
node = cursor.first()
|
||||
|
||||
while node:
|
||||
n,d = node
|
||||
handle,d = node
|
||||
d = pickle.loads(d)
|
||||
handle = d[0]
|
||||
surname = n
|
||||
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||
self.sortnames[handle] = nsn(d[_NAME_COL])
|
||||
self.temp_sname_sub[surname] = [handle]
|
||||
|
||||
node = cursor.next_dup()
|
||||
while node:
|
||||
n,d = node
|
||||
d = pickle.loads(d)
|
||||
handle = d[0]
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||
self.sortnames[handle] = nsn(d[_NAME_COL])
|
||||
name_data = d[_NAME_COL]
|
||||
self.sortnames[handle] = nsn(name_data)
|
||||
try:
|
||||
self.temp_sname_sub[surname].append(handle)
|
||||
self.temp_sname_sub[name_data[3]].append(handle)
|
||||
except:
|
||||
self.temp_sname_sub[surname] = [handle]
|
||||
node = cursor.next_dup()
|
||||
|
||||
node = cursor.next_nodup()
|
||||
self.temp_sname_sub[name_data[3]] = [handle]
|
||||
node = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.temp_top_path2iter = locale_sort(self.temp_sname_sub.keys())
|
||||
|
@ -66,6 +66,16 @@ class SelectPerson:
|
||||
self.glade.get_widget('title'),
|
||||
title)
|
||||
|
||||
import hotshot, hotshot.stats
|
||||
|
||||
pr = hotshot.Profile('profile.data')
|
||||
pr.runcall(self.foo)
|
||||
pr.close()
|
||||
stats = hotshot.stats.load('profile.data')
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time','calls')
|
||||
stats.print_stats(35)
|
||||
|
||||
self.model = PeopleModel.PeopleModel(self.db,
|
||||
data_filter=filter,
|
||||
skip=skip)
|
||||
@ -77,6 +87,9 @@ class SelectPerson:
|
||||
if parent_window:
|
||||
self.top.set_transient_for(parent_window)
|
||||
|
||||
def foo(self):
|
||||
PeopleModel.PeopleModel(self.db)
|
||||
|
||||
def add_columns(self,tree):
|
||||
tree.set_fixed_height_mode(True)
|
||||
column = gtk.TreeViewColumn(_('Name'), self.renderer, text=0)
|
||||
@ -105,13 +118,12 @@ class SelectPerson:
|
||||
def run(self):
|
||||
val = self.top.run()
|
||||
if val == gtk.RESPONSE_OK:
|
||||
|
||||
self.top.destroy()
|
||||
idlist = self.get_selected_ids()
|
||||
if idlist and idlist[0]:
|
||||
return_value = self.db.get_person_from_handle(idlist[0])
|
||||
else:
|
||||
return_value = None
|
||||
self.top.destroy()
|
||||
return return_value
|
||||
else:
|
||||
self.top.destroy()
|
||||
|
Loading…
Reference in New Issue
Block a user