2006-04-21 Alex Roitman <shura@gramps-project.org>

* src/PluginUtils/_ReportUtils.py (buried_str): Typo.
	* src/plugins/DetDescendantReport.py (write_children): Use child_refs.
	* src/plugins/DetAncestralReport.py (write_children): Use child_refs.
	* src/plugins/IndivComplete.py (write_fact): Use new event type.
	* src/docgen/KwordDoc.py (KwordDoc.close): Use tarile.



svn: r6413
This commit is contained in:
Alex Roitman 2006-04-22 05:13:21 +00:00
parent 527d01a583
commit 6f6d2f5ad2
6 changed files with 40 additions and 21 deletions

View File

@ -1,3 +1,10 @@
2006-04-21 Alex Roitman <shura@gramps-project.org>
* src/PluginUtils/_ReportUtils.py (buried_str): Typo.
* src/plugins/DetDescendantReport.py (write_children): Use child_refs.
* src/plugins/DetAncestralReport.py (write_children): Use child_refs.
* src/plugins/IndivComplete.py (write_fact): Use new event type.
* src/docgen/KwordDoc.py (KwordDoc.close): Use tarile.
2006-04-21 Don Allingham <don@gramps-project.org>
* src/StartupDialog.py: fix close
* src/plugins/Desbrowser.py: Use ActivPersonTool

View File

@ -1989,7 +1989,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
burial = None
for event_ref in person.get_event_ref_list():
event = database.get_event_from_handle(event_ref.ref)
if event and int(event.get_type()) == RelLib.Event.BURIAL:
if event and int(event.get_type()) == RelLib.EventType.BURIAL:
burial = event
break

View File

@ -27,8 +27,8 @@
#------------------------------------------------------------------------
import time
import cStringIO
import gzip
import os
import tarfile
from gettext import gettext as _
#------------------------------------------------------------------------
@ -38,7 +38,6 @@ from gettext import gettext as _
#------------------------------------------------------------------------
import BaseDoc
import Errors
from TarFile import TarFile
from PluginUtils import register_text_doc
import ImgManip
import Mime
@ -254,7 +253,7 @@ class KwordDoc(BaseDoc.BaseDoc):
self.f.write('</DOC>\n')
try:
tar = TarFile(self.filename)
archive = tarfile.open(self.filename,'w:gz')
except IOError, msg:
text = _("Could not open %s") % self.filename
Errors.ReportError(text + "\n" + str(msg))
@ -263,14 +262,26 @@ class KwordDoc(BaseDoc.BaseDoc):
Errors.ReportError(_("Could not open %s") % self.filename)
return
tar.add_file("documentinfo.xml",self.mtime,self.m)
tar.add_file("maindoc.xml",self.mtime,self.f)
for filedata in self.media_list:
f = open(filedata[0],"r")
tar.add_file(filedata[1],self.mtime,f)
f.close()
tar.close()
tarinfo = tarfile.TarInfo('documentinfo.xml')
tarinfo.size = len(self.m.getvalue())
tarinfo.mtime = self.mtime
tarinfo.uid = os.getuid()
tarinfo.gid = os.getgid()
self.m.seek(0)
archive.addfile(tarinfo,self.m)
tarinfo = tarfile.TarInfo('maindoc.xml')
tarinfo.size = len(self.f.getvalue())
tarinfo.mtime = self.mtime
tarinfo.uid = os.getuid()
tarinfo.gid = os.getgid()
self.f.seek(0)
archive.addfile(tarinfo,self.f)
for filedata in self.media_list:
archive.add(filedata[0])
archive.close()
self.f.close()
self.m.close()

View File

@ -382,7 +382,7 @@ class DetAncestorReport(Report.Report):
""" List children.
"""
if not family.get_child_handle_list():
if not family.get_child_ref_list():
return
mother_handle = family.get_mother_handle()
@ -405,7 +405,8 @@ class DetAncestorReport(Report.Report):
self.doc.end_paragraph()
cnt = 1
for child_handle in family.get_child_handle_list():
for child_ref in family.get_child_ref_list():
child_handle = child_ref.ref
child = self.database.get_person_from_handle(child_handle)
child_name = _nd.display(child)

View File

@ -150,10 +150,10 @@ class DetDescendantReport(Report.Report):
index = 0
for family_handle in person.get_family_handle_list():
family = self.database.get_family_from_handle(family_handle)
for child_handle in family.get_child_handle_list():
child = self.database.get_family_from_handle(child_handle)
for child_ref in family.get_child_ref_list():
child = self.database.get_family_from_handle(child_ref.ref)
ix = max(self.map.keys())
self.apply_filter(child_handle, ix+1,
self.apply_filter(child_ref.ref, ix+1,
pid+HENRY[index], cur_gen+1)
index += 1
@ -410,7 +410,7 @@ class DetDescendantReport(Report.Report):
""" List children.
"""
if not family.get_child_handle_list():
if not family.get_child_ref_list():
return
mother_handle = family.get_mother_handle()
@ -433,7 +433,8 @@ class DetDescendantReport(Report.Report):
self.doc.end_paragraph()
cnt = 1
for child_handle in family.get_child_handle_list():
for child_ref in family.get_child_ref_list():
child_handle = child_ref.ref
child = self.database.get_person_from_handle(child_handle)
child_name = _nd.display(child)

View File

@ -113,8 +113,7 @@ class IndivCompleteReport(Report.Report):
def write_fact(self,event):
if event == None:
return
evtType = event.get_type()
name = Utils.format_event( evtType )
name = str(event.get_type())
date = DateHandler.get_date(event)
place_handle = event.get_place_handle()
if place_handle: