From 8e9f6a4219657146a76d596f0bffc55e6baa7d9d Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 1 Jan 2004 19:10:23 +0000 Subject: [PATCH] * src/const.py.in: eliminate zipcmd * src/docgen/OpenSpreadSheet.py: eliminate the need for ZIP, use python zipfile module instead * src/plugins/EventCmp.py (DisplayChart.on_save_clicked): fix rows, double lines no longer used * configure.in: add check for vfs bindings, eliminate the check for swig and zip * gramps.spec.in (Requires): Added gnome-python2-gnomevfs dependency svn: r2577 --- configure.in | 24 ++++++++- gramps.spec.in | 1 + src/const.py.in | 1 - src/docgen/OpenSpreadSheet.py | 99 +++++++++++++++++++++++++---------- src/plugins/EventCmp.py | 3 +- 5 files changed, 96 insertions(+), 32 deletions(-) diff --git a/configure.in b/configure.in index d5c27ff26..3edf45f98 100644 --- a/configure.in +++ b/configure.in @@ -45,8 +45,6 @@ pkgpythondir=\${prefix}/share/\${PACKAGE} pkgpyexecdir=\${prefix}/share/\${PACKAGE} AC_PATH_PROG(BINSH, sh) -AC_PATH_PROG(SWIG, swig) - AC_PATH_PROG(ZIP, zip) AC_PROG_CC @@ -159,6 +157,28 @@ then fi AC_MSG_RESULT(ok) +AC_MSG_CHECKING(Python bindings for GNOME VFS) +cat > conftest.py < conftest.py <= 2.2 Requires: gnome-python2 >= 1.99 Requires: gnome-python2-gconf >= 1.99 Requires: gnome-python2-canvas >= 1.99 +Requires: gnome-python2-gnomevfs >= 1.99 Requires: pygtk2 >= 1.99 Requires: pygtk2-libglade >= 1.99 diff --git a/src/const.py.in b/src/const.py.in index cbab3682c..59efd5747 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -40,7 +40,6 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- editor = "gimp" -zipcmd = "zip -r -q" convert = "convert" pixdir = "/usr/share/pixmaps" diff --git a/src/docgen/OpenSpreadSheet.py b/src/docgen/OpenSpreadSheet.py index deae762a9..20b3dbac7 100644 --- a/src/docgen/OpenSpreadSheet.py +++ b/src/docgen/OpenSpreadSheet.py @@ -18,16 +18,32 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +#------------------------------------------------------------------------- +# +# Standard Python Modules +# +#------------------------------------------------------------------------- import os import tempfile import string +import zipfile +#------------------------------------------------------------------------- +# +# Gramps modules +# +#------------------------------------------------------------------------- import BaseDoc from SpreadSheetDoc import * from latin_utf8 import latin_to_utf8 import const +#------------------------------------------------------------------------- +# +# OpenSpreadSheet +# +#------------------------------------------------------------------------- class OpenSpreadSheet(SpreadSheetDoc): def __init__(self,type,orientation): @@ -48,13 +64,16 @@ class OpenSpreadSheet(SpreadSheetDoc): self.filename = filename + ".sxc" else: self.filename = filename - - self.tempdir = tempfile.TemporaryFile() - os.mkdir(self.tempdir,0700) - os.mkdir(self.tempdir + os.sep + "Pictures") - os.mkdir(self.tempdir + os.sep + "META-INF") - - self.f = open(self.tempdir + os.sep + "content.xml","w") + + try: + self.content_xml = tempfile.mktemp() + self.f = open(self.content_xml,"wb") + except IOError,msg: + raise Errors.ReportError(_("Could not create %s") % self.content_xml, msg) + except: + raise Errors.ReportError(_("Could not create %s") % self.content_xml) + + self.f = open(self.content_xml,"w") self.f.write('\n') self.f.write('\n') self.f.write('\n') self.f.write('') @@ -386,9 +421,19 @@ class OpenSpreadSheet(SpreadSheetDoc): self.f.close() def _write_meta_file(self): - file = self.tempdir + os.sep + "meta.xml" + self.meta_xml = tempfile.mktemp() + + try: + self.f = open(self.meta_xml,"wb") + except IOError,msg: + errmsg = "%s\n%s" % (_("Could not create %s") % self.meta_xml, msg) + raise Errors.ReportError(errmsg) + except: + pass + raise Errors.ReportError(_("Could not create %s") % self.meta_xml) + name = latin_to_utf8(self.name) - self.f = open(file,"w") + self.f = open(self.meta_xml,"w") self.f.write('\n') self.f.write('