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