Fixes based off of pychecker results

svn: r539
This commit is contained in:
Don Allingham 2001-11-02 06:55:19 +00:00
parent f43c3cf7b4
commit d5acdb775e
41 changed files with 1455 additions and 1377 deletions

View File

@ -24,7 +24,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import string
import os import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -32,16 +31,17 @@ import os
# internationalization # internationalization
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import intl
_ = intl.gettext from intl import gettext
_ = gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import * #from gtk import *
from gnome.ui import * from gnome.ui import GnomeErrorDialog
import libglade import libglade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -49,11 +49,10 @@ import libglade
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import *
import const import const
import utils import utils
import RelImage import RelImage
from RelLib import Photo
class AddMediaObject: class AddMediaObject:

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -153,7 +153,7 @@ class Bookmarks :
def on_ok_clicked(self,obj): def on_ok_clicked(self,obj):
del self.bookmarks[0:] del self.bookmarks[0:]
for index in range(0,self.index): for index in range(0,self.namelist.rows):
person = self.namelist.get_row_data(index) person = self.namelist.get_row_data(index)
if person: if person:
self.bookmarks.append(person) self.bookmarks.append(person)

View File

@ -24,7 +24,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import string import string
import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -270,15 +269,15 @@ class ChooseParents:
main = self.person.getMainFamily() main = self.person.getMainFamily()
if main: if main:
main.removeChild(self.person) main.removeChild(self.person)
active_person.setMainFamily(None) self.person.setMainFamily(None)
else: else:
for fam in self.person.getAltFamilyList(): for fam in self.person.getAltFamilyList():
if is_main: if is_main:
self.person.removeAltFamily(fam[0]) self.person.removeAltFamily(fam[0])
fam.removeChild(active_person) fam.removeChild(self.person)
return return
elif family == self.person.getMainFamily(): elif family == self.person.getMainFamily():
family.addChild(selfperson) family.addChild(self.person)
if not is_main: if not is_main:
utils.modified() utils.modified()
self.person.setMainFamily(None) self.person.setMainFamily(None)

View File

@ -20,7 +20,8 @@
"Support for the dates" "Support for the dates"
import re from re import IGNORECASE, compile
import string import string
import intl import intl
@ -43,11 +44,11 @@ class Date:
from_str = _("(from|between|bet|bet.)") from_str = _("(from|between|bet|bet.)")
to_str = _("(and|to|-)") to_str = _("(and|to|-)")
efmt = re.compile(r"\s*(from|between|bet)\s+(.+)\s+(and|to)\s+(.+)\s*$", efmt = compile(r"\s*(from|between|bet)\s+(.+)\s+(and|to)\s+(.+)\s*$",
re.IGNORECASE) IGNORECASE)
fmt = re.compile(r"\s*" + from_str + r"\s+(.+)\s+" + to_str + r"\s+(.+)\s*$", fmt = compile(r"\s*" + from_str + r"\s+(.+)\s+" + to_str + r"\s+(.+)\s*$",
re.IGNORECASE) IGNORECASE)
def __init__(self,source=None): def __init__(self,source=None):
if source: if source:
@ -317,22 +318,15 @@ class SingleDate:
start = "^\s*" + modifiers + "?\s*" start = "^\s*" + modifiers + "?\s*"
fmt1 = re.compile(start + "(\S+)(\s+\d+\s*,)?\s*(\d+)?\s*$", fmt1 = compile(start + "(\S+)(\s+\d+\s*,)?\s*(\d+)?\s*$", IGNORECASE)
re.IGNORECASE) fmt2 = compile(start + "(\d+)\.?\s+(\S+)(\s+\d+)?\s*$", IGNORECASE)
fmt2 = re.compile(start + "(\d+)\.?\s+(\S+)(\s+\d+)?\s*$", quick= compile(start + "(\d+)?\s(\S\S\S)?\s(\d+)?", IGNORECASE)
re.IGNORECASE) fmt3 = compile(start + r"([?\d]+)\s*[./-]\s*([?\d]+)\s*[./-]\s*([?\d]+)\s*$",
quick= re.compile(start + "(\d+)?\s(\S\S\S)?\s(\d+)?", IGNORECASE)
re.IGNORECASE) fmt7 = compile(start + r"([?\d]+)\s*[./-]\s*([?\d]+)\s*$", IGNORECASE)
fmt3 = re.compile(start + r"([?\d]+)\s*[./-]\s*([?\d]+)\s*[./-]\s*([?\d]+)\s*$", fmt4 = compile(start + "(\S+)\s+(\d+)\s*$", IGNORECASE)
re.IGNORECASE) fmt5 = compile(start + "(\d+)\s*$", IGNORECASE)
fmt7 = re.compile(start + r"([?\d]+)\s*[./-]\s*([?\d]+)\s*$", fmt6 = compile(start + "(\S+)\s*$", IGNORECASE)
re.IGNORECASE)
fmt4 = re.compile(start + "(\S+)\s+(\d+)\s*$",
re.IGNORECASE)
fmt5 = re.compile(start + "(\d+)\s*$",
re.IGNORECASE)
fmt6 = re.compile(start + "(\S+)\s*$",
re.IGNORECASE)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -502,11 +496,6 @@ class SingleDate:
return retval return retval
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt1(self): def getFmt1(self):
if self.month == -1 and self.day == -1 and self.year == -1 : if self.month == -1 and self.day == -1 and self.year == -1 :

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -46,7 +45,6 @@ import const
import utils import utils
import Config import Config
from RelLib import * from RelLib import *
import RelImage
import ImageSelect import ImageSelect
import sort import sort

