Fixed deletection of missing zlib.so, and generation of sources for exporting GEDCOM
svn: r422
This commit is contained in:
parent
d2189f90df
commit
b9bbe6bedc
@ -29,7 +29,6 @@ from GrampsParser import *
|
|||||||
|
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
import gzip
|
|
||||||
import os
|
import os
|
||||||
from gnome.ui import *
|
from gnome.ui import *
|
||||||
import sys
|
import sys
|
||||||
@ -37,6 +36,12 @@ import sys
|
|||||||
import intl
|
import intl
|
||||||
_ = intl.gettext
|
_ = intl.gettext
|
||||||
|
|
||||||
|
try:
|
||||||
|
import gzip
|
||||||
|
gzip_ok = 1
|
||||||
|
except:
|
||||||
|
gzip_ok = 0
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Try to abstract SAX1 from SAX2
|
# Try to abstract SAX1 from SAX2
|
||||||
@ -64,6 +69,7 @@ def importData(database, filename, callback):
|
|||||||
parser = make_parser()
|
parser = make_parser()
|
||||||
parser.setContentHandler(GrampsImportParser(database,callback,basefile))
|
parser.setContentHandler(GrampsImportParser(database,callback,basefile))
|
||||||
|
|
||||||
|
if gzip_ok:
|
||||||
use_gzip = 1
|
use_gzip = 1
|
||||||
try:
|
try:
|
||||||
f = gzip.open(filename,"r")
|
f = gzip.open(filename,"r")
|
||||||
@ -72,6 +78,8 @@ def importData(database, filename, callback):
|
|||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
use_gzip = 0
|
use_gzip = 0
|
||||||
f.close()
|
f.close()
|
||||||
|
else:
|
||||||
|
use_gzip = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if use_gzip:
|
if use_gzip:
|
||||||
@ -123,6 +131,7 @@ def loadData(database, filename, callback=None):
|
|||||||
parser = make_parser()
|
parser = make_parser()
|
||||||
parser.setContentHandler(GrampsParser(database,callback,basefile))
|
parser.setContentHandler(GrampsParser(database,callback,basefile))
|
||||||
|
|
||||||
|
if gzip_ok:
|
||||||
use_gzip = 1
|
use_gzip = 1
|
||||||
try:
|
try:
|
||||||
f = gzip.open(filename,"r")
|
f = gzip.open(filename,"r")
|
||||||
@ -130,6 +139,9 @@ def loadData(database, filename, callback=None):
|
|||||||
f.close()
|
f.close()
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
use_gzip = 0
|
use_gzip = 0
|
||||||
|
f.close()
|
||||||
|
else:
|
||||||
|
use_gzip = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if use_gzip:
|
if use_gzip:
|
||||||
|
@ -24,10 +24,15 @@ import const
|
|||||||
import string
|
import string
|
||||||
import Config
|
import Config
|
||||||
import time
|
import time
|
||||||
import gzip
|
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
try:
|
||||||
|
import gzip
|
||||||
|
gzip_ok = 1
|
||||||
|
except:
|
||||||
|
gzip_ok = 0
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -324,10 +329,13 @@ def exportData(database, filename, callback):
|
|||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
shutil.copy(filename, filename + ".bak")
|
shutil.copy(filename, filename + ".bak")
|
||||||
|
|
||||||
if Config.uncompress:
|
if Config.uncompress ==0 and gzip_ok == 1:
|
||||||
|
try:
|
||||||
|
g = gzip.open(filename,"wb")
|
||||||
|
except:
|
||||||
g = open(filename,"w")
|
g = open(filename,"w")
|
||||||
else:
|
else:
|
||||||
g = gzip.open(filename,"wb")
|
g = open(filename,"w")
|
||||||
|
|
||||||
g.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
|
g.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
|
||||||
g.write('<!DOCTYPE database SYSTEM "gramps.dtd" []>\n')
|
g.write('<!DOCTYPE database SYSTEM "gramps.dtd" []>\n')
|
||||||
|
@ -202,7 +202,9 @@ def add_persons_sources(person):
|
|||||||
continue
|
continue
|
||||||
source_ref = event.getSourceRef()
|
source_ref = event.getSourceRef()
|
||||||
if source_ref != None:
|
if source_ref != None:
|
||||||
source_list.append(source_ref)
|
sbase = source_ref.getBase()
|
||||||
|
if sbase != None and sbase not in source_list:
|
||||||
|
source_list.append(sbase)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -215,7 +217,9 @@ def add_familys_sources(family):
|
|||||||
continue
|
continue
|
||||||
source_ref = event.getSourceRef()
|
source_ref = event.getSourceRef()
|
||||||
if source_ref != None:
|
if source_ref != None:
|
||||||
source_list.append(source_ref)
|
sbase = source_ref.getBase()
|
||||||
|
if sbase != None and sbase not in source_list:
|
||||||
|
source_list.append(sbase)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -539,6 +543,7 @@ def exportData(database, filename):
|
|||||||
g.write("1 CHIL @I%s@\n" % person.getId())
|
g.write("1 CHIL @I%s@\n" % person.getId())
|
||||||
|
|
||||||
for source in source_list:
|
for source in source_list:
|
||||||
|
print source
|
||||||
g.write("0 @S%s@ SOUR\n" % source.getId())
|
g.write("0 @S%s@ SOUR\n" % source.getId())
|
||||||
if source.getTitle() != "":
|
if source.getTitle() != "":
|
||||||
g.write("1 TITL %s\n" % cnvtxt(source.getTitle()))
|
g.write("1 TITL %s\n" % cnvtxt(source.getTitle()))
|
||||||
|
3214
gramps/src/po/fr.po
3214
gramps/src/po/fr.po
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user