* 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:
Alex Roitman 2005-05-17 03:43:36 +00:00
parent 6a5c66aa31
commit 41fef8d7d6
4 changed files with 62 additions and 59 deletions

View File

@ -14,6 +14,10 @@
* src/plugins/StatisticsChart.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>
* src/FamilyView.py: fix reordering of children in family view

View File

@ -24,7 +24,6 @@
#
#-------------------------------------------------------------------------
import os
import string
#-------------------------------------------------------------------------
#

View File

@ -1,7 +1,7 @@
#
# 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
# 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
@ -126,15 +125,15 @@ class SubstKeywords:
def replace(self,line):
"""Returns a new line of text with the substitutions performed."""
line = string.replace(line,"$n",self.n)
line = string.replace(line,"$N",self.N)
line = string.replace(line,"$b",self.b)
line = string.replace(line,"$B",self.B)
line = string.replace(line,"$d",self.d)
line = string.replace(line,"$D",self.D)
line = string.replace(line,"$i",self.i)
line = string.replace(line,"$S",self.S)
line = string.replace(line,"$s",self.s)
line = string.replace(line,"$m",self.m)
line = string.replace(line,"$M",self.M)
return string.replace(line,"$$",'$')
line = line.replace("$n",self.n)
line = line.replace("$N",self.N)
line = line.replace("$b",self.b)
line = line.replace("$B",self.B)
line = line.replace("$d",self.d)
line = line.replace("$D",self.D)
line = line.replace("$i",self.i)
line = line.replace("$S",self.S)
line = line.replace("$s",self.s)
line = line.replace("$m",self.m)
line = line.replace("$M",self.M)
return line.replace("$$",'$')

View File

@ -1,7 +1,7 @@
#
# 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
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
import gzip
import cStringIO
import string
_BLKSIZE=512
nul = '\0'
@ -87,75 +89,74 @@ class TarFile:
class ReadTarFile:
def __init__(self,name,wd="/tmp"):
self.name = name
self.wd = wd
self.wd = wd
self.f = gzip.open(name,"rb")
self.pos = 0
def extract_files(self):
data = {}
while 1:
buf = self.f.read(100)
while 1:
buf = self.f.read(100)
if buf == '':
return
return
index = 0
for b in buf:
if b != nul:
index = index + 1
else:
if index == 0:
for b in buf:
if b != nul:
index = index + 1
else:
if index == 0:
return data
continue
filename = buf[0:index]
continue
filename = buf[0:index]
if filename == None:
return data
self.f.read(24) # modes
l = string.replace(self.f.read(12),chr(0),' ')
self.f.read(24) # modes
l = self.f.read(12)(chr(0),' ')
length = int(l,8)
self.f.read(12)
self.f.read(6)
self.f.read(111)
self.f.read(12)
self.f.read(6)
self.f.read(111)
self.f.read(64)
self.f.read(183)
self.f.read(64)
self.f.read(183)
foo = cStringIO.StringIO()
data[filename] = foo
foo.write(self.f.read(length))
foo.reset()
self.f.read(_BLKSIZE-(length%_BLKSIZE))
foo.write(self.f.read(length))
foo.reset()
self.f.read(_BLKSIZE-(length%_BLKSIZE))
return data
def extract(self):
while 1:
buf = self.f.read(100)
while 1:
buf = self.f.read(100)
if buf == '':
return
return
index = 0
for b in buf:
if b != nul:
index = index + 1
else:
if index == 0:
for b in buf:
if b != nul:
index = index + 1
else:
if index == 0:
return
continue
filename = buf[0:index]
self.f.read(24) # modes
continue
filename = buf[0:index]
self.f.read(24) # modes
l = self.f.read(12)
length_string = "";
for char in l:
if ord(char) != 0:
length_string = length_string + char
length = int(length_string,8)
self.f.read(12)
self.f.read(6)
self.f.read(111)
self.f.read(12)
self.f.read(6)
self.f.read(111)
self.f.read(64)
self.f.read(183)
self.f.read(64)
self.f.read(183)
foo = open("%s/%s" % (self.wd,filename),"wb")
foo.write(self.f.read(length))
foo.close()
self.f.read(_BLKSIZE-(length%_BLKSIZE))
foo.write(self.f.read(length))
foo.close()
self.f.read(_BLKSIZE-(length%_BLKSIZE))
def close(self):
self.f.close()