From 5eb3f7e446b6df405ebc14e07af37036c0cb3fac Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Tue, 10 Feb 2009 05:59:26 +0000 Subject: [PATCH] Move common XML import/export data into libgrampsxml.py. svn: r11945 --- src/plugins/ExportXml.py | 8 ++--- src/plugins/ImportXml.py | 4 +-- src/plugins/lib/Makefile.am | 1 + src/plugins/lib/libgrampsxml.py | 54 +++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 src/plugins/lib/libgrampsxml.py diff --git a/src/plugins/ExportXml.py b/src/plugins/ExportXml.py index 319e51562..aeca796bb 100644 --- a/src/plugins/ExportXml.py +++ b/src/plugins/ExportXml.py @@ -63,6 +63,7 @@ from QuestionDialog import ErrorDialog import ExportOptions import gen.proxy from gen.plug import PluginManager, ExportPlugin +import libgrampsxml #------------------------------------------------------------------------- # @@ -76,8 +77,6 @@ try: except: _gzip_ok = 0 -XML_VERSION = "1.3.0" - # table for skipping control chars from XML strip_dict = dict.fromkeys(range(9)+range(12,20)) @@ -204,9 +203,10 @@ class GrampsDbXmlWriter(UpdateCallback): self.g.write('\n' - % (XML_VERSION, XML_VERSION)) + % (libgrampsxml.GRAMPS_XML_VERSION, + libgrampsxml.GRAMPS_XML_VERSION)) self.g.write('\n' - % XML_VERSION) + % libgrampsxml.GRAMPS_XML_VERSION) self.g.write("
\n") self.g.write(' ExportXml.XML_VERSION: + if parser.get_xmlns_version() > libgrampsxml.GRAMPS_XML_VERSION: msg = _("The .gramps file you are importing was made by version %s of " "GRAMPS, while you are running an older version %s. " "The file will not be imported. Please upgrade to the latest " diff --git a/src/plugins/lib/Makefile.am b/src/plugins/lib/Makefile.am index a062f0ba7..62e2c7c66 100644 --- a/src/plugins/lib/Makefile.am +++ b/src/plugins/lib/Makefile.am @@ -6,6 +6,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/plugins/lib pkgdata_PYTHON = \ + libgrampsxml.py\ libholiday.py\ libmapservice.py diff --git a/src/plugins/lib/libgrampsxml.py b/src/plugins/lib/libgrampsxml.py new file mode 100644 index 000000000..f2702df8d --- /dev/null +++ b/src/plugins/lib/libgrampsxml.py @@ -0,0 +1,54 @@ +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2009 Brian G. Matherly +# +# 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 + +# $Id$ + +#------------------------------------------------------------------------ +# +# python modules +# +#------------------------------------------------------------------------ +from gettext import gettext as _ + +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ +from gen.plug import PluginManager, Plugin + +#------------------------------------------------------------------------ +# +# Public Constants +# +#------------------------------------------------------------------------ +GRAMPS_XML_VERSION = "1.3.0" + +#------------------------------------------------------------------------ +# +# Register the plugins +# +#------------------------------------------------------------------------ +PluginManager.get_instance().register_plugin( +Plugin( + name = __name__, + description = _("Provides common functionality for Gramps XML " + "import/export."), + module_name = __name__ + ) +) \ No newline at end of file