* src/ChooseParents.py: build an exclusion list of those
obviously not the parents * src/EditPerson.py: allow ID value to be edited * src/RelLib.py: Add try_to_find_from_gramps_id * src/ImageSelect.py: catch OSError svn: r3253
This commit is contained in:
parent
d89e54a693
commit
c75caa9b05
@ -1,3 +1,10 @@
|
||||
2004-07-08 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/ChooseParents.py: build an exclusion list of those
|
||||
obviously not the parents
|
||||
* src/EditPerson.py: allow ID value to be edited
|
||||
* src/RelLib.py: Add try_to_find_from_gramps_id
|
||||
* src/ImageSelect.py: catch OSError
|
||||
|
||||
2004-07-02 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/DbPrompter.py (SaveAsDbPrompter.change_suggested_name):
|
||||
Add method; (SaveAsDbPrompter.chooser): Make dialog a class attribute.
|
||||
|
@ -118,7 +118,8 @@ class ChooseParents:
|
||||
self.glade = gtk.glade.XML(const.gladeFile,"familyDialog","gramps")
|
||||
self.top = self.glade.get_widget("familyDialog")
|
||||
|
||||
self.title_text = _("Choose the Parents of %s") % GrampsCfg.nameof(self.person)
|
||||
self.title_text = _("Choose the Parents of %s") % \
|
||||
GrampsCfg.nameof(self.person)
|
||||
Utils.set_titles(self.top,self.glade.get_widget('title'),
|
||||
self.title_text,_('Choose Parents'))
|
||||
|
||||
@ -249,14 +250,20 @@ class ChooseParents:
|
||||
def likely_father_filter(self,person):
|
||||
if person.get_gender() != RelLib.Person.male:
|
||||
return 0
|
||||
if self.exclude.has_key(person.get_id()):
|
||||
return 0
|
||||
return self.likely_filter(person)
|
||||
|
||||
def likely_mother_filter(self,person):
|
||||
if person.get_gender() != RelLib.Person.female:
|
||||
return 0
|
||||
if self.exclude.has_key(person.get_id()):
|
||||
return 0
|
||||
return self.likely_filter(person)
|
||||
|
||||
def likely_filter(self,person):
|
||||
if person.get_id() == self.person.get_id():
|
||||
return 0
|
||||
birth_event = self.db.find_event_from_id(person.get_birth_id())
|
||||
if birth_event:
|
||||
pbday = birth_event.get_date_object()
|
||||
@ -296,12 +303,22 @@ class ChooseParents:
|
||||
return 0
|
||||
return 1
|
||||
|
||||
def build_exclude_list(self):
|
||||
self.exclude = { self.person.get_id() : 1 }
|
||||
for family_id in self.person.get_family_id_list():
|
||||
fam = self.db.find_family_from_id(family_id)
|
||||
for id in [fam.get_father_id(), fam.get_mother_id()] + \
|
||||
fam.get_child_id_list():
|
||||
if id:
|
||||
self.exclude[id] = 1
|
||||
|
||||
def redrawf(self):
|
||||
"""Redraws the potential father list"""
|
||||
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
||||
self.father_nsort.rebuild_data()
|
||||
self.father_nsort.reset_visible()
|
||||
|
||||
self.build_exclude_list()
|
||||
|
||||
for pid in self.db.get_person_keys():
|
||||
person = self.db.try_to_find_person_from_id(pid)
|
||||
visible = self.father_filter(person)
|
||||
@ -323,6 +340,7 @@ class ChooseParents:
|
||||
self.mother_nsort = PeopleModel.PeopleModel(self.db)
|
||||
self.mother_nsort.rebuild_data()
|
||||
self.mother_nsort.reset_visible()
|
||||
self.build_exclude_list()
|
||||
|
||||
for pid in self.db.get_person_keys():
|
||||
person = self.db.try_to_find_person_from_id(pid)
|
||||
|
@ -289,7 +289,7 @@ class EditPerson:
|
||||
build_dropdown(self.surname,self.db.get_surnames())
|
||||
|
||||
self.gid.set_text(person.get_gramps_id())
|
||||
self.gid.set_editable(GrampsCfg.id_edit)
|
||||
self.gid.set_editable(1)
|
||||
|
||||
self.lds_baptism = RelLib.LdsOrd(self.person.get_lds_baptism())
|
||||
self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment())
|
||||
@ -1450,14 +1450,11 @@ class EditPerson:
|
||||
self.birth.set_place_id(self.get_place(self.bplace,1))
|
||||
|
||||
if idval != self.person.get_gramps_id():
|
||||
m = self.db.get_person_keys()
|
||||
if not m.has_key(idval):
|
||||
if m.has_key(self.person.get_gramps_id()):
|
||||
del m[self.person.get_gramps_id()]
|
||||
m[idval] = self.person
|
||||
person = self.db.try_to_find_person_from_gramps_id(idval)
|
||||
if not person:
|
||||
self.person.set_gramps_id(idval)
|
||||
else:
|
||||
n = GrampsCfg.nameof(m[idval])
|
||||
n = GrampsCfg.nameof(person)
|
||||
msg1 = _("GRAMPS ID value was not changed.")
|
||||
msg2 = _("You have attempted to change the GRAMPS ID to a value "
|
||||
"of %(grampsid)s. This value is already used by %(person)s.") % {
|
||||
|
@ -492,7 +492,7 @@ class Gallery(ImageSelect):
|
||||
u = urllib.URLopener()
|
||||
try:
|
||||
tfile,headers = u.retrieve(d)
|
||||
except IOError, msg:
|
||||
except (IOError,OSError), msg:
|
||||
t = _("Could not import %s") % d
|
||||
ErrorDialog(t,str(msg))
|
||||
return
|
||||
@ -1233,3 +1233,4 @@ class DeleteMediaQuery:
|
||||
self.db.add_transaction(trans,_("Remove Media Object"))
|
||||
if self.update:
|
||||
self.update()
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ class Person(SourceNote):
|
||||
self.urls,
|
||||
self.lds_bapt, self.lds_endow, self.lds_seal,
|
||||
self.complete, self.source_list, self.note) = data
|
||||
|
||||
|
||||
def set_complete(self,val):
|
||||
self.complete = val
|
||||
|
||||
@ -2984,6 +2984,18 @@ class GrampsDB:
|
||||
else:
|
||||
return None
|
||||
|
||||
def try_to_find_person_from_gramps_id(self,val):
|
||||
"""finds a Person in the database from the passed gramps' ID.
|
||||
If no such Person exists, a new Person is added to the database."""
|
||||
|
||||
data = self.idtrans.get(str(val))
|
||||
if data:
|
||||
person = Person()
|
||||
person.unserialize(cPickle.loads(data))
|
||||
return person
|
||||
else:
|
||||
return None
|
||||
|
||||
def find_person_from_gramps_id(self,val,trans):
|
||||
"""finds a Person in the database from the passed gramps' ID.
|
||||
If no such Person exists, a new Person is added to the database."""
|
||||
|
Loading…
Reference in New Issue
Block a user