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 3ee48954ea
commit b9371e2e08
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> 2006-04-21 Don Allingham <don@gramps-project.org>
* src/StartupDialog.py: fix close * src/StartupDialog.py: fix close
* src/plugins/Desbrowser.py: Use ActivPersonTool * 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 burial = None
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
event = database.get_event_from_handle(event_ref.ref) 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 burial = event
break break

View File

@ -27,8 +27,8 @@
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import time import time
import cStringIO import cStringIO
import gzip
import os import os
import tarfile
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -38,7 +38,6 @@ from gettext import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import BaseDoc import BaseDoc
import Errors import Errors
from TarFile import TarFile
from PluginUtils import register_text_doc from PluginUtils import register_text_doc
import ImgManip import ImgManip
import Mime import Mime
@ -254,7 +253,7 @@ class KwordDoc(BaseDoc.BaseDoc):
self.f.write('</DOC>\n') self.f.write('</DOC>\n')
try: try:
tar = TarFile(self.filename) archive = tarfile.open(self.filename,'w:gz')
except IOError, msg: except IOError, msg:
text = _("Could not open %s") % self.filename text = _("Could not open %s") % self.filename
Errors.ReportError(text + "\n" + str(msg)) Errors.ReportError(text + "\n" + str(msg))
@ -262,15 +261,27 @@ class KwordDoc(BaseDoc.BaseDoc):
except: except:
Errors.ReportError(_("Could not open %s") % self.filename) Errors.ReportError(_("Could not open %s") % self.filename)
return 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.f.close()
self.m.close() self.m.close()

View File

@ -382,7 +382,7 @@ class DetAncestorReport(Report.Report):
""" List children. """ List children.
""" """
if not family.get_child_handle_list(): if not family.get_child_ref_list():
return return
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
@ -405,7 +405,8 @@ class DetAncestorReport(Report.Report):
self.doc.end_paragraph() self.doc.end_paragraph()
cnt = 1 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 = self.database.get_person_from_handle(child_handle)
child_name = _nd.display(child) child_name = _nd.display(child)

View File

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

View File

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