2007-09-01 Don Allingham <don@gramps-project.org>

* src/GrampsDbUtils/_GedcomParse.py (GedcomParser.__event_inline_note): 
	fix note assignment
	
2007-09-01  Serge Noiraud  <Serge.Noiraud@free.fr>
	* src/GrampsDbUtils/_GedcomParse.py (GedcomParser.__event_inline_note): 
	fix level handling



svn: r8912
This commit is contained in:
Don Allingham 2007-09-01 15:07:52 +00:00
parent f61dfea6f9
commit 6593d5eb14
5 changed files with 3508 additions and 3520 deletions

View File

@ -1,3 +1,11 @@
2007-09-01 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomParse.py (GedcomParser.__event_inline_note):
fix note assignment
2007-09-01 Serge Noiraud <Serge.Noiraud@free.fr>
* src/GrampsDbUtils/_GedcomParse.py (GedcomParser.__event_inline_note):
fix level handling
2007-09-01 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/docgen/GtkPrint.py: Debugging disabled.

View File

@ -114,7 +114,7 @@ def exportData(database, filename, person, option_box, callback, version="unknow
if not option_box.cfilter.is_empty():
from GrampsDbUtils._FilterProxyDb import FilterProxyDb
database = FilterProxyDb(database, self.option_box.cfilter)
database = FilterProxyDb(database, option_box.cfilter)
g = GrampsDbXmlWriter(database, 0, compress, version, callback)
ret = g.write(filename)
@ -272,10 +272,8 @@ class GrampsDbXmlWriter(UpdateCallback):
if event_len > 0:
self.g.write(" <events>\n")
sorted_keys = self.db.get_gramps_ids(EVENT_KEY)
sorted_keys.sort ()
for gramps_id in sorted_keys:
event = self.db.get_event_from_gramps_id(gramps_id)
for handle in self.db.get_event_handles():
event = self.db.get_event_from_handle(handle)
self.write_event(event,2)
self.update()
self.g.write(" </events>\n")
@ -284,75 +282,59 @@ class GrampsDbXmlWriter(UpdateCallback):
self.g.write(" <people")
person = self.db.get_default_person()
if person:
self.g.write(' default="%s" home="_%s"' %
(person.gramps_id,person.handle))
self.g.write(' home="_%s"' % person.handle)
self.g.write('>\n')
sorted_keys = self.db.get_gramps_ids(PERSON_KEY)
sorted_keys.sort()
for gramps_id in sorted_keys:
person = self.db.get_person_from_gramps_id(gramps_id)
for handle in self.db.get_person_handles():
person = self.db.get_person_from_handle(handle)
self.write_person(person, 2)
self.update()
self.g.write(" </people>\n")
if family_len > 0:
self.g.write(" <families>\n")
sorted_keys = self.db.get_gramps_ids(FAMILY_KEY)
sorted_keys.sort ()
for gramps_id in sorted_keys:
family = self.db.get_family_from_gramps_id(gramps_id)
for handle in self.db.get_family_handles():
family = self.db.get_family_from_handle(handle)
self.write_family(family,2)
self.update()
self.g.write(" </families>\n")
if source_len > 0:
self.g.write(" <sources>\n")
keys = self.db.get_gramps_ids(SOURCE_KEY)
keys.sort ()
for key in keys:
source = self.db.get_source_from_gramps_id(key)
for handle in self.db.get_source_handles():
source = self.db.get_source_from_handle(handle)
self.write_source(source,2)
self.g.write(" </sources>\n")
if place_len > 0:
self.g.write(" <places>\n")
keys = self.db.get_gramps_ids(PLACE_KEY)
keys.sort ()
for key in keys:
for key in self.db.get_place_handles():
# try:
place = self.db.get_place_from_gramps_id(key)
place = self.db.get_place_from_handle(key)
self.write_place_obj(place,2)
self.update()
self.g.write(" </places>\n")
if obj_len > 0:
self.g.write(" <objects>\n")
sorted_keys = self.db.get_gramps_ids(MEDIA_KEY)
sorted_keys.sort ()
for gramps_id in sorted_keys:
obj = self.db.get_object_from_gramps_id(gramps_id)
for handle in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(handle)
self.write_object(obj,2)
self.update()
self.g.write(" </objects>\n")
if repo_len > 0:
self.g.write(" <repositories>\n")
keys = self.db.get_gramps_ids(REPOSITORY_KEY)
keys.sort ()
for key in keys:
repo = self.db.get_repository_from_gramps_id(key)
for key in self.db.get_repository_handles():
repo = self.db.get_repository_from_handle(key)
self.write_repository(repo,2)
self.update()
self.g.write(" </repositories>\n")
if note_len > 0:
self.g.write(" <notes>\n")
sorted_keys = self.db.get_gramps_ids(NOTE_KEY)
sorted_keys.sort()
for gramps_id in sorted_keys:
note = self.db.get_note_from_gramps_id(gramps_id)
for key in self.db.get_note_handles():
note = self.db.get_note_from_handle(key)
self.write_note(note,2)
self.update()
self.g.write(" </notes>\n")

View File

@ -304,7 +304,7 @@ class FilterProxyDb(ProxyDbBase):
def get_default_person(self):
"""returns the default Person of the database"""
person = self.db.get_default_person()
if person.get_handle() in self.plist:
if person and person.get_handle() in self.plist:
return person
else:
return None

View File

@ -3174,8 +3174,8 @@ class GedcomParser(UpdateCallback):
new_note = RelLib.Note(line.data)
new_note.set_handle(Utils.create_id())
self.dbase.add_note(new_note, self.trans)
self.__skip_subordinate_levels(level+2)
obj.add_note(new_note.get_handle())
self.__skip_subordinate_levels(state.level+2)
state.event.add_note(new_note.get_handle())
def __event_source(self, line, state):
"""

View File

@ -940,8 +940,6 @@ class GrampsParser(UpdateCallback):
def start_people(self,attrs):
if attrs.has_key('home'):
self.home = attrs['home'].replace('_','')
elif attrs.has_key("default"):
self.tempDefault = attrs["default"]
def start_father(self,attrs):
try: