From caa2d7ea9bdc432c8fd4fcb7c05535d67dea0a0c Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 28 May 2002 04:02:52 +0000 Subject: [PATCH] Pychecker fixes, rename of ZODB keys svn: r1009 --- gramps/src/DateEdit.py | 7 ------- gramps/src/EventEdit.py | 7 ++++--- gramps/src/GrampsZODB.py | 4 ++-- gramps/src/RelLib.py | 4 ++++ gramps/src/gramps_main.py | 22 ++++++++++------------ 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/gramps/src/DateEdit.py b/gramps/src/DateEdit.py index 635b65ee0..d4bc1e501 100644 --- a/gramps/src/DateEdit.py +++ b/gramps/src/DateEdit.py @@ -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 diff --git a/gramps/src/EventEdit.py b/gramps/src/EventEdit.py index a63c46084..882929872 100644 --- a/gramps/src/EventEdit.py +++ b/gramps/src/EventEdit.py @@ -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) diff --git a/gramps/src/GrampsZODB.py b/gramps/src/GrampsZODB.py index 46d58bc1b..b84132dfb 100644 --- a/gramps/src/GrampsZODB.py +++ b/gramps/src/GrampsZODB.py @@ -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') diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 02bb72fd2..338846a39 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -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) diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 807708b40..5ebe1600b 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -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