5395: citations support for GeneWeb plugins (import/export); update POTFILE.in

svn: r18526
This commit is contained in:
Jérôme Rapinat 2011-11-28 15:50:18 +00:00
parent aa60900487
commit 4e18e93ec0
3 changed files with 29 additions and 31 deletions

View File

@ -117,7 +117,6 @@ src/gui/editors/editprimary.py
src/gui/editors/editreporef.py
src/gui/editors/editrepository.py
src/gui/editors/editsource.py
src/gui/editors/editsourceref.py
src/gui/editors/editurl.py
# gui/editors/displaytabs - the GUI display tabs package
@ -141,7 +140,6 @@ src/gui/editors/displaytabs/notetab.py
src/gui/editors/displaytabs/personeventembedlist.py
src/gui/editors/displaytabs/personrefembedlist.py
src/gui/editors/displaytabs/repoembedlist.py
src/gui/editors/displaytabs/sourceembedlist.py
src/gui/editors/displaytabs/surnametab.py
src/gui/editors/displaytabs/webembedlist.py
@ -277,7 +275,7 @@ src/plugins/gramplet/FanChartGramplet.py
src/plugins/gramplet/FaqGramplet.py
src/plugins/gramplet/GivenNameGramplet.py
src/plugins/gramplet/gramplet.gpr.py
src/plugins/gramplet/MetadataViewer.py
#src/plugins/gramplet/MetadataViewer.py
src/plugins/gramplet/Notes.py
src/plugins/gramplet/PedigreeGramplet.py
src/plugins/gramplet/PersonDetails.py

View File

@ -130,12 +130,12 @@ class GeneWebWriter(object):
(self.get_ref_name(father),
self.get_full_person_info_fam(father),
self.get_wedding_data(family),
self.get_ref_name(mother),
self.get_ref_name(mother),
self.get_full_person_info_fam(mother)
)
)
self.write_witness( family)
self.write_sources( family.get_source_references())
self.write_sources( family.get_citation_list())
self.write_children( family, father)
self.write_notes( family, father, mother)
if True: # FIXME: not (self.restrict and self.exclnotes):
@ -186,14 +186,14 @@ class GeneWebWriter(object):
# return
if reflist:
for sr in reflist:
sbase = sr.get_reference_handle()
if sbase:
source = self.db.get_source_from_handle(sbase)
if source:
self.writeln( "src %s" %
(self.rem_spaces(source.get_title()))
)
for handle in reflist:
citation = self.db.get_citation_from_handle(handle)
src_handle = citation.get_reference_handle()
source = self.db.get_source_from_handle(src_handle)
if source:
self.writeln( "src %s" %
(self.rem_spaces(source.get_title()))
)
def write_children(self,family, father):
father_lastname = father.get_primary_name().get_surname()
@ -380,7 +380,7 @@ class GeneWebWriter(object):
if place_handle:
place = self.db.get_place_from_handle(place_handle)
m_place = place.get_title()
m_source = self.get_primary_source( event.get_source_references())
m_source = self.get_primary_source( event.get_citation_list())
if event.get_type() == gen.lib.EventType.ENGAGEMENT:
engaged = 1
eng_date = self.format_date( event.get_date_object())
@ -388,7 +388,7 @@ class GeneWebWriter(object):
if place_handle:
place = self.db.get_place_from_handle(place_handle)
eng_place = place.get_title()
eng_source = self.get_primary_source( event.get_source_references())
eng_source = self.get_primary_source( event.get_citation_list())
if event.get_type() == gen.lib.EventType.DIVORCE:
divorced = 1
div_date = self.format_date( event.get_date_object())
@ -427,13 +427,13 @@ class GeneWebWriter(object):
def get_primary_source(self,reflist):
ret = ""
if reflist:
for sr in reflist:
sbase = sr.get_reference_handle()
if sbase:
source = self.db.get_source_from_handle(sbase)
if source:
if ret != "":
ret = ret + ", "
for handle in reflist:
citation = self.db.get_citation_from_handle(handle)
src_handle = citation.get_reference_handle()
source = self.db.get_source_from_handle(src_handle)
if source:
if ret != "":
ret = ret + ", "
ret = ret + source.get_title()
return ret

View File

@ -256,14 +256,12 @@ class GeneWebParser(object):
self.current_mode = None
return None
def read_source_line(self,line,fields):
if not self.current_family:
LOG.warn("Unknown family of child in line %d!" % self.lineno)
return None
source = self.get_or_create_source(self.decode(fields[1]))
self.current_family.add_source_reference(source)
self.current_family.add_citation(source.get_handle())
self.db.commit_family(self.current_family,self.trans)
return None
@ -341,7 +339,7 @@ class GeneWebParser(object):
birth.set_place_handle(self.current_child_birthplace_handle)
self.db.commit_event(birth,self.trans)
if self.current_child_source_handle:
child.add_source_reference(self.current_child_source_handle)
child.add_citation(self.current_child_source_handle)
self.db.commit_person(child,self.trans)
else:
break
@ -745,7 +743,7 @@ class GeneWebParser(object):
person.add_alternate_name(name)
if source:
person.add_source_reference(source)
person.add_citation(source.get_handle())
if birth_date or birth_place or birth_source:
birth = self.create_event(gen.lib.EventType.BIRTH, None, birth_date, birth_place, birth_source)
@ -833,7 +831,7 @@ class GeneWebParser(object):
if place:
event.set_place_handle(place.get_handle())
if source:
event.add_source_reference(source)
event.add_citation(source.get_handle())
self.db.add_event(event,self.trans)
self.db.commit_event(event,self.trans)
return event
@ -872,9 +870,11 @@ class GeneWebParser(object):
self.db.add_source(source,self.trans)
self.db.commit_source(source,self.trans)
self.skeys[source_name] = source.get_handle()
sref = gen.lib.SourceRef()
sref.set_reference_handle(source.get_handle())
return sref
citation = gen.lib.Citation()
citation.set_reference_handle(source.get_handle())
self.db.add_citation(citation, self.trans)
self.db.commit_citation(citation, self.trans)
return citation
def decode(self,s):
s = s.replace('_',' ')