6195: Import citation for pro-gen file format (patch by keestux)
svn: r21658
This commit is contained in:
parent
063efad45f
commit
56136e1083
@ -54,7 +54,7 @@ from gramps.gui.utils import ProgressMeter
|
|||||||
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Date, Event,
|
from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Date, Event,
|
||||||
EventRef, EventType, Family, FamilyRelType, Name,
|
EventRef, EventType, Family, FamilyRelType, Name,
|
||||||
NameType, Note, NoteType, Person, Place, Source,
|
NameType, Note, NoteType, Person, Place, Source,
|
||||||
Surname)
|
Surname, Citation)
|
||||||
from gramps.gen.db import DbTxn
|
from gramps.gen.db import DbTxn
|
||||||
|
|
||||||
class ProgenError(Exception):
|
class ProgenError(Exception):
|
||||||
@ -599,12 +599,11 @@ class ProgenParser(object):
|
|||||||
self.db.add_source(source, self.trans)
|
self.db.add_source(source, self.trans)
|
||||||
self.db.commit_source(source, self.trans)
|
self.db.commit_source(source, self.trans)
|
||||||
self.skeys[source_name] = source.get_handle()
|
self.skeys[source_name] = source.get_handle()
|
||||||
raise Error('Sourceref no longer exists, this piece must be converted to citation!')
|
sref = Citation()
|
||||||
sref = SourceRef()
|
|
||||||
sref.set_reference_handle(source.get_handle())
|
sref.set_reference_handle(source.get_handle())
|
||||||
return sref
|
return sref
|
||||||
|
|
||||||
def __create_event_and_ref(self, type_, desc=None, date=None, place=None, source=None):
|
def __create_event_and_ref(self, type_, desc=None, date=None, place=None, citation=None):
|
||||||
event = Event()
|
event = Event()
|
||||||
event.set_type(EventType(type_))
|
event.set_type(EventType(type_))
|
||||||
if desc:
|
if desc:
|
||||||
@ -613,8 +612,8 @@ class ProgenParser(object):
|
|||||||
event.set_date_object(date)
|
event.set_date_object(date)
|
||||||
if place:
|
if place:
|
||||||
event.set_place_handle(place.get_handle())
|
event.set_place_handle(place.get_handle())
|
||||||
if source:
|
if citation:
|
||||||
event.add_source_reference(source)
|
event.add_citation(citation.handle)
|
||||||
self.db.add_event(event, self.trans)
|
self.db.add_event(event, self.trans)
|
||||||
self.db.commit_event(event, self.trans)
|
self.db.commit_event(event, self.trans)
|
||||||
event_ref = EventRef()
|
event_ref = EventRef()
|
||||||
|
Loading…
Reference in New Issue
Block a user