View File

@ -38,11 +38,6 @@ _ = intl.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Filter: class Filter:
#-------------------------------------------------------------------------
#
# Initializes the class
#
#-------------------------------------------------------------------------
def __init__(self,text): def __init__(self,text):
self.text = text self.text = text
self.invert = 0 self.invert = 0

View File

@ -24,7 +24,6 @@ import string
import os import os
import sys import sys
import utils import utils
import gnome.mime
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -212,7 +212,6 @@ class Gallery(ImageSelect):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def add_thumbnail(self, photo): def add_thumbnail(self, photo):
object = photo.getReference() object = photo.getReference()
path = object.getPath()
thumb = utils.thumb_path(self.db.getSavePath(),object) thumb = utils.thumb_path(self.db.getSavePath(),object)
self.icon_list.append(thumb,object.getDescription()) self.icon_list.append(thumb,object.getDescription())
@ -435,7 +434,6 @@ class LocalMediaProperties:
fname = self.object.getPath() fname = self.object.getPath()
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description") self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description")
window = self.change_dialog.get_widget("change_description")
descr_window = self.change_dialog.get_widget("description") descr_window = self.change_dialog.get_widget("description")
pixmap = self.change_dialog.get_widget("pixmap") pixmap = self.change_dialog.get_widget("pixmap")
self.attr_type = self.change_dialog.get_widget("attr_type") self.attr_type = self.change_dialog.get_widget("attr_type")
@ -520,7 +518,6 @@ class GlobalMediaProperties:
self.path = self.db.getSavePath() self.path = self.db.getSavePath()
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_global") self.change_dialog = libglade.GladeXML(const.imageselFile,"change_global")
window = self.change_dialog.get_widget("change_global")
descr_window = self.change_dialog.get_widget("description") descr_window = self.change_dialog.get_widget("description")
pixmap = self.change_dialog.get_widget("pixmap") pixmap = self.change_dialog.get_widget("pixmap")
self.attr_type = self.change_dialog.get_widget("attr_type") self.attr_type = self.change_dialog.get_widget("attr_type")

View File

