2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-28 05:41:40 +00:00
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
2003-11-23 20:55:14 +00:00
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
|
|
|
Contains the interface to allow a database to get written using
|
|
|
|
GRAMPS' XML file format.
|
|
|
|
"""
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# load standard python libraries
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-06 22:02:46 +00:00
|
|
|
from gettext import gettext as _
|
2002-10-20 14:25:16 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# load GRAMPS libraries
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
2002-10-21 01:18:07 +00:00
|
|
|
from QuestionDialog import ErrorDialog
|
2006-09-01 22:57:57 +00:00
|
|
|
|
2007-09-05 22:34:47 +00:00
|
|
|
import GrampsDb
|
2007-08-31 22:51:16 +00:00
|
|
|
import ExportOptions
|
2006-12-11 21:09:25 +00:00
|
|
|
|
2002-10-20 14:25:16 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-08-31 22:51:16 +00:00
|
|
|
def exportData(database, filename, person, option_box, callback=None):
|
2007-09-05 22:34:47 +00:00
|
|
|
return GrampsDb.exportData(database, filename, person, option_box,
|
|
|
|
callback, const.version)
|
2002-10-20 14:25:16 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2007-09-05 22:34:47 +00:00
|
|
|
# XmlWriter
|
2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-09-05 22:34:47 +00:00
|
|
|
class XmlWriter(GramspDb.GrampsDbXmlWriter):
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
|
|
|
Writes a database to the XML file.
|
|
|
|
"""
|
|
|
|
|
2007-04-08 04:24:38 +00:00
|
|
|
def __init__(self, db, callback, strip_photos, compress=1):
|
2007-09-05 22:34:47 +00:00
|
|
|
GrampsDb.GrampsDbXmlWriter.__init__(self, db, strip_photos, compress,
|
|
|
|
const.version, callback)
|
2002-10-20 14:25:16 +00:00
|
|
|
|
|
|
|
def write(self,filename):
|
|
|
|
"""
|
2003-04-20 03:52:54 +00:00
|
|
|
Write the database to the specified file.
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
2006-07-04 05:50:24 +00:00
|
|
|
try:
|
2007-09-05 22:34:47 +00:00
|
|
|
ret = GramspDb.GrampsDbXmlWriter.write(self, filename)
|
|
|
|
except GrampsDb.GrampsDbWriteFailure, val:
|
2007-02-17 22:12:56 +00:00
|
|
|
ErrorDialog(val[0],val[1])
|
2006-01-27 20:38:33 +00:00
|
|
|
|
2005-12-06 06:38:09 +00:00
|
|
|
return ret
|
2002-10-20 14:25:16 +00:00
|
|
|
|
2004-07-01 04:09:55 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2004-07-09 18:19:47 +00:00
|
|
|
_title = _('GRAMPS _XML database')
|
|
|
|
_description = _('The GRAMPS XML database is a format used by older '
|
|
|
|
'versions of GRAMPS. It is read-write compatible with '
|
|
|
|
'the present GRAMPS database format.')
|
2007-08-31 22:51:16 +00:00
|
|
|
_config = (_('GRAMPS XML export options'), ExportOptions.WriterOptionBox)
|
2004-07-09 18:19:47 +00:00
|
|
|
_filename = 'gramps'
|
2004-07-01 04:09:55 +00:00
|
|
|
|
2006-03-11 01:12:06 +00:00
|
|
|
from PluginUtils import register_export
|
2004-07-09 18:19:47 +00:00
|
|
|
register_export(exportData,_title,_description,_config,_filename)
|