Pychecker fixes, rename of ZODB keys

svn: r1009
This commit is contained in:
Don Allingham 2002-05-28 04:02:52 +00:00
parent 35b62626f4
commit caa2d7ea9b
5 changed files with 20 additions and 24 deletions

View File

@ -23,13 +23,6 @@ Adds autocompletion to a GtkEntry box, using the passed list of
strings as the possible completions.
"""
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import string
#-------------------------------------------------------------------------
#
# GNOME modules

View File

@ -58,9 +58,10 @@ class EventEditor:
self.trans = trans
self.callback = cb
self.plist = []
self.pmap = {}
for key in db.getPlaceKeys():
p = db.getPlaceDisplay(key)
for key in self.parent.db.getPlaceKeys():
p = self.parent.db.getPlaceDisplay(key)
self.pmap[p[0]] = key
if event:
@ -155,7 +156,7 @@ class EventEditor:
text = strip(field.get_text())
if text != "":
if self.pmap.has_key(text):
return self.db.getPlaceMap()[self.pmap[text]]
return self.parent.db.getPlaceMap()[self.pmap[text]]
elif makenew:
place = Place()
place.set_title(text)

View File

@ -186,11 +186,11 @@ class GrampsZODB(GrampsDB):
self.familyMap = self.get_object('familyMap')
if self.root.has_key('pm'):
if self.root.has_key('personMap'):
self.personMap = self.root['personMap']
else:
self.personMap = PersonMap()
self.root['pm'] = self.personMap
self.root['personMap'] = self.personMap
self.need_commit = 1
self.personTable = self.get_display_table(self.personMap,'personTable')

View File

@ -1957,6 +1957,10 @@ class GrampsDB(Persistent):
"""returns the default Person of the database"""
return self.default
def getPerson(self,id):
"""returns a map of gramps's IDs to Person instances"""
return self.personMap[id]
def getPersonMap(self):
"""returns a map of gramps's IDs to Person instances"""
return extmap(self.personMap)

View File

@ -402,8 +402,8 @@ class Gramps:
import MergeData
p1 = self.person_list.get_row_data(self.person_list.selection[0])
p2 = self.person_list.get_row_data(self.person_list.selection[1])
p1 = self.db.getPersonMap()[p1]
p2 = self.db.getPersonMap()[p2]
p1 = self.db.getPerson(p1)
p2 = self.db.getPerson(p2)
MergeData.MergePeople(self.db,p1,p2,self.merge_update,
self.update_after_edit)
elif page == 4:
@ -867,7 +867,7 @@ class Gramps:
else:
for p in self.person_list.selection:
person = self.person_list.get_row_data(p)
self.load_person(self.db.getPersonMap()[person])
self.load_person(self.db.getPerson(person))
def load_active_person(self,obj):
self.load_person(self.active_person)
@ -945,7 +945,7 @@ class Gramps:
if row > self.person_list.rows:
p = self.person_list.get_row_data(row)
self.active_person = self.db.getPersonMap()[p]
self.active_person = self.db.getPerson(p)
self.person_list.thaw()
def merge_update(self,p1,p2):
@ -963,7 +963,7 @@ class Gramps:
def on_person_list_select_row(self,obj,row,b,c):
if row == obj.selection[0]:
person = self.db.getPersonMap()[obj.get_row_data(row)]
person = self.db.getPerson(obj.get_row_data(row))
self.change_active_person(person)
def on_person_list_click_column(self,obj,column):
@ -1065,7 +1065,7 @@ class Gramps:
self.person_list.select_row(0,0)
self.person_list.moveto(0)
pid = self.person_list.get_row_data(0)
person = self.db.getPersonMap()[pid]
person = self.db.getPerson(pid)
self.change_active_person(person)
def change_active_person(self,person):
@ -1092,7 +1092,7 @@ class Gramps:
def on_child_list_select_row(self,obj,row,b,c):
id = obj.get_row_data(row)
self.active_child = id #self.db.getPersonMap()[id]
self.active_child = id
def on_child_list_click_column(self,clist,column):
"""Called when the user selects a column header on the self.person_list
@ -1160,7 +1160,7 @@ class Gramps:
for i in range(0,rows):
clist.set_background(i,(evenbg,oddbg)[i%2])
id = clist.get_row_data(i)
person = self.db.getPersonMap()[id]
person = self.db.getPerson(id)
if (person.getAncestor()):
clist.set_foreground(i,ancestorfg)
else:
@ -1829,11 +1829,9 @@ class Gramps:
datacomp = self.DataFilter.compare
self.person_list.set_column_visibility(1,GrampsCfg.id_visible)
i = 0
for key in self.db.getPersonKeys():
i = i + 1
person = self.db.getPersonMap()[key]
person = self.db.getPerson(key)
if datacomp(person):
if self.id2col.has_key(key):
continue