@ -27,16 +27,15 @@ import os
import gzip import gzip
from TarFile import TarFile from TarFile import TarFile
#------------------------------------------------------------------------ try:
# import PIL.Image
# no_pil = 0
# except:
#------------------------------------------------------------------------ no_pil = 1
def sizes(val):
mm = val*10 def points(val):
inch = val/2.54 inch = float(val)/2.54
points = int(inch*72) return (int(inch*72))
return (points,utils.fl2txt("%.6f",mm),utils.fl2txt("%.6f",inch))
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -46,7 +45,7 @@ def sizes(val):
class KwordDoc(TextDoc): class KwordDoc(TextDoc):
def open(self,filename): def open(self,filename):
self.photolist = [] self.photo_list = []
if filename[-4:] != ".kwd": if filename[-4:] != ".kwd":
self.filename = filename + ".kwd" self.filename = filename + ".kwd"
@ -79,9 +78,11 @@ class KwordDoc(TextDoc):
self.m.write('</about>\n') self.m.write('</about>\n')
self.m.write('</document-info>\n') self.m.write('</document-info>\n')
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n') self.f.write('<?xml version="1.0" encoding="UTF-8"?>')
self.f.write('<DOC editor="KWord" mime="application/x-kword" ') self.f.write('<!DOCTYPE DOC >')
self.f.write('syntaxVersion="1">\n') self.f.write('<DOC mime="application/x-kword" syntaxVersion="2" ')
self.f.write('editor="KWord" >\n')
self.mtime = time.time()
if self.paper.name == "A3": if self.paper.name == "A3":
self.f.write('<PAPER format="0" ') self.f.write('<PAPER format="0" ')
@ -98,49 +99,63 @@ class KwordDoc(TextDoc):
else: else:
self.f.write('<PAPER format="6" ') self.f.write('<PAPER format="6" ')
self.f.write('ptWidth="%d" mmWidth ="%s" inchWidth ="%s" ' % sizes(self.width)) self.f.write('width="%d" ' % points(self.width))
self.f.write('ptHeight="%d" mmHeight="%s" inchHeight="%s" ' % sizes(self.height)) self.f.write('height="%d" ' % points(self.height))
if self.orientation == PAPER_PORTRAIT: if self.orientation == PAPER_PORTRAIT:
self.f.write('orientation="0" ') self.f.write('orientation="0" ')
else: else:
self.f.write('orientation="1" ') self.f.write('orientation="1" ')
self.f.write('columns="1" ') self.f.write('columns="1" ')
self.f.write('ptColumnspc="2" ') self.f.write('columnspacing="2.83" ')
self.f.write('mmColumnspc="1" ')
self.f.write('inchColumnspc="0.0393701" ')
self.f.write('hType="0" ') self.f.write('hType="0" ')
self.f.write('fType="0" ') self.f.write('fType="0" ')
self.f.write('ptHeadBody="9" ') self.f.write('spHeadBody="9" ')
self.f.write('ptFootBody="9" ') self.f.write('spFootBody="9">\n')
self.f.write('mmHeadBody="3.5" ')
self.f.write('mmFootBody="3.5" ')
self.f.write('inchHeadBody="0.137795" ')
self.f.write('inchFootBody="0.137795">\n')
self.f.write('<PAPERBORDERS ') self.f.write('<PAPERBORDERS ')
self.f.write('ptTop="%d" mmTop="%s" inchTop="%s" ' % sizes(self.tmargin)) self.f.write('top="%d" ' % points(self.tmargin))
self.f.write('ptRight="%d" mmRight="%s" inchRight="%s" ' % sizes(self.rmargin)) self.f.write('right="%d" ' % points(self.rmargin))
self.f.write('ptBottom="%d" mmBottom="%s" inchBottom="%s"\n' % sizes(self.bmargin)) self.f.write('bottom="%d" ' % points(self.bmargin))
self.f.write('ptLeft="%d" mmLeft="%s" inchLeft="%s"/>' % sizes(self.lmargin)) self.f.write('left="%d"/>' % points(self.lmargin))
self.f.write('</PAPER>\n') self.f.write('</PAPER>\n')
self.f.write('<ATTRIBUTES processing="0" ') self.f.write('<ATTRIBUTES processing="0" ')
self.f.write('standardpage="1" ') self.f.write('standardpage="1" ')
self.f.write('hasTOC="0" ')
self.f.write('hasHeader="0" ') self.f.write('hasHeader="0" ')
self.f.write('hasFooter="0" ') self.f.write('hasFooter="0" ')
self.f.write('unit="mm"/>\n') self.f.write('unit="mm"/>\n')
self.f.write('<FRAMESETS>\n') self.f.write('<FRAMESETS>\n')
self.f.write('<FRAMESET frameType="1" ') self.f.write('<FRAMESET frameType="1" ')
self.f.write('frameInfo="0" ') self.f.write('frameInfo="0" ')
self.f.write('removable="0" ')
self.f.write('visible="1" ')
self.f.write('name="Frameset 1">\n') self.f.write('name="Frameset 1">\n')
self.f.write('<FRAME left="28" ') self.f.write('<FRAME left="%d" ' % points(self.lmargin))
self.f.write('top="42" ') self.f.write('top="%d" ' % points(self.tmargin))
self.f.write('right="566" ') self.f.write('right="%d" ' % points(self.width-self.rmargin))
self.f.write('bottom="798" ') self.f.write('bottom="%d" ' % points(self.height-self.bmargin))
self.f.write('runaround="1" />\n') self.f.write('runaround="1" />\n')
def close(self): def close(self):
self.f.write('</FRAMESET>\n') self.f.write('</FRAMESET>\n')
for p in self.photo_list:
self.f.write('<FRAMESET frameType="2" frameInfo="0" ')
self.f.write('name="%s" visible="1">\n' % p[1])
self.f.write('<FRAME runaround="1" copy="0" newFrameBehaviour="1" ')
self.f.write('right="%d" ' % p[2])
self.f.write('left="0" ')
self.f.write('bottom="%d" ' % p[3])
self.f.write('top="0" ')
self.f.write('runaroundGap="2.8"/>\n')
self.f.write('<IMAGE keepAspectRatio="true">\n')
self.f.write('<KEY filename="%s" ' % p[1])
a = time.localtime(self.mtime)
self.f.write('msec="%d" ' % a[6])
self.f.write('second="%d" ' % a[5])
self.f.write('minute="%d" ' % a[4])
self.f.write('hour="%d" ' % a[3])
self.f.write('day="%d" ' % a[2])
self.f.write('month="%d" ' % a[1])
self.f.write('year="%d"/>\n' % a[0])
self.f.write('</IMAGE>\n')
self.f.write('</FRAMESET>\n')
self.f.write('</FRAMESETS>\n') self.f.write('</FRAMESETS>\n')
self.f.write('<STYLES>\n') self.f.write('<STYLES>\n')
for name in self.style_list.keys(): for name in self.style_list.keys():
@ -149,23 +164,22 @@ class KwordDoc(TextDoc):
p = self.style_list[name] p = self.style_list[name]
padding = p.get_padding() pad = points(p.get_padding())/2
self.f.write('<OFOOT pt="%d" mm="%s" inch="%s"/>\n' % sizes(padding)) self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
if p.get_alignment() == PARA_ALIGN_CENTER: if p.get_alignment() == PARA_ALIGN_CENTER:
self.f.write('<FLOW value="2"/>\n') self.f.write('<FLOW value="center"/>\n')
elif p.get_alignment() == PARA_ALIGN_JUSTIFY: elif p.get_alignment() == PARA_ALIGN_JUSTIFY:
self.f.write('<FLOW value="3"/>\n') self.f.write('<FLOW value="justify"/>\n')
elif p.get_alignment() == PARA_ALIGN_RIGHT: elif p.get_alignment() == PARA_ALIGN_RIGHT:
self.f.write('<FLOW value="1"/>\n') self.f.write('<FLOW value="right"/>\n')
else:
self.f.write('<FLOW value="left"/>\n')
first = p.get_first_indent() first = p.get_first_indent()
left = p.get_left_margin() left = p.get_left_margin()
right = p.get_right_margin()
first = left+first self.f.write('<INDENTS first="%d" ' % points(first))
if first != 0: self.f.write('left="%d" right="%d"/>\n' % (points(left),points(right)))
self.f.write('<IFIRST pt="%d" mm="%s" inch="%s"/>\n' % sizes(first))
if left != 0:
self.f.write('<ILEFT pt="%d" mm="%s" inch="%s"/>\n' % sizes(left))
font = p.get_font() font = p.get_font()
self.f.write('<FORMAT>\n') self.f.write('<FORMAT>\n')
@ -181,6 +195,7 @@ class KwordDoc(TextDoc):
self.f.write('<ITALIC value="1"/>\n') self.f.write('<ITALIC value="1"/>\n')
if font.get_underline(): if font.get_underline():
self.f.write('<UNDERLINE value="1"/>\n') self.f.write('<UNDERLINE value="1"/>\n')
self.f.write('</FORMAT>\n')
if p.get_top_border(): if p.get_top_border():
self.f.write('<TOPBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<TOPBORDER red="0" green="0" blue="0" style="0" width="1"/>\n')
if p.get_bottom_border(): if p.get_bottom_border():
@ -189,31 +204,31 @@ class KwordDoc(TextDoc):
self.f.write('<RIGHTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<RIGHTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n')
if p.get_left_border(): if p.get_left_border():
self.f.write('<LEFTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<LEFTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n')
self.f.write('</FORMAT>\n')
if left != 0: if left != 0:
self.f.write('<TABULATOR ptpos="%d" mmpos="%s" inchpos="%s"/>\n' % sizes(left)) self.f.write('<TABULATOR ptpos="%d" type="0"/>\n' % points(left))
self.f.write('</STYLE>\n') self.f.write('</STYLE>\n')
self.f.write('</STYLES>\n') self.f.write('</STYLES>\n')
self.f.write('<PIXMAPS>\n') self.f.write('<PIXMAPS>\n')
for file in self.photo_list: for file in self.photo_list:
self.f.write('<KEY key="%s" name="%s"/>\n' % file) self.f.write('<KEY name="%s" filename="%s" ' % (file[1],file[1]))
a = time.localtime(self.mtime)
self.f.write('msec="%d" ' % a[6])
self.f.write('second="%d" ' % a[5])
self.f.write('minute="%d" ' % a[4])
self.f.write('hour="%d" ' % a[3])
self.f.write('day="%d" ' % a[2])
self.f.write('month="%d" ' % a[1])
self.f.write('year="%d"/>\n' % a[0])
self.f.write('</PIXMAPS>\n') self.f.write('</PIXMAPS>\n')
self.f.write('<SERIALL>\n')
self.f.write('<SAMPLE>\n')
self.f.write('</SAMPLE>\n')
self.f.write('<DB>\n')
self.f.write('</DB>\n')
self.f.write('</SERIALL>\n')
self.f.write('</DOC>\n') self.f.write('</DOC>\n')
mtime = time.time()
tar = TarFile(self.filename) tar = TarFile(self.filename)
tar.add_file("documentinfo.xml",mtime,self.m) tar.add_file("documentinfo.xml",self.mtime,self.m)
tar.add_file("maindoc.xml",mtime,self.f) tar.add_file("maindoc.xml",self.mtime,self.f)
for file in self.photo_list: for file in self.photo_list:
f = open(file[0],"r") f = open(file[0],"r")
tar.add_file(file[1],mtime,f) tar.add_file(file[1],self.mtime,f)
f.close() f.close()
tar.close() tar.close()
@ -239,10 +254,8 @@ class KwordDoc(TextDoc):
self.font_face = "helvetica" self.font_face = "helvetica"
if leader != None: if leader != None:
self.text = leader + chr(1) self.text = leader + '\t'
txt = '<FORMAT id="1" pos="0" len="%d">\n' % len(leader) txt = '<FORMAT id="1" pos="0" len="%d">\n' % (len(leader)+1)
txt = txt + '<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
txt = txt + '<FORMAT id="3" pos="%d">\n' % len(leader)
txt = txt + '<FONT name="%s"/>\n</FORMAT>\n' % self.font_face txt = txt + '<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
self.format_list.append(txt) self.format_list.append(txt)
@ -264,24 +277,23 @@ class KwordDoc(TextDoc):
self.f.write('<LAYOUT>\n') self.f.write('<LAYOUT>\n')
self.f.write('<NAME value="%s"/>\n' % self.style_name) self.f.write('<NAME value="%s"/>\n' % self.style_name)
padding = self.p.get_padding() pad = points(self.p.get_padding())/2
self.f.write('<OFOOT pt="%d" mm="%s" inch="%s"/>\n' % sizes(padding)) self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
if self.p.get_alignment() == PARA_ALIGN_CENTER: if self.p.get_alignment() == PARA_ALIGN_CENTER:
self.f.write('<FLOW value="2"/>\n') self.f.write('<FLOW value="center"/>\n')
elif self.p.get_alignment() == PARA_ALIGN_JUSTIFY: elif self.p.get_alignment() == PARA_ALIGN_JUSTIFY:
self.f.write('<FLOW value="3"/>\n') self.f.write('<FLOW value="justify"/>\n')
elif self.p.get_alignment() == PARA_ALIGN_RIGHT: elif self.p.get_alignment() == PARA_ALIGN_RIGHT:
self.f.write('<FLOW value="1"/>\n') self.f.write('<FLOW value="right"/>\n')
else:
self.f.write('<FLOW value="left"/>\n')
first = self.p.get_first_indent() first = self.p.get_first_indent()
left = self.p.get_left_margin() left = self.p.get_left_margin()
right = self.p.get_right_margin()
first = left+first self.f.write('<INDENTS first="%d" ' % points(first))
if first != 0: self.f.write('left="%d" right="%d"/>\n' % (points(left),points(right)))
self.f.write('<IFIRST pt="%d" mm="%s" inch="%s"/>\n' % sizes(first))
if left != 0:
self.f.write('<ILEFT pt="%d" mm="%s" inch="%s"/>\n' % sizes(left))
self.f.write('<FORMAT>\n') self.f.write('<FORMAT>\n')
self.f.write('<FONT name="%s"/>\n' % self.font_face) self.f.write('<FONT name="%s"/>\n' % self.font_face)
@ -303,7 +315,7 @@ class KwordDoc(TextDoc):
self.f.write('<LEFTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<LEFTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n')
self.f.write('</FORMAT>\n') self.f.write('</FORMAT>\n')
if left != 0: if left != 0:
self.f.write('<TABULATOR ptpos="%d" mmpos="%s" inchpos="%s"/>\n' % sizes(left)) self.f.write('<TABULATOR ptpos="%d" type="0"/>\n' % points(left))
self.f.write('</LAYOUT>\n') self.f.write('</LAYOUT>\n')
self.f.write('</PARAGRAPH>\n') self.f.write('</PARAGRAPH>\n')
@ -311,7 +323,7 @@ class KwordDoc(TextDoc):
self.bold_start = len(self.text) self.bold_start = len(self.text)
if self.bold_stop != self.bold_start: if self.bold_stop != self.bold_start:
length = self.bold_stop - self.bold_start length = self.bold_stop - self.bold_start
txt = '<FORMAT id="1" pos="0" len="%d">\n' % length txt = '<FORMAT id="1" pos="%d" len="%d">\n' % (self.bold_stop,length)
txt = txt + '<FONT name="%s"/>\n</FORMAT>\n' % self.font_face txt = txt + '<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
self.format_list.append(txt) self.format_list.append(txt)
@ -341,16 +353,35 @@ class KwordDoc(TextDoc):
pass pass
def add_photo(self,name,x,y): def add_photo(self,name,x,y):
pass if no_pil:
# index = len(self.photo_list)+1 return
# self.photo_list.append((name,'pictures/picture%d.jpeg' % index))
# txt = '<FORMAT id="2" pos="%d">\n' % len(self.text) im = PIL.Image.open(name)
# txt = txt + '<FILENAME value="%s"/>\n</FORMAT>\n' % name nx,ny = im.size
#
# self.bold_stop = len(self.text) scale = float(nx)/float(ny)
# self.format_list.append(txt) x = points(x)
# y = points(y)
# self.text = self.text + chr(1)
if scale > 1.0:
scale = 1.0/scale
act_width = x
act_height = y * scale
else:
act_width = x * scale
act_height = y
index = len(self.photo_list)+1
tag = 'pictures/picture%d.jpeg' % index
self.photo_list.append((name,tag,act_width,act_height))
txt = '<FORMAT id="6" pos="%d" len="1">\n' % len(self.text)
txt = txt + '<ANCHOR type="frameset" instance="%s"/>\n' % tag
txt = txt + '</FORMAT>\n'
self.bold_stop = len(self.text)
self.format_list.append(txt)
self.text = self.text + '#'
def horizontal_line(self): def horizontal_line(self):
pass pass
@ -397,7 +428,9 @@ if __name__ == "__main__":
doc.end_paragraph() doc.end_paragraph()
doc.start_paragraph("Normal") doc.start_paragraph("Normal")
doc.add_photo("/home/dona/dad.jpg",200,200) doc.write_text("This is fun. ")
doc.add_photo("/home/dona/dad.jpg",2.0,2.0)
doc.write_text("So is this. ")
doc.end_paragraph() doc.end_paragraph()
doc.close() doc.close()

