From af618d3079c24da31d722d99b68a1aebdd83a8c3 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 4 Sep 2007 03:21:44 +0000 Subject: [PATCH] 2007-09-03 Don Allingham * plugins/WritePkg.py: fix package export * GrampsDbUtils/_WriteXML.py: fix package export svn: r8925 --- ChangeLog | 4 ++++ src/GrampsDbUtils/_WriteXML.py | 3 ++- src/plugins/WritePkg.py | 34 ++++++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a82241e34..5f1f42526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-03 Don Allingham + * plugins/WritePkg.py: fix package export + * GrampsDbUtils/_WriteXML.py: fix package export + 2007-09-03 Zsolt Foldvari * src/docgen/gtkprintpreview.glade: Hide Print button for now. * src/docgen/GtkPrint.py: Print dialog comes back after Preview is diff --git a/src/GrampsDbUtils/_WriteXML.py b/src/GrampsDbUtils/_WriteXML.py index 9db92d82b..8703da81f 100644 --- a/src/GrampsDbUtils/_WriteXML.py +++ b/src/GrampsDbUtils/_WriteXML.py @@ -83,7 +83,8 @@ class XmlWriter(GrampsDbXmlWriter): def __init__(self, db, callback, strip_photos, compress=1): """ """ - GrampsDbXmlWriter.__init__(self, db, strip_photos, compress, const.version) + GrampsDbXmlWriter.__init__(self, db, strip_photos, compress, + const.version, callback) def write(self,filename): """ diff --git a/src/plugins/WritePkg.py b/src/plugins/WritePkg.py index 0bda6fd16..d98f0c88b 100644 --- a/src/plugins/WritePkg.py +++ b/src/plugins/WritePkg.py @@ -33,6 +33,8 @@ import sys import tarfile from cStringIO import StringIO from gettext import gettext as _ +import ExportOptions +from BasicUtils import UpdateCallback #------------------------------------------------------------------------ # @@ -65,9 +67,28 @@ from PluginUtils import register_export # writeData # #------------------------------------------------------------------------- -def writeData(database,filename,person,callback=None): +def writeData(database, filename, person, option_box, callback=None): ret = 0 - writer = PackageWriter(database,filename,callback) + + option_box.parse_options() + + restrict = option_box.restrict + private = option_box.private + + if private: + from GrampsDbUtils._PrivateProxyDb import PrivateProxyDb + database = PrivateProxyDb(database) + + if restrict: + from GrampsDbUtils._LivingProxyDb import LivingProxyDb + database = LivingProxyDb(database, LivingProxyDb.MODE_RESTRICT) + + if not option_box.cfilter.is_empty(): + from GrampsDbUtils._FilterProxyDb import FilterProxyDb + database = FilterProxyDb(database, option_box.cfilter) + + + writer = PackageWriter(database, filename, callback) ret = writer.export() return ret @@ -185,7 +206,7 @@ class PackageWriter: # Write XML now g = StringIO() - gfile = XmlWriter(self.db,self.callback,2) + gfile = XmlWriter(self.db, self.callback, 2) gfile.write_handle(g) tarinfo = tarfile.TarInfo('data.gramps') tarinfo.size = len(g.getvalue()) @@ -206,8 +227,9 @@ class PackageWriter: # #------------------------------------------------------------------------- _title = _('GRAM_PS package (portable XML)') -_description = _('GRAMPS package is an archived XML database together with the media object files.') -_config = None +_description = _('GRAMPS package is an archived XML database together ' + 'with the media object files.') +_config = (_('GRAMPS package export options'), ExportOptions.WriterOptionBox) _filename = 'gpkg' -register_export(writeData,_title,_description,_config,_filename) +register_export(writeData, _title, _description, _config, _filename)