* src/TarFile.py: Indent with spaces, remove string module.
* src/RelImage.py: Remove unused string module. * src/SubstKeywords.py: Remove string module. svn: r4604
This commit is contained in:
parent
6a5c66aa31
commit
41fef8d7d6
@ -14,6 +14,10 @@
|
|||||||
* src/plugins/StatisticsChart.py: Minor stylistic corrections.
|
* src/plugins/StatisticsChart.py: Minor stylistic corrections.
|
||||||
* src/GenericFilter.py: Minor stylistic corrections.
|
* src/GenericFilter.py: Minor stylistic corrections.
|
||||||
|
|
||||||
|
* src/TarFile.py: Indent with spaces, remove string module.
|
||||||
|
* src/RelImage.py: Remove unused string module.
|
||||||
|
* src/SubstKeywords.py: Remove string module.
|
||||||
|
|
||||||
2005-05-16 Don Allingham <don@gramps-project.org>
|
2005-05-16 Don Allingham <don@gramps-project.org>
|
||||||
* src/FamilyView.py: fix reordering of children in family view
|
* src/FamilyView.py: fix reordering of children in family view
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import string
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -37,10 +37,9 @@ __version__ = "$Revision$"
|
|||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# python classes
|
# Gramps modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import string
|
|
||||||
|
|
||||||
import NameDisplay
|
import NameDisplay
|
||||||
|
|
||||||
@ -126,15 +125,15 @@ class SubstKeywords:
|
|||||||
def replace(self,line):
|
def replace(self,line):
|
||||||
"""Returns a new line of text with the substitutions performed."""
|
"""Returns a new line of text with the substitutions performed."""
|
||||||
|
|
||||||
line = string.replace(line,"$n",self.n)
|
line = line.replace("$n",self.n)
|
||||||
line = string.replace(line,"$N",self.N)
|
line = line.replace("$N",self.N)
|
||||||
line = string.replace(line,"$b",self.b)
|
line = line.replace("$b",self.b)
|
||||||
line = string.replace(line,"$B",self.B)
|
line = line.replace("$B",self.B)
|
||||||
line = string.replace(line,"$d",self.d)
|
line = line.replace("$d",self.d)
|
||||||
line = string.replace(line,"$D",self.D)
|
line = line.replace("$D",self.D)
|
||||||
line = string.replace(line,"$i",self.i)
|
line = line.replace("$i",self.i)
|
||||||
line = string.replace(line,"$S",self.S)
|
line = line.replace("$S",self.S)
|
||||||
line = string.replace(line,"$s",self.s)
|
line = line.replace("$s",self.s)
|
||||||
line = string.replace(line,"$m",self.m)
|
line = line.replace("$m",self.m)
|
||||||
line = string.replace(line,"$M",self.M)
|
line = line.replace("$M",self.M)
|
||||||
return string.replace(line,"$$",'$')
|
return line.replace("$$",'$')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 Donald N. Allingham
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -17,9 +17,11 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
import gzip
|
import gzip
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import string
|
|
||||||
|
|
||||||
_BLKSIZE=512
|
_BLKSIZE=512
|
||||||
nul = '\0'
|
nul = '\0'
|
||||||
@ -87,75 +89,74 @@ class TarFile:
|
|||||||
class ReadTarFile:
|
class ReadTarFile:
|
||||||
def __init__(self,name,wd="/tmp"):
|
def __init__(self,name,wd="/tmp"):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.wd = wd
|
self.wd = wd
|
||||||
self.f = gzip.open(name,"rb")
|
self.f = gzip.open(name,"rb")
|
||||||
self.pos = 0
|
self.pos = 0
|
||||||
|
|
||||||
def extract_files(self):
|
def extract_files(self):
|
||||||
data = {}
|
data = {}
|
||||||
while 1:
|
while 1:
|
||||||
buf = self.f.read(100)
|
buf = self.f.read(100)
|
||||||
if buf == '':
|
if buf == '':
|
||||||
return
|
return
|
||||||
index = 0
|
index = 0
|
||||||
for b in buf:
|
for b in buf:
|
||||||
if b != nul:
|
if b != nul:
|
||||||
index = index + 1
|
index = index + 1
|
||||||
else:
|
else:
|
||||||
if index == 0:
|
if index == 0:
|
||||||
return data
|
return data
|
||||||
continue
|
continue
|
||||||
filename = buf[0:index]
|
filename = buf[0:index]
|
||||||
if filename == None:
|
if filename == None:
|
||||||
return data
|
return data
|
||||||
self.f.read(24) # modes
|
self.f.read(24) # modes
|
||||||
l = string.replace(self.f.read(12),chr(0),' ')
|
l = self.f.read(12)(chr(0),' ')
|
||||||
length = int(l,8)
|
length = int(l,8)
|
||||||
self.f.read(12)
|
self.f.read(12)
|
||||||
self.f.read(6)
|
self.f.read(6)
|
||||||
self.f.read(111)
|
self.f.read(111)
|
||||||
|
|
||||||
self.f.read(64)
|
self.f.read(64)
|
||||||
self.f.read(183)
|
self.f.read(183)
|
||||||
foo = cStringIO.StringIO()
|
foo = cStringIO.StringIO()
|
||||||
data[filename] = foo
|
data[filename] = foo
|
||||||
foo.write(self.f.read(length))
|
foo.write(self.f.read(length))
|
||||||
foo.reset()
|
foo.reset()
|
||||||
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def extract(self):
|
def extract(self):
|
||||||
while 1:
|
while 1:
|
||||||
buf = self.f.read(100)
|
buf = self.f.read(100)
|
||||||
if buf == '':
|
if buf == '':
|
||||||
return
|
return
|
||||||
index = 0
|
index = 0
|
||||||
for b in buf:
|
for b in buf:
|
||||||
if b != nul:
|
if b != nul:
|
||||||
index = index + 1
|
index = index + 1
|
||||||
else:
|
else:
|
||||||
if index == 0:
|
if index == 0:
|
||||||
return
|
return
|
||||||
continue
|
continue
|
||||||
filename = buf[0:index]
|
filename = buf[0:index]
|
||||||
self.f.read(24) # modes
|
self.f.read(24) # modes
|
||||||
l = self.f.read(12)
|
l = self.f.read(12)
|
||||||
length_string = "";
|
length_string = "";
|
||||||
for char in l:
|
for char in l:
|
||||||
if ord(char) != 0:
|
if ord(char) != 0:
|
||||||
length_string = length_string + char
|
length_string = length_string + char
|
||||||
length = int(length_string,8)
|
length = int(length_string,8)
|
||||||
self.f.read(12)
|
self.f.read(12)
|
||||||
self.f.read(6)
|
self.f.read(6)
|
||||||
self.f.read(111)
|
self.f.read(111)
|
||||||
|
|
||||||
self.f.read(64)
|
self.f.read(64)
|
||||||
self.f.read(183)
|
self.f.read(183)
|
||||||
foo = open("%s/%s" % (self.wd,filename),"wb")
|
foo = open("%s/%s" % (self.wd,filename),"wb")
|
||||||
foo.write(self.f.read(length))
|
foo.write(self.f.read(length))
|
||||||
foo.close()
|
foo.close()
|
||||||
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user