View File

@ -21,12 +21,6 @@
from TextDoc import * from TextDoc import *
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
try:
import PIL.Image
no_pil = 0
except:
no_pil = 1
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -19,7 +19,6 @@
# #
import RelLib import RelLib
import soundex
import intl import intl
import utils import utils
import Config import Config
@ -240,7 +239,7 @@ class MergePeople:
self.copy_sources(xdata,data) self.copy_sources(xdata,data)
break break
else: else:
self.p1.addAlternateName(xname) self.p1.addAlternateName(xdata)
list = self.p1.getAttributeList()[:] list = self.p1.getAttributeList()[:]
for xdata in self.p2.getAttributeList(): for xdata in self.p2.getAttributeList():
@ -251,7 +250,7 @@ class MergePeople:
self.copy_sources(xdata,data) self.copy_sources(xdata,data)
break break
else: else:
self.p1.addAttribute(xname) self.p1.addAttribute(xdata)
list = self.p1.getEventList()[:] list = self.p1.getEventList()[:]
for xdata in self.p2.getEventList(): for xdata in self.p2.getEventList():
@ -261,7 +260,7 @@ class MergePeople:
self.copy_sources(xdata,data) self.copy_sources(xdata,data)
break break
else: else:
self.p1.addEvent(xevent) self.p1.addEvent(xdata)
list = self.p1.getUrlList()[:] list = self.p1.getUrlList()[:]
for xdata in self.p2.getUrlList(): for xdata in self.p2.getUrlList():
@ -458,7 +457,6 @@ class MergePeople:
# a little debugging here # a little debugging here
for fam in self.db.getFamilyMap().values(): for fam in self.db.getFamilyMap().values():
name = self.p2.getPrimaryName().getName()
if self.p2 in fam.getChildList(): if self.p2 in fam.getChildList():
fam.removeChild(self.p2) fam.removeChild(self.p2)
fam.addChild(self.p1) fam.addChild(self.p1)

