* src/RelLib.py: Person and Family now inherit from SourceNote
* src/EditPerson.py: Added source tab to apply generic sources to a person * src/Marriage.py: Added source tab to apply generic sources to a person, add "complete" flag * src/WriteXML.py: Store source information for Family and Person, store complete flag for Family * src/GrampsParser.py: Parse source information for Family and Person, read complete flag for Famiy svn: r2289
This commit is contained in:
parent
93f87bda38
commit
0785137dcb
@ -53,6 +53,7 @@ import sort
|
||||
import AutoComp
|
||||
import ListModel
|
||||
import RelLib
|
||||
import Sources
|
||||
from DateEdit import DateEdit
|
||||
from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialog
|
||||
|
||||
@ -102,7 +103,8 @@ class EditPerson:
|
||||
self.window.set_title("%s - GRAMPS" % _('Edit Person'))
|
||||
|
||||
self.icon_list = self.top.get_widget("iconlist")
|
||||
self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list,self.db,self,self.window)
|
||||
self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list,
|
||||
self.db,self,self.window)
|
||||
|
||||
self.name_delete_btn = self.top.get_widget('aka_delete')
|
||||
self.name_edit_btn = self.top.get_widget('aka_edit')
|
||||
@ -176,6 +178,7 @@ class EditPerson:
|
||||
self.name_note = self.get_widget("name_note")
|
||||
self.name_source = self.get_widget("name_source")
|
||||
self.gid = self.get_widget("gid")
|
||||
self.slist = self.get_widget("slist")
|
||||
|
||||
self.death = RelLib.Event(person.getDeath())
|
||||
self.birth = RelLib.Event(person.getBirth())
|
||||
@ -187,6 +190,11 @@ class EditPerson:
|
||||
self.ulist = person.getUrlList()[:]
|
||||
self.plist = person.getAddressList()[:]
|
||||
|
||||
if person:
|
||||
self.srcreflist = person.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
# event display
|
||||
etitles = [(_('Event'),-1,150),(_('Description'),-1,150),
|
||||
(_('Date'),-1,100),(_('Place'),-1,100)]
|
||||
@ -329,6 +337,12 @@ class EditPerson:
|
||||
|
||||
self.update_birth_death()
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
|
||||
self.top,self.window,self.slist,
|
||||
self.top.get_widget('add_src'),
|
||||
self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'))
|
||||
|
||||
self.redraw_event_list()
|
||||
self.redraw_attr_list()
|
||||
self.redraw_addr_list()
|
||||
@ -1429,6 +1443,10 @@ class EditPerson:
|
||||
self.person.setLdsSeal(self.lds_sealing)
|
||||
Utils.modified()
|
||||
|
||||
if self.lists_changed:
|
||||
self.person.setSourceRefList(self.srcreflist)
|
||||
Utils.modified()
|
||||
|
||||
self.update_lists()
|
||||
if self.callback:
|
||||
self.callback(self,self.add_places)
|
||||
|
@ -127,7 +127,7 @@ class GrampsParser:
|
||||
"description": (None, self.stop_description),
|
||||
"event" : (self.start_event, self.stop_event),
|
||||
"families" : (None, self.stop_families),
|
||||
"family" : (self.start_family, None),
|
||||
"family" : (self.start_family, self.stop_family),
|
||||
"father" : (self.start_father, None),
|
||||
"first" : (None, self.stop_first),
|
||||
"gender" : (None, self.stop_gender),
|
||||
@ -139,7 +139,7 @@ class GrampsParser:
|
||||
"note" : (self.start_note, self.stop_note),
|
||||
"p" : (None, self.stop_ptag),
|
||||
"parentin" : (self.start_parentin,None),
|
||||
"people" : (self.start_people, self.stop_people),
|
||||
"people" : (self.start_people, None),
|
||||
"person" : (self.start_person, self.stop_person),
|
||||
"img" : (self.start_photo, self.stop_photo),
|
||||
"objref" : (self.start_objref, self.stop_objref),
|
||||
@ -380,6 +380,10 @@ class GrampsParser:
|
||||
self.family.setRelationship(const.save_frel(attrs["type"]))
|
||||
else:
|
||||
self.family.setRelationship("")
|
||||
if attrs.has_key("complete"):
|
||||
self.family.setComplete(int(attrs['complete']))
|
||||
else:
|
||||
self.family.setComplete(0)
|
||||
|
||||
def start_childof(self,attrs):
|
||||
family = self.db.findFamilyNoMap(attrs["ref"])
|
||||
@ -439,6 +443,10 @@ class GrampsParser:
|
||||
self.attribute.addSourceRef(self.source_ref)
|
||||
elif self.placeobj:
|
||||
self.placeobj.addSourceRef(self.source_ref)
|
||||
elif self.family:
|
||||
self.family.addSourceRef(self.source_ref)
|
||||
elif self.person:
|
||||
self.person.addSourceRef(self.source_ref)
|
||||
|
||||
def start_source(self,attrs):
|
||||
if self.num_srcs > 0:
|
||||
@ -623,7 +631,10 @@ class GrampsParser:
|
||||
loc = self.placeobj.get_main_location()
|
||||
self.placeobj.set_title(build_place_title(loc))
|
||||
self.db.buildPlaceDisplay(self.placeobj.getId())
|
||||
self.palceobj = None
|
||||
self.placeobj = None
|
||||
|
||||
def stop_family(self,tag):
|
||||
self.family = None
|
||||
|
||||
def stop_event(self,tag):
|
||||
self.event.name = self.event_type
|
||||
@ -664,6 +675,7 @@ class GrampsParser:
|
||||
self.ord.setPlace(self.placeobj)
|
||||
else:
|
||||
self.event.place = self.placeobj
|
||||
self.placeobj = None
|
||||
|
||||
def stop_uid(self,tag):
|
||||
self.person.setPafUid(tag)
|
||||
@ -681,11 +693,9 @@ class GrampsParser:
|
||||
def stop_families(self,tag):
|
||||
self.family = None
|
||||
|
||||
def stop_people(self,tag):
|
||||
self.person = None
|
||||
|
||||
def stop_person(self,tag):
|
||||
self.db.buildPersonDisplay(self.person.getId())
|
||||
self.person = None
|
||||
|
||||
def stop_description(self,tag):
|
||||
self.event.setDescription(tag)
|
||||
@ -897,7 +907,7 @@ class GrampsImportParser(GrampsParser):
|
||||
self.func_map["family"] = (self.start_family, None)
|
||||
self.func_map["father"] = (self.start_father, None)
|
||||
self.func_map["mother"] = (self.start_mother,None)
|
||||
self.func_map["people"] = (self.start_people, self.stop_people)
|
||||
self.func_map["people"] = (self.start_people, None)
|
||||
self.func_map["person"] = (self.start_person, self.stop_person)
|
||||
self.func_map["objref"] = (self.start_objref, self.stop_objref)
|
||||
self.func_map["object"] = (self.start_object, self.stop_object)
|
||||
@ -950,23 +960,6 @@ class GrampsImportParser(GrampsParser):
|
||||
if attrs.has_key("type"):
|
||||
self.family.setRelationship(const.save_frel(attrs["type"]))
|
||||
|
||||
def start_sourceref(self,attrs):
|
||||
self.source_ref = RelLib.SourceRef()
|
||||
self.source = self.db.findSourceNoConflicts(attrs["ref"],self.smap)
|
||||
self.source_ref.setBase(self.source)
|
||||
if self.address:
|
||||
self.address.addSourceRef(self.source_ref)
|
||||
elif self.name:
|
||||
self.name.addSourceRef(self.source_ref)
|
||||
elif self.event:
|
||||
self.event.addSourceRef(self.source_ref)
|
||||
elif self.attribute:
|
||||
self.attribute.addSourceRef(self.source_ref)
|
||||
elif self.placeobj:
|
||||
self.placeobj.addSourceRef(self.source_ref)
|
||||
else:
|
||||
print "Sorry, I'm lost"
|
||||
|
||||
def start_source(self,attrs):
|
||||
self.source = self.db.findSourceNoConflicts(attrs["id"],self.smap)
|
||||
|
||||
@ -994,6 +987,8 @@ class GrampsImportParser(GrampsParser):
|
||||
self.attribute.addSourceRef(self.source_ref)
|
||||
elif self.placeobj:
|
||||
self.placeobj.addSourceRef(self.source_ref)
|
||||
elif self.family:
|
||||
self.family.addSourceRef(self.source_ref)
|
||||
|
||||
def start_place(self,attrs):
|
||||
self.placeobj = self.db.findPlaceNoConflicts(attrs['ref'],self.lmap)
|
||||
|
@ -42,6 +42,7 @@ import ListModel
|
||||
import RelLib
|
||||
import ImageSelect
|
||||
import Date
|
||||
import Sources
|
||||
|
||||
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
|
||||
from gettext import gettext as _
|
||||
@ -73,6 +74,11 @@ class Marriage:
|
||||
self.update_fv = update
|
||||
self.pmap = {}
|
||||
|
||||
if family:
|
||||
self.srcreflist = family.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
for key in db.getPlaceKeys():
|
||||
p = db.getPlaceDisplay(key)
|
||||
self.pmap[p[0]] = key
|
||||
@ -116,6 +122,7 @@ class Marriage:
|
||||
self.event_list = self.get_widget("marriageEventList")
|
||||
|
||||
# widgets
|
||||
self.complete = self.get_widget('complete')
|
||||
self.date_field = self.get_widget("marriageDate")
|
||||
self.place_field = self.get_widget("marriagePlace")
|
||||
self.cause_field = self.get_widget("marriageCause")
|
||||
@ -135,6 +142,7 @@ class Marriage:
|
||||
self.lds_temple = self.get_widget("lds_temple")
|
||||
self.lds_status = self.get_widget("lds_status")
|
||||
self.lds_place = self.get_widget("lds_place")
|
||||
self.slist = self.get_widget("slist")
|
||||
|
||||
self.elist = family.getEventList()[:]
|
||||
self.alist = family.getAttributeList()[:]
|
||||
@ -176,6 +184,9 @@ class Marriage:
|
||||
self.lds_temple.entry.set_text("")
|
||||
self.seal_stat = 0
|
||||
|
||||
if self.family.getComplete():
|
||||
self.complete.set_active(1)
|
||||
|
||||
place_list = self.pmap.keys()
|
||||
place_list.sort()
|
||||
self.autoplace = AutoComp.AutoCombo(self.lds_place, place_list)
|
||||
@ -198,6 +209,12 @@ class Marriage:
|
||||
self.notes_buffer = self.notes_field.get_buffer()
|
||||
self.notes_buffer.set_text(family.getNote())
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
|
||||
self.top,self.window,self.slist,
|
||||
self.top.get_widget('add_src'),
|
||||
self.top.get_widget('edit_src'),
|
||||
self.top.get_widget('del_src'))
|
||||
|
||||
self.redraw_event_list()
|
||||
self.redraw_attr_list()
|
||||
self.window.show()
|
||||
@ -371,6 +388,9 @@ class Marriage:
|
||||
if const.save_frel(relation) != self.family.getRelationship():
|
||||
changed = 1
|
||||
|
||||
if self.complete.get_active() != self.family.getComplete():
|
||||
changed = 1
|
||||
|
||||
text = self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
||||
self.notes_buffer.get_end_iter(),gtk.FALSE)
|
||||
if text != self.family.getNote():
|
||||
@ -469,6 +489,10 @@ class Marriage:
|
||||
self.family.setNote(text)
|
||||
Utils.modified()
|
||||
|
||||
if self.complete.get_active() != self.family.getComplete():
|
||||
self.family.setComplete(self.complete.get_active())
|
||||
Utils.modified()
|
||||
|
||||
date = self.lds_date.get_text()
|
||||
temple = self.lds_temple.entry.get_text()
|
||||
if const.lds_temple_codes.has_key(temple):
|
||||
@ -505,6 +529,10 @@ class Marriage:
|
||||
|
||||
Utils.destroy_passed_object(self.get_widget("marriageEditor"))
|
||||
|
||||
if self.lists_changed:
|
||||
self.family.setSourceRefList(self.srcreflist)
|
||||
Utils.modified()
|
||||
|
||||
self.update_lists()
|
||||
if self.lists_changed:
|
||||
Utils.modified()
|
||||
|
@ -1032,7 +1032,7 @@ class Url(Persistent):
|
||||
return 1
|
||||
|
||||
|
||||
class Person(Persistent):
|
||||
class Person(SourceNote):
|
||||
"""Represents an individual person in the gramps database"""
|
||||
|
||||
unknown = 2
|
||||
@ -1041,7 +1041,7 @@ class Person(Persistent):
|
||||
|
||||
def __init__(self,id=""):
|
||||
"""creates a new Person instance"""
|
||||
|
||||
SourceNote.__init__(self)
|
||||
self.id = id
|
||||
self.PrimaryName = None
|
||||
self.EventList = []
|
||||
@ -1056,7 +1056,6 @@ class Person(Persistent):
|
||||
self.addressList = []
|
||||
self.attributeList = []
|
||||
self.urls = []
|
||||
self.note = None
|
||||
self.paf_uid = ""
|
||||
self.position = None
|
||||
self.ancestor = None
|
||||
@ -1363,33 +1362,6 @@ class Person(Persistent):
|
||||
else:
|
||||
return self.AltFamilyList[0]
|
||||
|
||||
def setNote(self,text):
|
||||
"""sets the note attached to the Person to the passed text"""
|
||||
if self.note == None:
|
||||
self.note = Note()
|
||||
self.note.set(text)
|
||||
|
||||
def getNote(self) :
|
||||
"""returns the text of the note attached to the Person"""
|
||||
if self.note == None:
|
||||
return ""
|
||||
else:
|
||||
return self.note.get()
|
||||
|
||||
def setNoteObj(self,note):
|
||||
"""sets the Note instance attached to the Person"""
|
||||
self.note = note
|
||||
|
||||
def getNoteObj(self):
|
||||
"""returns the Note instance attached to the Person"""
|
||||
if self.note == None:
|
||||
self.note = Note()
|
||||
return self.note
|
||||
|
||||
def unique_note(self):
|
||||
"""Creates a unique instance of the current note"""
|
||||
self.note = Note(self.note.get())
|
||||
|
||||
def setPosition(self,pos):
|
||||
"""sets a graphical location pointer for graphic display (x,y)"""
|
||||
self.position = pos
|
||||
@ -1706,11 +1678,12 @@ class Witness(Persistent):
|
||||
def get_comment(self):
|
||||
return self.comment
|
||||
|
||||
class Family(Persistent):
|
||||
class Family(SourceNote):
|
||||
"""Represents a family unit in the gramps database"""
|
||||
|
||||
def __init__(self):
|
||||
"""creates a new Family instance"""
|
||||
SourceNote.__init__(self)
|
||||
self.Father = None
|
||||
self.Mother = None
|
||||
self.Children = []
|
||||
@ -1720,10 +1693,16 @@ class Family(Persistent):
|
||||
self.EventList = []
|
||||
self.id = ""
|
||||
self.photoList = []
|
||||
self.note = Note()
|
||||
self.attributeList = []
|
||||
self.position = None
|
||||
self.lds_seal = None
|
||||
self.complete = 0
|
||||
|
||||
def setComplete(self,val):
|
||||
self.complete = val
|
||||
|
||||
def getComplete(self):
|
||||
return self.complete
|
||||
|
||||
def setLdsSeal(self,ord):
|
||||
self.lds_seal = ord
|
||||
@ -1758,26 +1737,6 @@ class Family(Persistent):
|
||||
"""sets the attribute list to the specified list"""
|
||||
self.attributeList = list
|
||||
|
||||
def getNote(self):
|
||||
"""returns the text of the note attached to the Family"""
|
||||
return self.note.get()
|
||||
|
||||
def setNote(self,text):
|
||||
"""sets the note attached to the Family to the passed text"""
|
||||
self.note.set(text)
|
||||
|
||||
def getNoteObj(self):
|
||||
"""returns the Note instance attached to the Family"""
|
||||
return self.note
|
||||
|
||||
def unique_note(self):
|
||||
"""Creates a unique instance of the current note"""
|
||||
self.note = Note(self.note.get())
|
||||
|
||||
def setNoteObj(self,obj):
|
||||
"""sets the Note instance attached to the Family"""
|
||||
self.note = obj
|
||||
|
||||
def setId(self,id) :
|
||||
"""sets the gramps ID for the Family"""
|
||||
self.id = str(id)
|
||||
|
@ -272,6 +272,8 @@ class XmlWriter:
|
||||
self.write_ref("parentin",family,3)
|
||||
|
||||
self.write_note("note",person.getNote(),3)
|
||||
for s in person.getSourceRefList():
|
||||
self.dump_source_ref(s,4)
|
||||
|
||||
self.g.write(" </person>\n")
|
||||
self.g.write(" </people>\n")
|
||||
@ -304,6 +306,8 @@ class XmlWriter:
|
||||
self.write_ref("child",person,3)
|
||||
self.write_attribute_list(family.getAttributeList())
|
||||
self.write_note("note",family.getNote(),3)
|
||||
for s in family.getSourceRefList():
|
||||
self.dump_source_ref(s,3)
|
||||
self.g.write(" </family>\n")
|
||||
self.g.write(" </families>\n")
|
||||
|
||||
@ -475,8 +479,11 @@ class XmlWriter:
|
||||
def write_family_id(self,family,index=1):
|
||||
if family:
|
||||
rel = family.getRelationship()
|
||||
comp = family.getComplete()
|
||||
sp = " " * index
|
||||
self.g.write('%s<family id="%s"' % (sp,family.getId()))
|
||||
if comp:
|
||||
self.g.write(' complete="1"')
|
||||
if rel != "":
|
||||
self.g.write(' type="%s">\n' % const.save_frel(rel))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user