View File

@ -46,15 +46,6 @@ class GrampsDocTemplate(BaseDocTemplate):
self._calc() #in case we changed margins sizes etc self._calc() #in case we changed margins sizes etc
BaseDocTemplate.build(self,flowables) BaseDocTemplate.build(self,flowables)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def page_def(canvas,doc):
canvas.saveState()
canvas.restoreState()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #

View File

@ -91,7 +91,6 @@ class ReportPlugins:
"destroy_passed_object" : utils.destroy_passed_object "destroy_passed_object" : utils.destroy_passed_object
}) })
top = self.dialog.get_widget("report")
tree = self.dialog.get_widget("tree1") tree = self.dialog.get_widget("tree1")
self.run_tool = None self.run_tool = None
build_tree(tree,_reports,self.on_report_node_selected) build_tree(tree,_reports,self.on_report_node_selected)
@ -133,7 +132,6 @@ class ToolPlugins:
"destroy_passed_object" : utils.destroy_passed_object "destroy_passed_object" : utils.destroy_passed_object
}) })
top = self.dialog.get_widget("pluginsel")
tree = self.dialog.get_widget("tree") tree = self.dialog.get_widget("tree")
self.run_tool = None self.run_tool = None
build_tree(tree,_tools,self.on_node_selected) build_tree(tree,_tools,self.on_node_selected)

View File

@ -31,7 +31,6 @@ import string
import time import time
import os import os
from gnome.ui import * from gnome.ui import *
import sys
import intl import intl
_ = intl.gettext _ = intl.gettext
@ -232,6 +231,7 @@ def loadRevision(database, file, filename, revision, callback=None):
if __name__ == "__main__": if __name__ == "__main__":
import profile import profile
import sys
database = RelDataBase() database = RelDataBase()
t1 = time.time() t1 = time.time()

View File

@ -23,8 +23,9 @@
__author__ = "Don Allingham" __author__ = "Don Allingham"
import re from re import compile
from Date import * from Date import Date, compare_dates
from string import strip
CONF_VERY_HIGH = 4 CONF_VERY_HIGH = 4
CONF_HIGH = 3 CONF_HIGH = 3
@ -32,7 +33,7 @@ CONF_NORMAL = 2
CONF_LOW = 1 CONF_LOW = 1
CONF_VERY_LOW = 0 CONF_VERY_LOW = 0
_id_reg = re.compile("%\d+d") _id_reg = compile("%\d+d")
class SourceNote: class SourceNote:
"""Base class for storing source references and notes""" """Base class for storing source references and notes"""
@ -268,14 +269,14 @@ class Researcher:
def set(self,name,addr,city,state,country,postal,phone,email): def set(self,name,addr,city,state,country,postal,phone,email):
"""sets the information about the database owner""" """sets the information about the database owner"""
self.name = string.strip(name) self.name = strip(name)
self.addr = string.strip(addr) self.addr = strip(addr)
self.city = string.strip(city) self.city = strip(city)
self.state = string.strip(state) self.state = strip(state)
self.country = string.strip(country) self.country = strip(country)
self.postal = string.strip(postal) self.postal = strip(postal)
self.phone = string.strip(phone) self.phone = strip(phone)
self.email = string.strip(email) self.email = strip(email)
class Location: class Location:
"""Provides information about a place, including city, county, state, """Provides information about a place, including city, county, state,
@ -362,7 +363,9 @@ class Photo(SourceNote):
def __init__(self,source=None): def __init__(self,source=None):
"""Create a new Photo object, copying from the source if provided""" """Create a new Photo object, copying from the source if provided"""
SourceNote.__init__(self,source) SourceNote.__init__(self,source)
self.attrlist = [] self.attrlist = []
if source: if source:
self.path = source.path self.path = source.path

View File

@ -175,7 +175,7 @@ class SelectChild:
for row in self.add_child.selection: for row in self.add_child.selection:
select_child = self.add_child.get_row_data(row) select_child = self.add_child.get_row_data(row)
if self.family == None: if self.family == None:
self.family = database.newFamily() self.family = self.db.newFamily()
self.person.addFamily(self.family) self.person.addFamily(self.family)
if self.person.getGender() == Person.male: if self.person.getGender() == Person.male:
self.family.setFather(self.person) self.family.setFather(self.person)
@ -304,7 +304,7 @@ class NewChild:
self.family.setFather(self.person) self.family.setFather(self.person)
else: else:
self.family.setMother(self.person) self.family.setMother(self.person)
self.person.addFamily(active_family) self.person.addFamily(self.family)
mrel = const.childRelations[self.mrel.get_text()] mrel = const.childRelations[self.mrel.get_text()]
frel = const.childRelations[self.frel.get_text()] frel = const.childRelations[self.frel.get_text()]

View File

@ -70,7 +70,6 @@ class RevisionSelect:
self.load = load self.load = load
dialog = libglade.GladeXML(const.gladeFile, "revselect") dialog = libglade.GladeXML(const.gladeFile, "revselect")
revsel = dialog.get_widget("revselect")
dialog.signal_autoconnect({ dialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object, "destroy_passed_object" : utils.destroy_passed_object,
"on_loadrev_clicked" : self.on_loadrev_clicked, "on_loadrev_clicked" : self.on_loadrev_clicked,

View File

@ -21,8 +21,6 @@
"People who were adopted" "People who were adopted"
import Filter import Filter
import string
import utils
from RelLib import Person from RelLib import Person
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -37,7 +37,7 @@ class EventBefore(Filter.Filter):
def __init__(self,text): def __init__(self,text):
self.date = Date.Date() self.date = Date.Date()
self.date.set(text) self.date.set(text)
Filter.Filter.__init__(text) Filter.Filter.__init__(self,text)
def match(self,p): def match(self,p):
for event in p.getEventList() + [p.getBirth(), p.getDeath()]: for event in p.getEventList() + [p.getBirth(), p.getDeath()]:

View File

@ -21,7 +21,6 @@
"People with an event location of ..." "People with an event location of ..."
import Filter import Filter
import string
import re import re
import RelLib import RelLib
import intl import intl

View File

@ -21,7 +21,6 @@
"People who have an event type of ..." "People who have an event type of ..."
import Filter import Filter
import string
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"Females" "Females"
import Filter import Filter
import string
import utils
from RelLib import Person from RelLib import Person
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"People who have images" "People who have images"
import Filter import Filter
import string
import utils
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"Males" "Males"
import Filter import Filter
import string
import utils
from RelLib import Person from RelLib import Person
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"People with multiple marriage records" "People with multiple marriage records"
import Filter import Filter
import string
import utils
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"People with no marriage records" "People with no marriage records"
import Filter import Filter
import string
import utils
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"People without a birth date" "People without a birth date"
import Filter import Filter
import string
import utils
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -21,8 +21,6 @@
"People with children" "People with children"
import Filter import Filter
import string
import utils
import intl import intl
_ = intl.gettext _ = intl.gettext

View File

@ -827,10 +827,12 @@ def goto_active_person():
pos = id2col[active_person] pos = id2col[active_person]
column = person_list.find_row_from_data(pos) column = person_list.find_row_from_data(pos)
if column != -1: if column != -1:
person_list.unselect_all()
person_list.select_row(column,0) person_list.select_row(column,0)
person_list.moveto(column) person_list.moveto(column)
else: else:
if person_list.rows > 0: if person_list.rows > 0:
person_list.unselect_all()
person_list.select_row(0,0) person_list.select_row(0,0)
person_list.moveto(0) person_list.moveto(0)
person,alt = person_list.get_row_data(0) person,alt = person_list.get_row_data(0)

View File

@ -237,7 +237,6 @@ class AncestorReport:
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def draw_graph(self,index,start,level): def draw_graph(self,index,start,level):
if self.map.has_key(start) and index <= 15: if self.map.has_key(start) and index <= 15:
person = self.map[start]
text = self.text[start] text = self.text[start]
name = string.join(text,"\n") name = string.join(text,"\n")
@ -269,7 +268,6 @@ def report(database,person):
global style_sheet_list global style_sheet_list
global active_person global active_person
global topDialog global topDialog
global glade_file
global db global db
active_person = person active_person = person

View File

@ -214,7 +214,7 @@ def option_switch(obj):
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def report(database,person): def report(database,person):
report = DesReportWindow(person,database) DesReportWindow(person,database)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -97,8 +97,6 @@ class TableReport:
self.doc.close() self.doc.close()
def write_table_data(self,data): def write_table_data(self,data):
length = len(data)
self.doc.start_row() self.doc.start_row()
for item in data: for item in data:
self.doc.start_cell("data") self.doc.start_cell("data")
@ -110,7 +108,6 @@ class TableReport:
self.row = val + 2 self.row = val + 2
def write_table_head(self,data): def write_table_head(self,data):
length = len(data)
self.prev = 3 self.prev = 3
self.doc.start_row() self.doc.start_row()

View File

@ -24,7 +24,6 @@ import RelLib
import const import const
import os import os
import re import re
import sort
import string import string
import FindDoc import FindDoc
import utils import utils

View File

@ -88,7 +88,6 @@ class Merge:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
self.glade_file = base + os.sep + "merge.glade" self.glade_file = base + os.sep + "merge.glade"
top = GladeXML(self.glade_file,"dialog") top = GladeXML(self.glade_file,"dialog")
topWin = top.get_widget("dialog")
my_menu = GtkMenu() my_menu = GtkMenu()
item = GtkMenuItem(_("Low")) item = GtkMenuItem(_("Low"))
@ -555,7 +554,7 @@ def get_name_obj(person):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def runTool(database,active_person,callback): def runTool(database,active_person,callback):
mergeObj = Merge(database,callback) Merge(database,callback)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -382,7 +382,6 @@ class GedcomParser:
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def parse_record(self): def parse_record(self):
index = 0
while 1: while 1:
matches = self.get_next() matches = self.get_next()

View File

@ -24,7 +24,6 @@ from RelLib import *
import os import os
import posixpath import posixpath
import re import re
import sort
import string import string
import utils import utils
import intl import intl
@ -59,7 +58,6 @@ def report(database,person):
missing_bday = 0 missing_bday = 0
males = 0 males = 0
females = 0 females = 0
people = 0
bytes = 0 bytes = 0
namelist = [] namelist = []

View File

@ -39,6 +39,7 @@ from latin_utf8 import latin_to_utf8
cnvtxt = latin_to_ansel cnvtxt = latin_to_ansel
active_person = None
topDialog = None topDialog = None
db = None db = None
@ -219,9 +220,9 @@ def add_persons_sources(person):
if sbase != None and sbase not in source_list: if sbase != None and sbase not in source_list:
source_list.append(sbase) source_list.append(sbase)
for name in person.getNameList + [ person.getPrimaryName() ]: for name in person.getNameList + [ person.getPrimaryName() ]:
if private and event.getPrivacy(): if private and name.getPrivacy():
continue continue
for source_ref in event.getSourceRefList(): for source_ref in name.getSourceRefList():
sbase = source_ref.getBase() sbase = source_ref.getBase()
if sbase != None and sbase not in source_list: if sbase != None and sbase not in source_list:
source_list.append(sbase) source_list.append(sbase)
@ -240,9 +241,9 @@ def add_familys_sources(family):
if sbase != None and sbase not in source_list: if sbase != None and sbase not in source_list:
source_list.append(sbase) source_list.append(sbase)
for attr in family.getAttributeList(): for attr in family.getAttributeList():
if private and event.getPrivacy(): if private and attr.getPrivacy():
continue continue
for source_ref in event.getSourceRefList(): for source_ref in attr.getSourceRefList():
sbase = source_ref.getBase() sbase = source_ref.getBase()
if sbase != None and sbase not in source_list: if sbase != None and sbase not in source_list:
source_list.append(sbase) source_list.append(sbase)
@ -460,7 +461,7 @@ def write_person(g,person):
if attr.getNote() != "": if attr.getNote() != "":
write_long_text(g,"NOTE",2,attr.getNote()) write_long_text(g,"NOTE",2,attr.getNote())
for srcref in attr.getSourceRefList(): for srcref in attr.getSourceRefList():
write_source_ref(g,2,srclist) write_source_ref(g,2,srcref)
for addr in person.getAddressList(): for addr in person.getAddressList():
if private and addr.getPrivacy(): if private and addr.getPrivacy():
@ -637,7 +638,7 @@ def gedcom_date(date):
elif date.range == -1: elif date.range == -1:
return "(%s)" % date.text return "(%s)" % date.text
else: else:
return ged_subdate(self.start) return ged_subdate(date.start)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

File diff suppressed because it is too large Load Diff