Import fixes/pychecker fixes
svn: r1256
This commit is contained in:
parent
df5eb54c7f
commit
9b28f6263f
@ -18,20 +18,12 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import string
|
||||
import os
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -89,9 +81,9 @@ class GraphicsStyle:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DrawDoc:
|
||||
def __init__(self,styles,type,orientation=PAPER_PORTRAIT):
|
||||
def __init__(self,styles,type,orientation=TextDoc.PAPER_PORTRAIT):
|
||||
self.orientation = orientation
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
if orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.width = type.get_width()
|
||||
self.height = type.get_height()
|
||||
else:
|
||||
|
@ -55,6 +55,8 @@ from re import compile
|
||||
import const
|
||||
import Utils
|
||||
import GrampsCfg
|
||||
import Errors
|
||||
|
||||
from intl import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -77,13 +79,6 @@ _failmsg = []
|
||||
|
||||
_unavailable = _("No description was provided"),
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Exception Strings
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
MissingLibraries = _("Missing Libraries")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
@ -336,8 +331,8 @@ def load_plugins(direct):
|
||||
try:
|
||||
a = __import__(plugin)
|
||||
_success.append(a)
|
||||
except MissingLibraries,msg:
|
||||
_expect.append((file,msg))
|
||||
except Errors.PluginError, msg:
|
||||
_expect.append((file,str(msg)))
|
||||
except:
|
||||
_failmsg.append((file,sys.exc_info()))
|
||||
|
||||
|
@ -78,6 +78,25 @@ _template_map = {
|
||||
_user_template : None
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Exceptions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class ReportError(Exception):
|
||||
|
||||
def __init__(self,value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Report
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Report:
|
||||
"""
|
||||
The Report base class. This is a base class for generating
|
||||
|
@ -18,7 +18,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -26,9 +26,9 @@ from TextDoc import *
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class SpreadSheetDoc:
|
||||
def __init__(self,type,orientation=PAPER_PORTRAIT):
|
||||
def __init__(self,type,orientation=TextDoc.PAPER_PORTRAIT):
|
||||
self.orientation = orientation
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
if orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.width = type.get_width()
|
||||
self.height = type.get_height()
|
||||
else:
|
||||
@ -39,7 +39,7 @@ class SpreadSheetDoc:
|
||||
self.lmargin = 2.54
|
||||
self.rmargin = 2.54
|
||||
|
||||
self.font = FontStyle()
|
||||
self.font = TextDoc.FontStyle()
|
||||
self.actfont = self.font
|
||||
self.style_list = {}
|
||||
self.table_styles = {}
|
||||
@ -56,16 +56,16 @@ class SpreadSheetDoc:
|
||||
self.name = name
|
||||
|
||||
def add_style(self,name,style):
|
||||
self.style_list[name] = ParagraphStyle(style)
|
||||
self.style_list[name] = TextDoc.ParagraphStyle(style)
|
||||
|
||||
def add_table_style(self,name,style):
|
||||
self.table_styles[name] = TableStyle(style)
|
||||
self.table_styles[name] = TextDoc.TableStyle(style)
|
||||
|
||||
def add_cell_style(self,name,style):
|
||||
self.cell_styles[name] = TableCellStyle(style)
|
||||
self.cell_styles[name] = TextDoc.TableCellStyle(style)
|
||||
|
||||
def change_font(self,font):
|
||||
self.actfont = FontStyle(font)
|
||||
self.actfont = TextDoc.FontStyle(font)
|
||||
|
||||
def restore_font(self):
|
||||
self.actfont = self.font
|
||||
|
@ -29,7 +29,7 @@ Provides a TextDoc based interface to the AbiWord document format.
|
||||
import os
|
||||
import base64
|
||||
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
from latin_utf8 import latin_to_utf8
|
||||
import string
|
||||
import Plugins
|
||||
@ -41,14 +41,14 @@ from intl import gettext as _
|
||||
# Class Definitions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class AbiWordDoc(TextDoc):
|
||||
class AbiWordDoc(TextDoc.TextDoc):
|
||||
"""AbiWord document generator. Inherits from the TextDoc generic
|
||||
document interface class."""
|
||||
|
||||
def __init__(self,styles,type,template,orientation):
|
||||
"""Initializes the AbiWordDoc class, calling the __init__ routine
|
||||
of the parent TextDoc class"""
|
||||
TextDoc.__init__(self,styles,type,template,orientation)
|
||||
TextDoc.TextDoc.__init__(self,styles,type,template,orientation)
|
||||
self.f = None
|
||||
self.level = 0
|
||||
self.new_page = 0
|
||||
@ -71,7 +71,7 @@ class AbiWordDoc(TextDoc):
|
||||
self.f.write('version="0.9.6.1" fileformat="1.0">\n')
|
||||
self.f.write('<pagesize ')
|
||||
self.f.write('pagetype="%s" ' % self.paper.get_name())
|
||||
if self.orientation == PAPER_PORTRAIT:
|
||||
if self.orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('orientation="portrait" ')
|
||||
else:
|
||||
self.f.write('orientation="landscape" ')
|
||||
@ -142,11 +142,11 @@ class AbiWordDoc(TextDoc):
|
||||
style = self.style_list[style_name]
|
||||
self.current_style = style
|
||||
self.f.write('<p props="')
|
||||
if style.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
if style.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('text-align:right;')
|
||||
elif style.get_alignment() == PARA_ALIGN_LEFT:
|
||||
elif style.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.f.write('text-align:left;')
|
||||
elif style.get_alignment() == PARA_ALIGN_CENTER:
|
||||
elif style.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('text-align:center;')
|
||||
else:
|
||||
self.f.write('text-align:justify;')
|
||||
@ -160,7 +160,7 @@ class AbiWordDoc(TextDoc):
|
||||
self.f.write('">')
|
||||
font = style.get_font()
|
||||
self.f.write('<c props="font-family:')
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('Arial;')
|
||||
else:
|
||||
self.f.write('Times New Roman;')
|
||||
@ -187,7 +187,7 @@ class AbiWordDoc(TextDoc):
|
||||
self.current_style = style
|
||||
font = style.get_font()
|
||||
self.cdata = '<c props="font-family:'
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.cdata = self.cdata + 'Arial;'
|
||||
else:
|
||||
self.cdata = self.cdata + 'Times New Roman;'
|
||||
@ -227,7 +227,7 @@ class AbiWordDoc(TextDoc):
|
||||
def start_bold(self):
|
||||
font = self.current_style.get_font()
|
||||
self.f.write('</c><c props="font-family:')
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('Arial;')
|
||||
else:
|
||||
self.f.write('Times New Roman;')
|
||||
@ -245,7 +245,7 @@ class AbiWordDoc(TextDoc):
|
||||
def end_bold(self):
|
||||
font = self.current_style.get_font()
|
||||
self.f.write('</c><c props="font-family:')
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('Arial;')
|
||||
else:
|
||||
self.f.write('Times New Roman;')
|
||||
|
@ -29,7 +29,7 @@ import ImgManip
|
||||
import TarFile
|
||||
import const
|
||||
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
|
||||
from intl import gettext as _
|
||||
|
||||
@ -71,10 +71,10 @@ _bottom = [
|
||||
# HtmlDoc
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class HtmlDoc(TextDoc):
|
||||
class HtmlDoc(TextDoc.TextDoc):
|
||||
|
||||
def __init__(self,styles,type,template,orientation,source=None):
|
||||
TextDoc.__init__(self,styles,PaperStyle("",0,0),template,None)
|
||||
TextDoc.TextDoc.__init__(self,styles,TextDoc.PaperStyle("",0,0),template,None)
|
||||
self.year = time.localtime(time.time())[0]
|
||||
self.ext = '.html'
|
||||
if source == None:
|
||||
@ -111,7 +111,7 @@ class HtmlDoc(TextDoc):
|
||||
self.ext = val
|
||||
|
||||
def set_owner(self,owner):
|
||||
HtmlDoc.set_owner(self,owner)
|
||||
TextDoc.TextDoc.set_owner(self,owner)
|
||||
self.copyright = 'Copyright © %d %s' % (self.year,self.owner)
|
||||
|
||||
def set_image_dir(self,dirname):
|
||||
@ -269,7 +269,7 @@ class HtmlDoc(TextDoc):
|
||||
italic = 'font-style:italic; '
|
||||
if font.get_bold():
|
||||
bold = 'font-weight:bold; '
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
family = '"Helvetica","Arial","sans-serif"'
|
||||
else:
|
||||
family = '"Times New Roman","Times","serif"'
|
||||
|
@ -18,12 +18,11 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
from latin_utf8 import latin_to_utf8
|
||||
|
||||
import time
|
||||
import StringIO
|
||||
import os
|
||||
import gzip
|
||||
from TarFile import TarFile
|
||||
import Plugins
|
||||
@ -39,7 +38,7 @@ def points(val):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class KwordDoc(TextDoc):
|
||||
class KwordDoc(TextDoc.TextDoc):
|
||||
|
||||
def open(self,filename):
|
||||
self.photo_list = []
|
||||
@ -98,7 +97,7 @@ class KwordDoc(TextDoc):
|
||||
|
||||
self.f.write('width="%d" ' % points(self.width))
|
||||
self.f.write('height="%d" ' % points(self.height))
|
||||
if self.orientation == PAPER_PORTRAIT:
|
||||
if self.orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('orientation="0" ')
|
||||
else:
|
||||
self.f.write('orientation="1" ')
|
||||
@ -173,11 +172,11 @@ class KwordDoc(TextDoc):
|
||||
|
||||
pad = points(p.get_padding())/2
|
||||
self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
|
||||
if p.get_alignment() == PARA_ALIGN_CENTER:
|
||||
if p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('<FLOW value="center"/>\n')
|
||||
elif p.get_alignment() == PARA_ALIGN_JUSTIFY:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
|
||||
self.f.write('<FLOW value="justify"/>\n')
|
||||
elif p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('<FLOW value="right"/>\n')
|
||||
else:
|
||||
self.f.write('<FLOW value="left"/>\n')
|
||||
@ -190,7 +189,7 @@ class KwordDoc(TextDoc):
|
||||
|
||||
font = p.get_font()
|
||||
self.f.write('<FORMAT>\n')
|
||||
if font.get_type_face==FONT_SANS_SERIF:
|
||||
if font.get_type_face==TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('<FONT name="helvetica"/>\n')
|
||||
else:
|
||||
self.f.write('<FONT name="times"/>\n')
|
||||
@ -259,7 +258,7 @@ class KwordDoc(TextDoc):
|
||||
self.style_name = style_name
|
||||
self.p = self.style_list[self.style_name]
|
||||
self.font = self.p.get_font()
|
||||
if self.font.get_type_face() == FONT_SERIF:
|
||||
if self.font.get_type_face() == TextDoc.FONT_SERIF:
|
||||
self.font_face = "Arial"
|
||||
else:
|
||||
self.font_face = "Times New Roman"
|
||||
@ -295,11 +294,11 @@ class KwordDoc(TextDoc):
|
||||
pad = points(self.p.get_padding())/2
|
||||
self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
|
||||
|
||||
if self.p.get_alignment() == PARA_ALIGN_CENTER:
|
||||
if self.p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('<FLOW value="center"/>\n')
|
||||
elif self.p.get_alignment() == PARA_ALIGN_JUSTIFY:
|
||||
elif self.p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
|
||||
self.f.write('<FLOW value="justify"/>\n')
|
||||
elif self.p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
elif self.p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('<FLOW value="right"/>\n')
|
||||
else:
|
||||
self.f.write('<FLOW value="left"/>\n')
|
||||
@ -427,51 +426,4 @@ class KwordDoc(TextDoc):
|
||||
def write_text(self,text):
|
||||
self.text = self.text + text
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
paper = PaperStyle("Letter",27.94,21.59)
|
||||
|
||||
styles = StyleSheet()
|
||||
foo = FontStyle()
|
||||
foo.set_type_face(FONT_SANS_SERIF)
|
||||
foo.set_color((255,0,0))
|
||||
foo.set_size(24)
|
||||
foo.set_underline(1)
|
||||
foo.set_bold(1)
|
||||
foo.set_italic(1)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_alignment(PARA_ALIGN_RIGHT)
|
||||
para.set_font(foo)
|
||||
styles.add_style("Title",para)
|
||||
|
||||
foo = FontStyle()
|
||||
foo.set_type_face(FONT_SERIF)
|
||||
foo.set_size(12)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_font(foo)
|
||||
styles.add_style("Normal",para)
|
||||
|
||||
doc = KwordDoc(styles,paper,PAPER_PORTRAIT)
|
||||
doc.open("/home/dona/test")
|
||||
|
||||
doc.start_paragraph("Title")
|
||||
doc.write_text("My Title")
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_paragraph("Normal")
|
||||
doc.write_text("Hello there. This is fun")
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_paragraph("Normal")
|
||||
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.close()
|
||||
|
||||
#Change to support tables (args were: 0,1,1)
|
||||
Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1)
|
||||
|
@ -23,12 +23,19 @@
|
||||
|
||||
"""LaTeX document generator"""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import string
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
import Plugins
|
||||
import ImgManip
|
||||
from intl import gettext as _
|
||||
@ -38,7 +45,7 @@ from intl import gettext as _
|
||||
# Paragraph Handling
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TexFont(TextDoc):
|
||||
class TexFont:
|
||||
def __init__(self, style=None):
|
||||
if style:
|
||||
self.font_beg = style.font_beg
|
||||
@ -56,7 +63,7 @@ class TexFont(TextDoc):
|
||||
# LaTeXDon
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class LaTeXDoc(TextDoc):
|
||||
class LaTeXDoc(TextDoc.TextDoc):
|
||||
"""LaTeX document interface class. Derived from TextDoc"""
|
||||
|
||||
def open(self,filename):
|
||||
@ -74,7 +81,7 @@ class LaTeXDoc(TextDoc):
|
||||
|
||||
options = "12pt"
|
||||
|
||||
if self.orientation == PAPER_LANDSCAPE:
|
||||
if self.orientation == TextDoc.PAPER_LANDSCAPE:
|
||||
options = options + ",landscape"
|
||||
|
||||
# Paper selections are somewhat limited on a stock installation.
|
||||
@ -148,7 +155,7 @@ class LaTeXDoc(TextDoc):
|
||||
thisstyle.font_beg = thisstyle.font_beg + "\\hfill"
|
||||
|
||||
# Establish font face and shape
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
thisstyle.font_beg = thisstyle.font_beg + "\\sffamily"
|
||||
thisstyle.font_end = "\\rmfamily" + thisstyle.font_end
|
||||
if font.get_bold():
|
||||
|
@ -18,24 +18,38 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import tempfile
|
||||
import string
|
||||
import zipfile
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Plugins
|
||||
from intl import gettext as _
|
||||
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
|
||||
import Errors
|
||||
import TextDoc
|
||||
import DrawDoc
|
||||
import const
|
||||
|
||||
from intl import gettext as _
|
||||
|
||||
class OpenDrawDoc(DrawDoc):
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# OpenDrawDoc
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class OpenDrawDoc(DrawDoc.DrawDoc):
|
||||
|
||||
def __init__(self,styles,type,orientation):
|
||||
DrawDoc.__init__(self,styles,type,orientation)
|
||||
DrawDoc.DrawDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
@ -53,11 +67,13 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.filename = filename + ".sxd"
|
||||
else:
|
||||
self.filename = filename
|
||||
|
||||
tempfile.tempdir = "/tmp"
|
||||
self.content_xml = tempfile.mktemp()
|
||||
self.f = open(self.content_xml,"wb")
|
||||
|
||||
try:
|
||||
self.content_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.content_xml,"wb")
|
||||
except:
|
||||
raise Errors.ReportError("Could not create %s" % self.filename)
|
||||
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-content ')
|
||||
self.f.write('xmlns:office="http://openoffice.org/2000/office" ')
|
||||
@ -98,7 +114,7 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.f.write('<style:properties ')
|
||||
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('fo:font-family="Arial" ')
|
||||
else:
|
||||
self.f.write('fo:font-family="'Times New Roman'" ')
|
||||
@ -121,10 +137,13 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.f.write('</office:body>\n')
|
||||
self.f.write('</office:document-content>\n')
|
||||
self.f.close()
|
||||
self._write_styles_file()
|
||||
self._write_manifest()
|
||||
self._write_meta_file()
|
||||
self._write_zip()
|
||||
try:
|
||||
self._write_styles_file()
|
||||
self._write_manifest()
|
||||
self._write_meta_file()
|
||||
self._write_zip()
|
||||
except:
|
||||
Errors.ReportError("Could not create %s" % self.filename)
|
||||
|
||||
def _write_zip(self):
|
||||
|
||||
@ -133,10 +152,6 @@ class OpenDrawDoc(DrawDoc):
|
||||
file.write(self.content_xml,"content.xml")
|
||||
file.write(self.meta_xml,"meta.xml")
|
||||
file.write(self.styles_xml,"styles.xml")
|
||||
|
||||
# for image in self.photo_list:
|
||||
# base = os.path.basename(image[0])
|
||||
# file.write(image[0],"Pictures/%s" % base)
|
||||
file.close()
|
||||
|
||||
os.unlink(self.manifest_xml)
|
||||
@ -145,7 +160,7 @@ class OpenDrawDoc(DrawDoc):
|
||||
os.unlink(self.styles_xml)
|
||||
|
||||
def _write_styles_file(self):
|
||||
self.styles_xml = tempfile.mktemp()
|
||||
self.styles_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.styles_xml,"wb")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-styles ')
|
||||
@ -252,18 +267,18 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.f.write('fo:padding="%.3fcm" ' % style.get_padding())
|
||||
|
||||
align = style.get_alignment()
|
||||
if align == PARA_ALIGN_LEFT:
|
||||
if align == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.f.write('fo:text-align="left" ')
|
||||
elif align == PARA_ALIGN_RIGHT:
|
||||
elif align == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('fo:text-align="right" ')
|
||||
elif align == PARA_ALIGN_CENTER:
|
||||
elif align == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('fo:text-align="center" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
else:
|
||||
self.f.write('fo:text-align="justify" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
@ -293,7 +308,7 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.f.write('<style:properties fo:page-width="%.2fcm" ' % self.width)
|
||||
self.f.write('fo:page-height="%.2fcm" ' % self.height)
|
||||
self.f.write('style:num-format="1" ')
|
||||
if self.orientation == PAPER_PORTRAIT:
|
||||
if self.orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('style:print-orientation="portrait" ')
|
||||
else:
|
||||
self.f.write('style:print-orientation="landscape" ')
|
||||
@ -336,7 +351,7 @@ class OpenDrawDoc(DrawDoc):
|
||||
self.f.write(text)
|
||||
|
||||
def _write_manifest(self):
|
||||
self.manifest_xml = tempfile.mktemp()
|
||||
self.manifest_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.manifest_xml,"wb")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<manifest:manifest ')
|
||||
@ -359,7 +374,7 @@ class OpenDrawDoc(DrawDoc):
|
||||
|
||||
def _write_meta_file(self):
|
||||
name = self.name
|
||||
self.meta_xml = tempfile.mktemp()
|
||||
self.meta_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.meta_xml,"wb")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-meta ')
|
||||
|
@ -34,7 +34,8 @@ import time
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
import Errors
|
||||
import TextDoc
|
||||
import const
|
||||
import Plugins
|
||||
import ImgManip
|
||||
@ -51,10 +52,10 @@ from intl import gettext as _
|
||||
# OpenOfficeDoc
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class OpenOfficeDoc(TextDoc):
|
||||
class OpenOfficeDoc(TextDoc.TextDoc):
|
||||
|
||||
def __init__(self,styles,type,template,orientation):
|
||||
TextDoc.__init__(self,styles,type,template,orientation)
|
||||
TextDoc.TextDoc.__init__(self,styles,type,template,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
@ -71,10 +72,11 @@ class OpenOfficeDoc(TextDoc):
|
||||
else:
|
||||
self.filename = filename
|
||||
|
||||
tempfile.tempdir = "/tmp"
|
||||
|
||||
self.content_xml = tempfile.mktemp()
|
||||
self.f = open(self.content_xml,"wb")
|
||||
try:
|
||||
self.content_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.content_xml,"wb")
|
||||
except:
|
||||
raise Errors.ReportError("Could not create %s" % self.filename)
|
||||
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-content ')
|
||||
@ -328,7 +330,7 @@ class OpenOfficeDoc(TextDoc):
|
||||
os.unlink(self.styles_xml)
|
||||
|
||||
def _write_styles_file(self):
|
||||
self.styles_xml = tempfile.mktemp()
|
||||
self.styles_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.styles_xml,"wb")
|
||||
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
@ -388,18 +390,18 @@ class OpenOfficeDoc(TextDoc):
|
||||
self.f.write('fo:padding="%.3fcm" ' % style.get_padding())
|
||||
|
||||
align = style.get_alignment()
|
||||
if align == PARA_ALIGN_LEFT:
|
||||
if align == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.f.write('fo:text-align="left" ')
|
||||
elif align == PARA_ALIGN_RIGHT:
|
||||
elif align == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('fo:text-align="right" ')
|
||||
elif align == PARA_ALIGN_CENTER:
|
||||
elif align == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('fo:text-align="center" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
else:
|
||||
self.f.write('fo:text-align="justify" ')
|
||||
self.f.write('style:justify-single-word="false" ')
|
||||
font = style.get_font()
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
@ -442,7 +444,7 @@ class OpenOfficeDoc(TextDoc):
|
||||
self.f.write('<style:properties fo:page-width="%.3fcm" ' % self.width)
|
||||
self.f.write('fo:page-height="%.3fcm" ' % self.height)
|
||||
self.f.write('style:num-format="1" ')
|
||||
if self.orientation == PAPER_PORTRAIT:
|
||||
if self.orientation == TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('style:print-orientation="portrait" ')
|
||||
else:
|
||||
self.f.write('style:print-orientation="landscape" ')
|
||||
@ -500,7 +502,7 @@ class OpenOfficeDoc(TextDoc):
|
||||
self.f.write(text)
|
||||
|
||||
def _write_manifest(self):
|
||||
self.manifest_xml = tempfile.mktemp()
|
||||
self.manifest_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.manifest_xml,"wb")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<manifest:manifest ')
|
||||
@ -528,7 +530,7 @@ class OpenOfficeDoc(TextDoc):
|
||||
|
||||
def _write_meta_file(self):
|
||||
name = self.name
|
||||
self.meta_xml = tempfile.mktemp()
|
||||
self.meta_xml = tempfile.TemporaryFile()
|
||||
self.f = open(self.meta_xml,"wb")
|
||||
self.f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
self.f.write('<office:document-meta ')
|
||||
|
@ -22,7 +22,7 @@ import os
|
||||
import tempfile
|
||||
import string
|
||||
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
from SpreadSheetDoc import *
|
||||
|
||||
from latin_utf8 import latin_to_utf8
|
||||
@ -49,8 +49,7 @@ class OpenSpreadSheet(SpreadSheetDoc):
|
||||
else:
|
||||
self.filename = filename
|
||||
|
||||
tempfile.tempdir = "/tmp"
|
||||
self.tempdir = tempfile.mktemp()
|
||||
self.tempdir = tempfile.TemporaryFile()
|
||||
os.mkdir(self.tempdir,0700)
|
||||
os.mkdir(self.tempdir + os.sep + "Pictures")
|
||||
os.mkdir(self.tempdir + os.sep + "META-INF")
|
||||
@ -122,7 +121,7 @@ class OpenSpreadSheet(SpreadSheetDoc):
|
||||
self.f.write('fo:padding-left="%.3fcm" ' % style.get_padding())
|
||||
self.f.write('style:text-outline="false" ')
|
||||
self.f.write('style:text-crossing-out="none" ')
|
||||
if font.get_type_face() == FONT_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SERIF:
|
||||
self.f.write('style:font-name="Times New Roman" ')
|
||||
else:
|
||||
self.f.write('style:font-name="Arial" ')
|
||||
@ -425,33 +424,3 @@ class OpenSpreadSheet(SpreadSheetDoc):
|
||||
self.f.write('</office:document-meta>\n')
|
||||
self.f.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
doc = OpenSpreadSheet(PaperStyle("junk",21.59,27),PAPER_PORTRAIT)
|
||||
|
||||
t = TableStyle()
|
||||
t.set_columns(3)
|
||||
t.set_column_width(0,4)
|
||||
t.set_column_width(1,2)
|
||||
t.set_column_width(2,1)
|
||||
doc.add_table_style("mytblstyle",t)
|
||||
|
||||
f = FontStyle()
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_size(16)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_background_color((0xcc,0xff,0xff))
|
||||
p.set_padding(0.5)
|
||||
doc.add_style("p1",p)
|
||||
|
||||
doc.open("/home/dona/test")
|
||||
doc.start_page("Page 1","mytblstyle")
|
||||
doc.start_row()
|
||||
doc.start_cell("p1")
|
||||
doc.write_text("Hello")
|
||||
doc.end_cell()
|
||||
doc.end_row()
|
||||
doc.end_page()
|
||||
doc.close()
|
||||
|
@ -18,19 +18,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import os
|
||||
import string
|
||||
import Plugins
|
||||
from intl import gettext as _
|
||||
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
import TextDoc
|
||||
import DrawDoc
|
||||
|
||||
|
||||
class PSDrawDoc(DrawDoc):
|
||||
class PSDrawDoc(DrawDoc.DrawDoc):
|
||||
|
||||
def __init__(self,styles,type,orientation):
|
||||
DrawDoc.__init__(self,styles,type,orientation)
|
||||
DrawDoc.DrawDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
@ -42,7 +41,7 @@ class PSDrawDoc(DrawDoc):
|
||||
|
||||
def fontdef(self,para):
|
||||
font = para.get_font()
|
||||
if font.get_type_face() == FONT_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SERIF:
|
||||
if font.get_bold():
|
||||
if font.get_italic():
|
||||
font_name = "/Times-BoldItalic"
|
||||
@ -77,7 +76,7 @@ class PSDrawDoc(DrawDoc):
|
||||
self.f.write('%%LanguageLevel: 2\n')
|
||||
self.f.write('%%Pages: (atend)\n')
|
||||
self.f.write('%%PageOrder: Ascend\n')
|
||||
if self.orientation != PAPER_PORTRAIT:
|
||||
if self.orientation != TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('%%Orientation: Landscape\n')
|
||||
self.f.write('%%EndComments\n')
|
||||
self.f.write('/cm { 28.34 mul } def\n')
|
||||
@ -102,7 +101,7 @@ class PSDrawDoc(DrawDoc):
|
||||
self.page = self.page + 1
|
||||
self.f.write("%%Page:")
|
||||
self.f.write("%d %d\n" % (self.page,self.page))
|
||||
if self.orientation != PAPER_PORTRAIT:
|
||||
if self.orientation != TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('90 rotate %5.2f cm %5.2f cm translate\n' % (0,-1*self.height))
|
||||
|
||||
def end_page(self):
|
||||
|
@ -23,8 +23,9 @@
|
||||
# gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
import Plugins
|
||||
import Errors
|
||||
import ImgManip
|
||||
from intl import gettext as _
|
||||
|
||||
@ -42,7 +43,7 @@ try:
|
||||
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
|
||||
import reportlab.lib.styles
|
||||
except:
|
||||
raise Plugins.MissingLibraries, _("The ReportLab modules are not installed")
|
||||
raise Errors.PluginError( _("The ReportLab modules are not installed"))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -63,7 +64,7 @@ class GrampsDocTemplate(BaseDocTemplate):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class PdfDoc(TextDoc):
|
||||
class PdfDoc(TextDoc.TextDoc):
|
||||
|
||||
def open(self,filename):
|
||||
if filename[-4:] != ".pdf":
|
||||
@ -133,11 +134,11 @@ class PdfDoc(TextDoc):
|
||||
pdf_style.bulletIndent = first
|
||||
|
||||
align = style.get_alignment()
|
||||
if align == PARA_ALIGN_RIGHT:
|
||||
if align == TextDoc.PARA_ALIGN_RIGHT:
|
||||
pdf_style.alignment = TA_RIGHT
|
||||
elif align == PARA_ALIGN_LEFT:
|
||||
elif align == TextDoc.PARA_ALIGN_LEFT:
|
||||
pdf_style.alignment = TA_LEFT
|
||||
elif align == PARA_ALIGN_CENTER:
|
||||
elif align == TextDoc.PARA_ALIGN_CENTER:
|
||||
pdf_style.alignment = TA_CENTER
|
||||
else:
|
||||
pdf_style.alignment = TA_JUSTIFY
|
||||
@ -223,7 +224,7 @@ class PdfDoc(TextDoc):
|
||||
|
||||
p = self.my_para
|
||||
f = p.get_font()
|
||||
if f.get_type_face() == FONT_SANS_SERIF:
|
||||
if f.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
if f.get_bold():
|
||||
fn = 'Helvetica-Bold'
|
||||
else:
|
||||
@ -249,9 +250,9 @@ class PdfDoc(TextDoc):
|
||||
self.tblstyle.append(('LINEABOVE', loc, loc, 1, black))
|
||||
if self.my_table_style.get_bottom_border():
|
||||
self.tblstyle.append(('LINEBELOW', loc, loc, 1, black))
|
||||
if p.get_alignment() == PARA_ALIGN_LEFT:
|
||||
if p.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
|
||||
self.tblstyle.append(('ALIGN', loc, loc, 'LEFT'))
|
||||
elif p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.tblstyle.append(('ALIGN', loc, loc, 'RIGHT'))
|
||||
else:
|
||||
self.tblstyle.append(('ALIGN', loc, loc, 'CENTER'))
|
||||
|
@ -21,9 +21,11 @@
|
||||
import os
|
||||
import string
|
||||
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
import Plugins
|
||||
import Errors
|
||||
|
||||
import TextDoc
|
||||
import DrawDoc
|
||||
from intl import gettext as _
|
||||
|
||||
try:
|
||||
@ -31,16 +33,16 @@ try:
|
||||
from reportlab.lib.units import cm
|
||||
from reportlab.lib.colors import Color
|
||||
except:
|
||||
raise Plugins.MissingLibraries, _("The ReportLab modules are not installed")
|
||||
raise Errors.PluginError( _("The ReportLab modules are not installed"))
|
||||
|
||||
def make_color(color):
|
||||
return Color(float(color[0])/255.0, float(color[1])/255.0,
|
||||
float(color[2])/255.0)
|
||||
|
||||
class PdfDrawDoc(DrawDoc):
|
||||
class PdfDrawDoc(DrawDoc.DrawDoc):
|
||||
|
||||
def __init__(self,styles,type,orientation):
|
||||
DrawDoc.__init__(self,styles,type,orientation)
|
||||
DrawDoc.DrawDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
@ -117,7 +119,7 @@ class PdfDrawDoc(DrawDoc):
|
||||
|
||||
self.f.saveState()
|
||||
self.f.setFillColor(make_color(font.get_color()))
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
if font.get_bold():
|
||||
self.f.setFont("Helvetica-Bold",font.get_size())
|
||||
else:
|
||||
@ -142,7 +144,7 @@ class PdfDrawDoc(DrawDoc):
|
||||
|
||||
self.f.saveState()
|
||||
self.f.setFillColor(make_color(font.get_color()))
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
if font.get_bold():
|
||||
self.f.setFont("Helvetica-Bold",font.get_size())
|
||||
else:
|
||||
|
@ -23,7 +23,7 @@
|
||||
# Load the base TextDoc class
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
import TextDoc
|
||||
import Plugins
|
||||
import ImgManip
|
||||
|
||||
@ -47,7 +47,7 @@ def twips(cm):
|
||||
# use style sheets. Instead it writes raw formatting.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class RTFDoc(TextDoc):
|
||||
class RTFDoc(TextDoc.TextDoc):
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
@ -132,7 +132,7 @@ class RTFDoc(TextDoc):
|
||||
size = f.get_size()*2
|
||||
bgindex = self.color_map[p.get_background_color()]
|
||||
fgindex = self.color_map[f.get_color()]
|
||||
if f.get_type_face() == FONT_SERIF:
|
||||
if f.get_type_face() == TextDoc.FONT_SERIF:
|
||||
self.font_type = '\\f0\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
|
||||
else:
|
||||
self.font_type = '\\f1\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
|
||||
@ -147,14 +147,14 @@ class RTFDoc(TextDoc):
|
||||
|
||||
if not self.in_table:
|
||||
self.f.write('\\pard')
|
||||
if p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
if p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
|
||||
self.f.write('\\qr')
|
||||
elif p.get_alignment() == PARA_ALIGN_CENTER:
|
||||
elif p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
|
||||
self.f.write('\\qc')
|
||||
self.f.write('\\ri%d' % twips(p.get_right_margin()))
|
||||
self.f.write('\\li%d' % twips(p.get_left_margin()))
|
||||
self.f.write('\\fi%d' % twips(p.get_first_indent()))
|
||||
if p.get_alignment() == PARA_ALIGN_JUSTIFY:
|
||||
if p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
|
||||
self.f.write('\\qj')
|
||||
if p.get_padding():
|
||||
self.f.write('\\sa%d' % twips(p.get_padding()/2.0))
|
||||
@ -363,153 +363,4 @@ class RTFDoc(TextDoc):
|
||||
else:
|
||||
self.text = self.text + i
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
paper = PaperStyle("Letter",27.94,21.59)
|
||||
|
||||
styles = StyleSheet()
|
||||
foo = FontStyle()
|
||||
foo.set_type_face(FONT_SANS_SERIF)
|
||||
foo.set_color((255,0,0))
|
||||
foo.set_size(24)
|
||||
foo.set_underline(1)
|
||||
foo.set_bold(1)
|
||||
foo.set_italic(1)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_alignment(PARA_ALIGN_RIGHT)
|
||||
para.set_font(foo)
|
||||
styles.add_style("Title",para)
|
||||
|
||||
foo = FontStyle()
|
||||
foo.set_type_face(FONT_SERIF)
|
||||
foo.set_size(12)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_font(foo)
|
||||
styles.add_style("Normal",para)
|
||||
|
||||
foo = FontStyle()
|
||||
foo.set_type_face(FONT_SERIF)
|
||||
foo.set_size(12)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_font(foo)
|
||||
para.set_top_border(1)
|
||||
para.set_left_border(1)
|
||||
para.set_right_border(1)
|
||||
para.set_bottom_border(1)
|
||||
styles.add_style("Box",para)
|
||||
|
||||
doc = RTFDoc(styles,paper,PAPER_PORTRAIT)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
doc.add_cell_style('ParentHead',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
doc.add_cell_style('TextContents',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(0)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
doc.add_cell_style('TextChild1',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
doc.add_cell_style('TextChild2',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
doc.add_cell_style('TextContentsEnd',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
doc.add_cell_style('ChildName',cell)
|
||||
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(3)
|
||||
table.set_column_width(0,20)
|
||||
table.set_column_width(1,40)
|
||||
table.set_column_width(2,40)
|
||||
doc.add_table_style('ParentTable',table)
|
||||
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(4)
|
||||
table.set_column_width(0,5)
|
||||
table.set_column_width(1,15)
|
||||
table.set_column_width(2,40)
|
||||
table.set_column_width(3,40)
|
||||
doc.add_table_style('ChildTable',table)
|
||||
|
||||
doc.open("test")
|
||||
|
||||
doc.start_paragraph("Title")
|
||||
doc.write_text("My Title")
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_paragraph("Normal")
|
||||
doc.write_text("Hello there. This is fun")
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_paragraph("Box")
|
||||
doc.write_text("This is my box")
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_paragraph("Normal")
|
||||
doc.add_photo("foo.png",200,200)
|
||||
doc.end_paragraph()
|
||||
|
||||
doc.start_table(id,'ParentTable')
|
||||
doc.start_row()
|
||||
doc.start_cell('ParentHead',3)
|
||||
doc.start_paragraph('Normal')
|
||||
doc.write_text('Banana : Smith ')
|
||||
doc.end_paragraph()
|
||||
doc.end_cell()
|
||||
doc.end_row()
|
||||
|
||||
doc.start_row()
|
||||
doc.start_cell("TextContents")
|
||||
doc.start_paragraph('Normal')
|
||||
doc.write_text("some event")
|
||||
doc.end_paragraph()
|
||||
doc.end_cell()
|
||||
doc.start_cell("TextContents")
|
||||
doc.start_paragraph('Normal')
|
||||
doc.write_text("someday")
|
||||
doc.end_paragraph()
|
||||
doc.end_cell()
|
||||
doc.start_cell("TextContentsEnd")
|
||||
doc.start_paragraph('Normal')
|
||||
doc.write_text("somewhere")
|
||||
doc.end_paragraph()
|
||||
doc.end_cell()
|
||||
doc.end_row()
|
||||
|
||||
doc.end_table()
|
||||
|
||||
doc.close()
|
||||
|
||||
Plugins.register_text_doc(_("Rich Text Format (RTF)"),RTFDoc,1,1,1)
|
||||
|
@ -18,19 +18,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import os
|
||||
import string
|
||||
import Plugins
|
||||
from intl import gettext as _
|
||||
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
import TextDoc
|
||||
import DrawDoc
|
||||
|
||||
|
||||
class SvgDrawDoc(DrawDoc):
|
||||
class SvgDrawDoc(DrawDoc.DrawDoc):
|
||||
|
||||
def __init__(self,styles,type,orientation):
|
||||
DrawDoc.__init__(self,styles,type,orientation)
|
||||
DrawDoc.DrawDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
@ -68,12 +67,12 @@ class SvgDrawDoc(DrawDoc):
|
||||
self.f.write('"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\n')
|
||||
self.f.write('<svg width="%5.2fcm" height="%5.2fcm" ' % (self.width,self.height))
|
||||
self.f.write('xmlns="http://www.w3.org/2000/svg">\n')
|
||||
if self.orientation != PAPER_PORTRAIT:
|
||||
if self.orientation != TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('<g transform="rotate(-90); ')
|
||||
self.f.write(' translate(-%5.2fcm,0)">\n' % self.height)
|
||||
|
||||
def end_page(self):
|
||||
if self.orientation != PAPER_PORTRAIT:
|
||||
if self.orientation != TextDoc.PAPER_PORTRAIT:
|
||||
self.f.write('</g>\n')
|
||||
self.f.write('</svg>\n')
|
||||
self.f.close()
|
||||
@ -122,7 +121,7 @@ class SvgDrawDoc(DrawDoc):
|
||||
if font.get_italic():
|
||||
self.f.write('font-style="italic";')
|
||||
self.f.write('font-size:%d;' % font_size)
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
|
||||
self.f.write('font-family=sans-serif;')
|
||||
else:
|
||||
self.f.write('font-family=serif;')
|
||||
|
@ -20,17 +20,33 @@
|
||||
|
||||
"Graphical Reports/Ancestor Chart"
|
||||
|
||||
import GrampsCfg
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
from FontScale import string_width
|
||||
from DrawDoc import *
|
||||
from Report import *
|
||||
from SubstKeywords import SubstKeywords
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import GrampsCfg
|
||||
import DrawDoc
|
||||
import TextDoc
|
||||
import Report
|
||||
import Errors
|
||||
import FontScale
|
||||
from SubstKeywords import SubstKeywords
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -79,7 +95,7 @@ class AncestorChart:
|
||||
|
||||
self.font = self.doc.style_list["Normal"].get_font()
|
||||
for line in self.text[index]:
|
||||
self.box_width = max(self.box_width,string_width(self.font,line))
|
||||
self.box_width = max(self.box_width,FontScale.string_width(self.font,line))
|
||||
|
||||
self.lines = max(self.lines,len(self.text[index]))
|
||||
|
||||
@ -88,17 +104,12 @@ class AncestorChart:
|
||||
self.filter(family.getFather(),index*2)
|
||||
self.filter(family.getMother(),(index*2)+1)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
# filter - Generate the actual report
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
self.calc()
|
||||
try:
|
||||
self.doc.open(self.output)
|
||||
except:
|
||||
print _("Document write failure")
|
||||
raise Errors.ReportError(_("Could not create %s") % self.output)
|
||||
|
||||
generation = 1
|
||||
done = 0
|
||||
@ -120,14 +131,12 @@ class AncestorChart:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
# calc - calculate the maximum width that a box needs to be. From
|
||||
# that and the page dimensions, calculate the proper place to put
|
||||
# the elements on a page.
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def calc(self):
|
||||
"""
|
||||
calc - calculate the maximum width that a box needs to be. From
|
||||
that and the page dimensions, calculate the proper place to put
|
||||
the elements on a page.
|
||||
"""
|
||||
self.filter(self.start,1)
|
||||
|
||||
self.height = self.lines*pt2cm((125.0*self.font.get_size())/100.0)
|
||||
@ -148,21 +157,16 @@ class AncestorChart:
|
||||
ystart + 9*(uh/16.0), ystart + 11*(uh/16.0),
|
||||
ystart + 13*(uh/16.0), ystart + 15*(uh/16.0)]
|
||||
|
||||
g = GraphicsStyle()
|
||||
g = DrawDoc.GraphicsStyle()
|
||||
g.set_height(self.height)
|
||||
g.set_width(self.box_width)
|
||||
g.set_paragraph_style("Normal")
|
||||
g.set_shadow(1)
|
||||
self.doc.add_draw_style("box",g)
|
||||
|
||||
g = GraphicsStyle()
|
||||
g = DrawDoc.GraphicsStyle()
|
||||
self.doc.add_draw_style("line",g)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def get_numbers(self,start,index,vals):
|
||||
if index > 4:
|
||||
return
|
||||
@ -171,21 +175,11 @@ class AncestorChart:
|
||||
self.get_numbers(start*2,index+1,vals)
|
||||
self.get_numbers((start*2)+1,index+1,vals)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def print_page(self,start,generation, page):
|
||||
self.doc.start_page()
|
||||
self.draw_graph(1,start,0)
|
||||
self.doc.end_page()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def draw_graph(self,index,start,level):
|
||||
if self.map.has_key(start) and index <= 15:
|
||||
text = self.text[start]
|
||||
@ -210,18 +204,13 @@ class AncestorChart:
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# AncestorChartDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorChartDialog(DrawReportDialog):
|
||||
class AncestorChartDialog(Report.DrawReportDialog):
|
||||
def __init__(self,database,person):
|
||||
DrawReportDialog.__init__(self,database,person)
|
||||
Report.DrawReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Ancestor Chart"),_("Graphical Reports"))
|
||||
@ -248,25 +237,15 @@ class AncestorChartDialog(DrawReportDialog):
|
||||
return (_("Display Format"), "$n\nb. $b\nd. $d",
|
||||
_("Allows you to customize the data in the boxes in the report"))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create output styles appropriate to this report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Ancestor Chart report."""
|
||||
f = FontStyle()
|
||||
f = TextDoc.FontStyle()
|
||||
f.set_size(9)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
p = ParagraphStyle()
|
||||
f.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(f)
|
||||
self.default_style.add_style("Normal",p)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create the contents of the report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the Ancestor Chart.
|
||||
All user dialog has already been handled and the output file
|
||||
@ -282,7 +261,7 @@ class AncestorChartDialog(DrawReportDialog):
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# entry point
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
|
@ -20,23 +20,38 @@
|
||||
|
||||
"Text Reports/Ahnentafel Report"
|
||||
|
||||
import RelLib
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
from intl import gettext as _
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gnome.ui
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Report
|
||||
import TextDoc
|
||||
import RelLib
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# AncestorReport
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReport(Report):
|
||||
class AncestorReport(Report.Report):
|
||||
|
||||
def __init__(self,database,person,output,max,doc,pgbrk):
|
||||
self.map = {}
|
||||
@ -206,9 +221,9 @@ class AncestorReport(Report):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorReportDialog(TextReportDialog):
|
||||
class AncestorReportDialog(Report.TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
TextReportDialog.__init__(self,database,person)
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -234,23 +249,23 @@ class AncestorReportDialog(TextReportDialog):
|
||||
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Ahnentafel report."""
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=16,bold=1)
|
||||
para = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=16,bold=1)
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(1)
|
||||
para.set(pad=0.5)
|
||||
self.default_style.add_style("Title",para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=14,italic=1)
|
||||
para = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=14,italic=1)
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(2)
|
||||
para.set(pad=0.5)
|
||||
self.default_style.add_style("Generation",para)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set(first_indent=-1.0,lmargin=1.0,pad=0.25)
|
||||
self.default_style.add_style("Entry",para)
|
||||
|
||||
|
@ -40,14 +40,20 @@ import gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import GraphLayout
|
||||
from FontScale import string_width
|
||||
from DrawDoc import *
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
from SubstKeywords import SubstKeywords
|
||||
import FontScale
|
||||
import DrawDoc
|
||||
import Report
|
||||
import TextDoc
|
||||
import Errors
|
||||
|
||||
from SubstKeywords import SubstKeywords
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_sep = 0.5
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -91,7 +97,7 @@ class DescendantReport:
|
||||
|
||||
self.font = self.doc.style_list["Normal"].get_font()
|
||||
for line in self.text[p.getId()]:
|
||||
new_width = string_width(self.font,line)
|
||||
new_width = FontScale.string_width(self.font,line)
|
||||
self.box_width = max(self.box_width,new_width)
|
||||
|
||||
self.lines = max(self.lines,len(self.text[p.getId()]))
|
||||
@ -200,7 +206,7 @@ class DescendantReport:
|
||||
try:
|
||||
self.doc.open(self.output)
|
||||
except:
|
||||
print "Document open failure"
|
||||
Errors.ReportError(_("Could not create %s") % self.output)
|
||||
|
||||
for r in range(len(self.pg)):
|
||||
for c in range(len(self.pg[r])):
|
||||
@ -209,7 +215,7 @@ class DescendantReport:
|
||||
try:
|
||||
self.doc.close()
|
||||
except:
|
||||
print "Document close failure"
|
||||
Errors.ReportError(_("Could not create %s") % self.output)
|
||||
|
||||
def calc(self):
|
||||
"""calc - calculate the maximum width that a box needs to be. From
|
||||
@ -221,14 +227,14 @@ class DescendantReport:
|
||||
self.maxx = int(self.doc.get_usable_width()/(self.box_width+_sep))
|
||||
self.maxy = int(self.doc.get_usable_height()/(self.height+_sep))
|
||||
|
||||
g = GraphicsStyle()
|
||||
g = DrawDoc.GraphicsStyle()
|
||||
g.set_height(self.height)
|
||||
g.set_width(self.box_width)
|
||||
g.set_paragraph_style("Normal")
|
||||
g.set_shadow(1)
|
||||
self.doc.add_draw_style("box",g)
|
||||
|
||||
g = GraphicsStyle()
|
||||
g = DrawDoc.GraphicsStyle()
|
||||
self.doc.add_draw_style("line",g)
|
||||
|
||||
def print_page(self, plist,elist,r,c):
|
||||
@ -292,9 +298,10 @@ class DescendantReport:
|
||||
# DescendantReportDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReportDialog(DrawReportDialog):
|
||||
class DescendantReportDialog(Report.DrawReportDialog):
|
||||
|
||||
def __init__(self,database,person):
|
||||
DrawReportDialog.__init__(self,database,person)
|
||||
Report.DrawReportDialog.__init__(self,database,person)
|
||||
|
||||
def get_title(self):
|
||||
return "%s - %s - GRAMPS" % (_("Descendant Graph"),_("Graphical Reports"))
|
||||
@ -319,10 +326,10 @@ class DescendantReportDialog(DrawReportDialog):
|
||||
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Ancestor Chart report."""
|
||||
f = FontStyle()
|
||||
f = TextDoc.FontStyle()
|
||||
f.set_size(9)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
p = ParagraphStyle()
|
||||
f.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(f)
|
||||
self.default_style.add_style("Normal",p)
|
||||
|
||||
|
@ -34,8 +34,8 @@ import string
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
import Report
|
||||
import TextDoc
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -109,18 +109,13 @@ class DescendantReport:
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# DescendantReportDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantReportDialog(TextReportDialog):
|
||||
class DescendantReportDialog(Report.TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
TextReportDialog.__init__(self,database,person)
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Descendant Report"),_("Text Reports"))
|
||||
@ -140,18 +135,18 @@ class DescendantReportDialog(TextReportDialog):
|
||||
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Descendant Report."""
|
||||
f = FontStyle()
|
||||
f = TextDoc.FontStyle()
|
||||
f.set_size(14)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_header_level(1)
|
||||
p.set_font(f)
|
||||
self.default_style.add_style("Title",p)
|
||||
|
||||
f = FontStyle()
|
||||
f = TextDoc.FontStyle()
|
||||
for i in range(1,32):
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_left_margin(max(10.0,float(i-1)))
|
||||
self.default_style.add_style("Level%d" % i,p)
|
||||
|
@ -22,24 +22,34 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Module imports
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import sort
|
||||
import Utils
|
||||
import string
|
||||
import const
|
||||
import GenericFilter
|
||||
import ListModel
|
||||
from TextDoc import *
|
||||
from OpenSpreadSheet import *
|
||||
from intl import gettext as _
|
||||
|
||||
import gnome.ui
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import GenericFilter
|
||||
import ListModel
|
||||
import sort
|
||||
import Utils
|
||||
import TextDoc
|
||||
import OpenSpreadSheet
|
||||
|
||||
from QuestionDialog import WarningDialog
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -53,26 +63,26 @@ class TableReport:
|
||||
|
||||
def initialize(self,cols):
|
||||
|
||||
t = TableStyle()
|
||||
t = TextDoc.TableStyle()
|
||||
t.set_columns(cols)
|
||||
for index in range(0,cols):
|
||||
t.set_column_width(index,4)
|
||||
self.doc.add_table_style("mytbl",t)
|
||||
|
||||
f = FontStyle()
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f = TextDoc.FontStyle()
|
||||
f.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
f.set_size(12)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_background_color((0xcc,0xff,0xff))
|
||||
p.set_padding(0.1)
|
||||
self.doc.add_style("head",p)
|
||||
|
||||
f = FontStyle()
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f = TextDoc.FontStyle()
|
||||
f.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
f.set_size(10)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(f)
|
||||
self.doc.add_style("data",p)
|
||||
|
||||
@ -141,7 +151,7 @@ class EventComparison:
|
||||
plist = cfilter.apply(self.db.getPersonMap().values())
|
||||
|
||||
if len(plist) == 0:
|
||||
gnome.ui.GnomeWarningDialog(_("No matches were found"))
|
||||
WarningDialog(_("No matches were found"))
|
||||
else:
|
||||
DisplayChart(plist)
|
||||
|
||||
@ -211,10 +221,6 @@ class DisplayChart:
|
||||
for data in self.row_data:
|
||||
self.list.add(data)
|
||||
|
||||
# for index in range(0,len(self.event_titles)):
|
||||
# width = min(150,eventlist.optimal_column_width(index))
|
||||
# self.eventlist.set_column_width(index,width)
|
||||
|
||||
def build_row_data(self):
|
||||
for individual in self.my_list:
|
||||
name = individual.getPrimaryName().getName()
|
||||
@ -299,7 +305,8 @@ class DisplayChart:
|
||||
|
||||
name = self.form.get_widget("filename").get_text()
|
||||
|
||||
doc = OpenSpreadSheet(PaperStyle("junk",10,10),PAPER_PORTRAIT)
|
||||
pstyle = TextDoc.PaperStyle("junk",10,10)
|
||||
doc = OpenSpreadSheet.OpenSpreadSheet(pstyle,TextDoc.PAPER_PORTRAIT)
|
||||
spreadsheet = TableReport(name,doc)
|
||||
spreadsheet.initialize(len(self.event_titles))
|
||||
|
||||
|
@ -20,16 +20,26 @@
|
||||
|
||||
"Generate files/Family Group Report"
|
||||
|
||||
import RelLib
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
from intl import gettext as _
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# GRAMPS
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import RelLib
|
||||
import Report
|
||||
import TextDoc
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# FamilyGroup
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class FamilyGroup:
|
||||
@ -40,8 +50,7 @@ class FamilyGroup:
|
||||
self.output = output
|
||||
self.doc = doc
|
||||
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
@ -49,41 +58,41 @@ class FamilyGroup:
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('ParentHead',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('TextContents',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(0)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
self.doc.add_cell_style('TextChild1',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_left_border(1)
|
||||
cell.set_padding(0.1)
|
||||
self.doc.add_cell_style('TextChild2',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.1)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('TextContentsEnd',cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_bottom_border(1)
|
||||
cell.set_right_border(1)
|
||||
cell.set_left_border(1)
|
||||
self.doc.add_cell_style('ChildName',cell)
|
||||
|
||||
table = TableStyle()
|
||||
table = TextDoc.TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(3)
|
||||
table.set_column_width(0,20)
|
||||
@ -91,7 +100,7 @@ class FamilyGroup:
|
||||
table.set_column_width(2,40)
|
||||
self.doc.add_table_style('ParentTable',table)
|
||||
|
||||
table = TableStyle()
|
||||
table = TextDoc.TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(4)
|
||||
table.set_column_width(0,7)
|
||||
@ -321,18 +330,13 @@ class FamilyGroup:
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# FamilyGroupDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class FamilyGroupDialog(TextReportDialog):
|
||||
class FamilyGroupDialog(Report.TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
TextReportDialog.__init__(self,database,person)
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Family Group Report"),_("Text Reports"))
|
||||
@ -387,41 +391,41 @@ class FamilyGroupDialog(TextReportDialog):
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make default output style for the Family Group Report."""
|
||||
para = ParagraphStyle()
|
||||
font = FontStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(4)
|
||||
para.set_font(font)
|
||||
self.default_style.add_style('blank',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.default_style.add_style('Title',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_type_face(TextDoc.FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para = ParagraphStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.default_style.add_style('Normal',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.default_style.add_style('ChildText',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.default_style.add_style('ParentName',para)
|
||||
|
||||
|
@ -20,17 +20,37 @@
|
||||
|
||||
"Generate files/Relationship graph"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
from intl import gettext as _
|
||||
import Utils
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
from Report import *
|
||||
from TextDoc import *
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
import Report
|
||||
import TextDoc
|
||||
import GenericFilter
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_scaled = 0
|
||||
_single = 1
|
||||
_multiple = 2
|
||||
@ -43,18 +63,14 @@ _pagecount_map = {
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# GraphVizDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class GraphVizDialog(ReportDialog):
|
||||
def __init__(self,database,person):
|
||||
ReportDialog.__init__(self,database,person)
|
||||
class GraphVizDialog(Report.ReportDialog):
|
||||
|
||||
def __init__(self,database,person):
|
||||
Report.ReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Relationship Graph"),
|
||||
@ -211,11 +227,6 @@ class GraphVizDialog(ReportDialog):
|
||||
"controls the number pages in the array "
|
||||
"vertically."))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to selecting/changing the current file format
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_doc_menu(self):
|
||||
"""Build a one item menu of document types that are
|
||||
appropriate for this report."""
|
||||
@ -228,20 +239,10 @@ class GraphVizDialog(ReportDialog):
|
||||
make_report routine."""
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to setting up the dialog window
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def setup_style_frame(self):
|
||||
"""The style frame is not used in this dialog."""
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to retrieving data from the dialog window
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def parse_style_frame(self):
|
||||
"""The style frame is not used in this dialog."""
|
||||
pass
|
||||
@ -259,11 +260,6 @@ class GraphVizDialog(ReportDialog):
|
||||
self.vpages = self.vpages_sb.get_value_as_int()
|
||||
self.show_families = self.show_families_cb.get_active()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to creating the actual report document.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the GraphViz file."""
|
||||
width = self.paper.get_width_inches()
|
||||
@ -306,7 +302,7 @@ def write_dot(file, ind_list, orien, width, height, tb_margin,
|
||||
(height*vpages)-(tb_margin*2)-((vpages-1)*1.0)))
|
||||
file.write("page=\"%3.1f,%3.1f\";\n" % (width,height))
|
||||
|
||||
if orien == PAPER_LANDSCAPE:
|
||||
if orien == TextDoc.PAPER_LANDSCAPE:
|
||||
file.write("rotate=90;\n")
|
||||
|
||||
if len(ind_list) > 1:
|
||||
|
@ -33,9 +33,9 @@ import string
|
||||
#------------------------------------------------------------------------
|
||||
import RelLib
|
||||
import const
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
from Report import *
|
||||
import TextDoc
|
||||
import StyleEditor
|
||||
import Report
|
||||
import GenericFilter
|
||||
from intl import gettext as _
|
||||
|
||||
@ -65,29 +65,29 @@ class IndivComplete:
|
||||
self.output = output
|
||||
|
||||
def setup(self):
|
||||
tbl = TableStyle()
|
||||
tbl = TextDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
tbl.set_column_width(0,20)
|
||||
tbl.set_column_width(1,80)
|
||||
self.d.add_table_style("IndTable",tbl)
|
||||
|
||||
tbl = TableStyle()
|
||||
tbl = TextDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
tbl.set_column_width(0,50)
|
||||
tbl.set_column_width(1,50)
|
||||
self.d.add_table_style("ParentsTable",tbl)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
self.d.add_cell_style("TableHead",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
self.d.add_cell_style("NormalCell",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_longlist(1)
|
||||
self.d.add_cell_style("ListCell",cell)
|
||||
|
||||
@ -425,9 +425,9 @@ class IndivComplete:
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class IndivSummaryDialog(TextReportDialog):
|
||||
class IndivSummaryDialog(Report.TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
TextReportDialog.__init__(self,database,person)
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
|
||||
def add_user_options(self):
|
||||
self.use_srcs = gtk.CheckButton(_('Include Source Information'))
|
||||
@ -490,35 +490,35 @@ class IndivSummaryDialog(TextReportDialog):
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Individual Summary Report."""
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
p = ParagraphStyle()
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_italic(1)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("TableTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Normal",p)
|
||||
|
||||
|
@ -20,30 +20,40 @@
|
||||
|
||||
"Generate files/Individual Summary"
|
||||
|
||||
import RelLib
|
||||
import const
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
from intl import gettext as _
|
||||
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
from Report import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import RelLib
|
||||
import const
|
||||
import TextDoc
|
||||
import StyleEditor
|
||||
import Report
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# IndivSummary
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class IndivSummary:
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def __init__(self,database,person,output,document):
|
||||
self.d = document
|
||||
|
||||
@ -54,46 +64,31 @@ class IndivSummary:
|
||||
self.person = person
|
||||
self.output = output
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
tbl = TableStyle()
|
||||
tbl = TextDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
tbl.set_column_width(0,20)
|
||||
tbl.set_column_width(1,80)
|
||||
self.d.add_table_style("IndTable",tbl)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
self.d.add_cell_style("TableHead",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
self.d.add_cell_style("NormalCell",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_longlist(1)
|
||||
self.d.add_cell_style("ListCell",cell)
|
||||
|
||||
self.d.open(self.output)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def end(self):
|
||||
self.d.close()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_fact(self,event):
|
||||
if event == None:
|
||||
return
|
||||
@ -187,11 +182,6 @@ class IndivSummary:
|
||||
self.d.end_row()
|
||||
self.d.end_table()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_report(self):
|
||||
photo_list = self.person.getPhotoList()
|
||||
|
||||
@ -312,18 +302,14 @@ class IndivSummary:
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# IndivSummaryDialog
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class IndivSummaryDialog(TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
TextReportDialog.__init__(self,database,person)
|
||||
class IndivSummaryDialog(Report.TextReportDialog):
|
||||
|
||||
def __init__(self,database,person):
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" %(_("Individual Summary"),_("Text Reports"))
|
||||
@ -345,60 +331,44 @@ class IndivSummaryDialog(TextReportDialog):
|
||||
"""This report requires table support."""
|
||||
return 1
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create output styles appropriate to this report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Individual Summary Report."""
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
p = ParagraphStyle()
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_italic(1)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("TableTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_type_face(TextDoc.FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Normal",p)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to setting up the dialog window
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def setup_report_options(self):
|
||||
"""The 'Report Options' frame is not used in this dialog."""
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create the contents of the report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the Ancestor Chart.
|
||||
All user dialog has already been handled and the output file
|
||||
@ -409,7 +379,7 @@ class IndivSummaryDialog(TextReportDialog):
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# report
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person):
|
||||
@ -417,7 +387,7 @@ def report(database,person):
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# get_xpm_image
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_xpm_image():
|
||||
|
@ -20,19 +20,39 @@
|
||||
|
||||
"Database Processing/Extract information from names"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import re
|
||||
import Utils
|
||||
|
||||
from intl import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gnome/gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Utils
|
||||
from QuestionDialog import OkDialog
|
||||
from intl import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$")
|
||||
_nick_re = re.compile(r"(.+)[(\"](.*)[)\"]")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Search each name in the database, and compare the firstname against the
|
||||
@ -47,6 +67,11 @@ def runTool(database,active_person,callback):
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PatchNames
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PatchNames:
|
||||
|
||||
def __init__(self,db,callback):
|
||||
|
@ -44,6 +44,7 @@ import gtk.glade
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Errors
|
||||
import RelLib
|
||||
import Julian
|
||||
import FrenchRepublic
|
||||
@ -63,8 +64,6 @@ UNICODE = 2
|
||||
db = None
|
||||
callback = None
|
||||
|
||||
UNEXPECTED_EOF = "Unexpected End of File"
|
||||
|
||||
def nocnv(s):
|
||||
return unicode(s)
|
||||
|
||||
@ -132,8 +131,24 @@ def importData(database, filename, cb=None):
|
||||
ErrorDialog(_("%s could not be opened\n") % filename)
|
||||
return
|
||||
|
||||
close = g.parse_gedcom_file()
|
||||
g.resolve_refns()
|
||||
try:
|
||||
close = g.parse_gedcom_file()
|
||||
g.resolve_refns()
|
||||
except IOError,msg:
|
||||
Utils.destroy_passed_object(statusWindow)
|
||||
errmsg = _("%s could not be opened\n") % filename
|
||||
ErrorDialog(errmsg + str(msg))
|
||||
return
|
||||
except Errors.GedcomError, val:
|
||||
msg = str(val)
|
||||
Utils.destroy_passed_object(statusWindow)
|
||||
gnome.ui.GnomeErrorDialog(msg)
|
||||
return
|
||||
except:
|
||||
import DisplayTrace
|
||||
Utils.destroy_passed_object(statusWindow)
|
||||
DisplayTrace.DisplayTrace()
|
||||
return
|
||||
|
||||
statusTop.get_widget("close").set_sensitive(1)
|
||||
if close:
|
||||
@ -186,6 +201,7 @@ class GedcomParser:
|
||||
self.is_ftw = 0
|
||||
|
||||
self.f = open(file,"r")
|
||||
self.filename = file
|
||||
self.index = 0
|
||||
self.backoff = 0
|
||||
self.cnv = nocnv
|
||||
@ -261,7 +277,7 @@ class GedcomParser:
|
||||
next_line = string.strip(self.f.readline())
|
||||
self.text = string.translate(next_line,self.trans,self.delc)
|
||||
if self.text == '':
|
||||
raise UNEXPECTED_EOF
|
||||
raise Errors.GedcomError(_("GEDCOM file ended unexpectedly"))
|
||||
try:
|
||||
self.text = self.cnv(self.text)
|
||||
except:
|
||||
@ -313,8 +329,8 @@ class GedcomParser:
|
||||
self.parse_submitter()
|
||||
self.parse_record()
|
||||
self.parse_trailer()
|
||||
except UNEXPECTED_EOF:
|
||||
msg = 'Error: Incomplete file\n'
|
||||
except Errors.GedcomError, err:
|
||||
msg = str(err)
|
||||
self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg))
|
||||
|
||||
self.update(self.families_obj,str(self.fam_count))
|
||||
@ -1378,7 +1394,7 @@ class GedcomParser:
|
||||
line = string.replace(self.f.readline(),'\r','')
|
||||
match = headRE.search(line)
|
||||
if not match:
|
||||
raise GedcomParser.BadFile, line
|
||||
raise Errors.GedcomError("%s is not a GEDCOM file" % self.filename)
|
||||
self.index = self.index + 1
|
||||
|
||||
def parse_header_source(self):
|
||||
|
@ -20,26 +20,46 @@
|
||||
|
||||
"Web Site/Generate Web Site"
|
||||
|
||||
from RelLib import *
|
||||
from HtmlDoc import *
|
||||
|
||||
import const
|
||||
import GrampsCfg
|
||||
import GenericFilter
|
||||
import Date
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import re
|
||||
import sort
|
||||
import string
|
||||
import time
|
||||
import shutil
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
from gnome.ui import *
|
||||
from Report import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS module
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import RelLib
|
||||
import HtmlDoc
|
||||
import TextDoc
|
||||
import const
|
||||
import GrampsCfg
|
||||
import GenericFilter
|
||||
import Date
|
||||
import sort
|
||||
import Report
|
||||
from QuestionDialog import ErrorDialog
|
||||
from intl import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_month = [
|
||||
"", "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
|
||||
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]
|
||||
@ -50,15 +70,17 @@ _month = [
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def by_date(a,b):
|
||||
return compare_dates(a.getDateObj(),b.getDateObj())
|
||||
return Date.compare_dates(a.getDateObj(),b.getDateObj())
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# HtmlLickDoc
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class HtmlLinkDoc(HtmlDoc):
|
||||
|
||||
class HtmlLinkDoc(HtmlDoc.HtmlDoc):
|
||||
"""
|
||||
Version of the HtmlDoc class the provides the ability to create a link
|
||||
"""
|
||||
def start_link(self,path):
|
||||
self.f.write('<A HREF="%s">' % path)
|
||||
|
||||
@ -78,7 +100,8 @@ class HtmlLinkDoc(HtmlDoc):
|
||||
#------------------------------------------------------------------------
|
||||
class IndividualPage:
|
||||
|
||||
def __init__(self,person,photos,restrict,private,uc,link,map,dir_name,imgdir,doc,id,idlink,ext):
|
||||
def __init__(self,person,photos,restrict,private,uc,link,map,
|
||||
dir_name,imgdir,doc,id,idlink,ext):
|
||||
self.person = person
|
||||
self.ext = ext
|
||||
self.doc = doc
|
||||
@ -257,9 +280,9 @@ class IndividualPage:
|
||||
val = self.person.getId()
|
||||
self.write_normal_row("%s:" % _("ID Number"),val,None)
|
||||
|
||||
if self.person.getGender() == Person.male:
|
||||
if self.person.getGender() == RelLib.Person.male:
|
||||
self.write_normal_row("%s:" % _("Gender"), _("Male"),None)
|
||||
elif self.person.getGender() == Person.female:
|
||||
elif self.person.getGender() == RelLib.Person.female:
|
||||
self.write_normal_row("%s:" % _("Gender"), _("Female"),None)
|
||||
else:
|
||||
self.write_normal_row("%s:" % _("Gender"), _("Unknown"),None)
|
||||
@ -431,11 +454,6 @@ class IndividualPage:
|
||||
if count != 0:
|
||||
self.doc.end_table()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_notes(self):
|
||||
|
||||
if self.person.getNote() == "" or self.alive:
|
||||
@ -449,11 +467,6 @@ class IndividualPage:
|
||||
self.doc.write_text(self.person.getNote())
|
||||
self.doc.end_paragraph()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_fam_fact(self,event):
|
||||
|
||||
if event == None:
|
||||
@ -495,11 +508,6 @@ class IndividualPage:
|
||||
|
||||
self.write_marriage_row([name, val])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def write_families(self):
|
||||
if len(self.person.getFamilyList()) == 0:
|
||||
return
|
||||
@ -569,10 +577,10 @@ class IndividualPage:
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# WebReport
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class WebReport(Report):
|
||||
class WebReport(Report.Report):
|
||||
def __init__(self,db,person,target_path,max_gen,photos,filter,restrict,
|
||||
private, srccomments, include_link, style, image_dir,
|
||||
template_name,use_id,id_link,gendex,ext):
|
||||
@ -739,19 +747,19 @@ class WebReport(Report):
|
||||
elif not os.path.isdir(dir_name):
|
||||
parent_dir = os.path.dirname(dir_name)
|
||||
if not os.path.isdir(parent_dir):
|
||||
GnomeErrorDialog(_("Neither %s nor %s are directories") % \
|
||||
(dir_name,parent_dir))
|
||||
ErrorDialog(_("Neither %s nor %s are directories") % \
|
||||
(dir_name,parent_dir))
|
||||
return
|
||||
else:
|
||||
try:
|
||||
os.mkdir(dir_name)
|
||||
except IOError, value:
|
||||
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
||||
dir_name + "\n" + value[1])
|
||||
ErrorDialog(_("Could not create the directory : %s") % \
|
||||
dir_name + "\n" + value[1])
|
||||
return
|
||||
except:
|
||||
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
||||
dir_name)
|
||||
ErrorDialog(_("Could not create the directory : %s") % \
|
||||
dir_name)
|
||||
return
|
||||
|
||||
if self.image_dir:
|
||||
@ -762,11 +770,11 @@ class WebReport(Report):
|
||||
try:
|
||||
os.mkdir(image_dir_name)
|
||||
except IOError, value:
|
||||
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
||||
ErrorDialog(_("Could not create the directory : %s") % \
|
||||
image_dir_name + "\n" + value[1])
|
||||
return
|
||||
except:
|
||||
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
||||
ErrorDialog(_("Could not create the directory : %s") % \
|
||||
image_dir_name)
|
||||
return
|
||||
|
||||
@ -804,19 +812,19 @@ class WebReport(Report):
|
||||
self.progress_bar_done()
|
||||
|
||||
def add_styles(self,doc):
|
||||
tbl = TableStyle()
|
||||
tbl = TextDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_column_widths([15,85])
|
||||
doc.add_table_style("IndTable",tbl)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
doc.add_cell_style("NormalCell",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
doc.add_cell_style("ImageCell",cell)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell = TextDoc.TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
doc.add_cell_style("NoteCell",cell)
|
||||
|
||||
@ -826,9 +834,9 @@ class WebReport(Report):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class WebReportDialog(ReportDialog):
|
||||
class WebReportDialog(Report.ReportDialog):
|
||||
def __init__(self,database,person):
|
||||
ReportDialog.__init__(self,database,person)
|
||||
Report.ReportDialog.__init__(self,database,person)
|
||||
|
||||
def add_user_options(self):
|
||||
lnk_msg = _("Include a link to the index page")
|
||||
@ -882,11 +890,6 @@ class WebReportDialog(ReportDialog):
|
||||
def show_link(self,obj):
|
||||
self.linkpath.set_sensitive(obj.get_active())
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Generate Web Site"),_("Web Page"))
|
||||
@ -931,11 +934,6 @@ class WebReportDialog(ReportDialog):
|
||||
|
||||
return [all,des,df,ans]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Functions related to the default directory
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_default_directory(self):
|
||||
"""Get the name of the directory to which the target dialog
|
||||
box should default. This value can be set in the preferences
|
||||
@ -952,100 +950,95 @@ class WebReportDialog(ReportDialog):
|
||||
his/her preferences."""
|
||||
GrampsCfg.web_dir = value
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Create output style appropriate to this report.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def make_default_style(self):
|
||||
"""Make the default output style for the Web Pages Report."""
|
||||
font = FontStyle()
|
||||
font.set(bold=1, face=FONT_SANS_SERIF, size=16)
|
||||
p = ParagraphStyle()
|
||||
p.set(align=PARA_ALIGN_CENTER,font=font)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1, face=TextDoc.FONT_SANS_SERIF, size=16)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(align=TextDoc.PARA_ALIGN_CENTER,font=font)
|
||||
self.default_style.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,bborder=1)
|
||||
self.default_style.add_style("EventsTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,bborder=1)
|
||||
self.default_style.add_style("NotesTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=10)
|
||||
p = ParagraphStyle()
|
||||
p.set(font=font,align=PARA_ALIGN_CENTER)
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=10)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,align=TextDoc.PARA_ALIGN_CENTER)
|
||||
self.default_style.add_style("Copyright",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,bborder=1)
|
||||
self.default_style.add_style("SourcesTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=14,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=14,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font)
|
||||
self.default_style.add_style("IndexLabel",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,bborder=1)
|
||||
self.default_style.add_style("GalleryTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12,italic=1)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set(font=font,bborder=1)
|
||||
self.default_style.add_style("FamilyTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(size=12,italic=1)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Label",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("Data",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(bold=1,face=FONT_SANS_SERIF,size=12)
|
||||
p = ParagraphStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(bold=1,face=TextDoc.FONT_SANS_SERIF,size=12)
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("PhotoDescription",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(size=12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("PhotoNote",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(10)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("SourceParagraph",p)
|
||||
|
||||
font = FontStyle()
|
||||
font = TextDoc.FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p = TextDoc.ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.default_style.add_style("NotesParagraph",p)
|
||||
|
||||
@ -1088,7 +1081,7 @@ class WebReportDialog(ReportDialog):
|
||||
def parse_report_options_frame(self):
|
||||
"""Parse the report options frame of the dialog. Save the
|
||||
user selected choices for later use."""
|
||||
ReportDialog.parse_report_options_frame(self)
|
||||
Report.ReportDialog.parse_report_options_frame(self)
|
||||
self.include_link = self.use_link.get_active()
|
||||
|
||||
def parse_other_frames(self):
|
||||
|
@ -44,7 +44,7 @@ import gtk.glade
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
import RelLib
|
||||
import GenericFilter
|
||||
import const
|
||||
import Utils
|
||||
@ -53,10 +53,10 @@ import Calendar
|
||||
import Julian
|
||||
import Hebrew
|
||||
import FrenchRepublic
|
||||
import GedcomInfo
|
||||
|
||||
from intl import gettext as _
|
||||
from latin_utf8 import latin_to_utf8
|
||||
from GedcomInfo import *
|
||||
|
||||
try:
|
||||
from ansel import latin_to_ansel
|
||||
@ -70,7 +70,7 @@ except:
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_hmonth = [
|
||||
|
||||
"", "ELUL", "TSH", "CSH", "KSL", "TVT", "SHV", "ADR",
|
||||
"ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ]
|
||||
|
||||
_fmonth = [
|
||||
@ -345,7 +345,7 @@ class GedcomWriter:
|
||||
self.plist = {}
|
||||
self.slist = {}
|
||||
self.flist = {}
|
||||
self.adopt = ADOPT_EVENT
|
||||
self.adopt = GedcomInfo.ADOPT_EVENT
|
||||
self.fidval = 0
|
||||
self.fidmap = {}
|
||||
self.pidval = 0
|
||||
@ -383,7 +383,7 @@ class GedcomWriter:
|
||||
self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com])
|
||||
filter_obj.set_menu(self.filter_menu)
|
||||
|
||||
gedmap = GedcomInfoDB()
|
||||
gedmap = GedcomInfo.GedcomInfoDB()
|
||||
|
||||
target_obj = self.topDialog.get_widget("target")
|
||||
myMenu = gtk.Menu()
|
||||
@ -596,7 +596,7 @@ class GedcomWriter:
|
||||
if not self.plist.has_key(person.getId()):
|
||||
continue
|
||||
self.g.write("1 CHIL @%s@\n" % self.pid(person.getId()))
|
||||
if self.adopt == ADOPT_FTW:
|
||||
if self.adopt == GedcomInfo.ADOPT_FTW:
|
||||
if person.getMainParents() == family:
|
||||
self.g.write('2 _FREL Natural\n')
|
||||
self.g.write('2 _MREL Natural\n')
|
||||
@ -606,7 +606,7 @@ class GedcomWriter:
|
||||
self.g.write('2 _FREL %s\n' % f[2])
|
||||
self.g.write('2 _MREL %s\n' % f[1])
|
||||
break
|
||||
if self.adopt == ADOPT_LEGACY:
|
||||
if self.adopt == GedcomInfo.ADOPT_LEGACY:
|
||||
for f in person.getAltParentList():
|
||||
if f[0] == family:
|
||||
self.g.write('2 _STAT %s\n' % f[2])
|
||||
@ -649,13 +649,13 @@ class GedcomWriter:
|
||||
self.prefn(person)
|
||||
self.write_person_name(person.getPrimaryName(),person.getNickName())
|
||||
|
||||
if self.altname == ALT_NAME_STD:
|
||||
if self.altname == GedcomInfo.ALT_NAME_STD:
|
||||
for name in person.getAlternateNames():
|
||||
self.write_person_name(name,"")
|
||||
|
||||
if person.getGender() == Person.male:
|
||||
if person.getGender() == RelLib.Person.male:
|
||||
self.g.write("1 SEX M\n")
|
||||
elif person.getGender() == Person.female:
|
||||
elif person.getGender() == RelLib.Person.female:
|
||||
self.g.write("1 SEX F\n")
|
||||
|
||||
if not self.restrict or not person.probablyAlive():
|
||||
@ -692,7 +692,7 @@ class GedcomWriter:
|
||||
if val == "":
|
||||
val = self.target_ged.gramps2tag(name)
|
||||
|
||||
if self.adopt == ADOPT_EVENT and val == "ADOP":
|
||||
if self.adopt == GedcomInfo.ADOPT_EVENT and val == "ADOP":
|
||||
ad = 1
|
||||
self.g.write('1 ADOP\n')
|
||||
fam = None
|
||||
@ -719,7 +719,7 @@ class GedcomWriter:
|
||||
|
||||
self.dump_event_stats(event)
|
||||
|
||||
if self.adopt == ADOPT_EVENT and ad == 0 and len(person.getParentList()) != 0:
|
||||
if self.adopt == GedcomInfo.ADOPT_EVENT and ad == 0 and len(person.getParentList()) != 0:
|
||||
self.g.write('1 ADOP\n')
|
||||
fam = None
|
||||
for f in person.getParentList():
|
||||
@ -787,7 +787,7 @@ class GedcomWriter:
|
||||
for family in person.getParentList():
|
||||
if self.flist.has_key(family[0].getId()):
|
||||
self.g.write("1 FAMC @%s@\n" % self.fid(family[0].getId()))
|
||||
if self.adopt == ADOPT_PEDI:
|
||||
if self.adopt == GedcomInfo.ADOPT_PEDI:
|
||||
if string.lower(family[1]) == "adopted":
|
||||
self.g.write("2 PEDI Adopted\n")
|
||||
|
||||
@ -808,7 +808,7 @@ class GedcomWriter:
|
||||
self.write_long_text("NOTE",1,self.cnvtxt(person.getNote()))
|
||||
|
||||
def write_long_text(self,tag,level,note):
|
||||
if self.conc == CONC_OK:
|
||||
if self.conc == GedcomInfo.CONC_OK:
|
||||
self.write_conc_ok(tag,level,note)
|
||||
else:
|
||||
self.write_conc_broken(tag,level,note)
|
||||
|
@ -1,592 +0,0 @@
|
||||
#
|
||||
# WritePafPalm.py - export module to write pdb files for use with PAF for PalmOS
|
||||
#
|
||||
# Copyright (C) 2001 Jesper Zedlitz <jesper@zedlitz.de>
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
"Export to PAF for PalmOS"
|
||||
|
||||
from RelLib import *
|
||||
import os
|
||||
import string
|
||||
import time
|
||||
import const
|
||||
import Utils
|
||||
from intl import gettext as _
|
||||
|
||||
from gnome.ui import *
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
import const
|
||||
from latin_ansel import latin_to_ansel
|
||||
from latin_utf8 import latin_to_utf8
|
||||
|
||||
cnvtxt = latin_to_ansel
|
||||
database_name = "Untitled"
|
||||
description = ""
|
||||
|
||||
topDialog = None
|
||||
db = None
|
||||
|
||||
people_list = []
|
||||
family_list = []
|
||||
source_list = []
|
||||
string_list = {}
|
||||
number_of_records = 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def entire_database():
|
||||
global people_list
|
||||
global family_list
|
||||
global source_list
|
||||
|
||||
people_list = db.getPersonMap().values()
|
||||
family_list = db.getFamilyMap().values()
|
||||
source_list = db.getSourceMap().values()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def active_person_descendants():
|
||||
global people_list
|
||||
global family_list
|
||||
global source_list
|
||||
|
||||
people_list = []
|
||||
family_list = []
|
||||
source_list = []
|
||||
descend(active_person)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def active_person_ancestors_and_descendants():
|
||||
global people_list
|
||||
global family_list
|
||||
global source_list
|
||||
|
||||
people_list = []
|
||||
family_list = []
|
||||
source_list = []
|
||||
descend(active_person)
|
||||
ancestors(active_person)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def active_person_ancestors():
|
||||
global people_list
|
||||
global family_list
|
||||
global source_list
|
||||
|
||||
people_list = []
|
||||
family_list = []
|
||||
source_list = []
|
||||
ancestors(active_person)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def interconnected():
|
||||
global people_list
|
||||
global family_list
|
||||
global source_list
|
||||
|
||||
people_list = []
|
||||
family_list = []
|
||||
source_list = []
|
||||
walk(active_person)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def descend(person):
|
||||
if person == None or person in people_list:
|
||||
return
|
||||
people_list.append(person)
|
||||
add_persons_sources(person)
|
||||
for family in person.getFamilyList():
|
||||
add_familys_sources(family)
|
||||
family_list.append(family)
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
if father != None and father not in people_list:
|
||||
people_list.append(father)
|
||||
add_persons_sources(father)
|
||||
if mother != None and mother not in people_list:
|
||||
people_list.append(mother)
|
||||
add_persons_sources(mother)
|
||||
for child in family.getChildList():
|
||||
descend(child)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def ancestors(person):
|
||||
if person == None or person in people_list:
|
||||
return
|
||||
people_list.append(person)
|
||||
add_persons_sources(person)
|
||||
family = person.getMainParents()
|
||||
if family == None or family in family_list:
|
||||
return
|
||||
add_familys_sources(family)
|
||||
family_list.append(family)
|
||||
ancestors(family.getMother())
|
||||
ancestors(family.getFather())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def walk(person):
|
||||
if person == None or person in people_list:
|
||||
return
|
||||
people_list.append(person)
|
||||
add_persons_sources(person)
|
||||
families = person.getFamilyList()
|
||||
for f in person.getAltParentList():
|
||||
families.append(f[0])
|
||||
for family in families:
|
||||
if family == None or family in family_list:
|
||||
continue
|
||||
add_familys_sources(family)
|
||||
family_list.append(family)
|
||||
walk(family.getFather())
|
||||
walk(family.getMother())
|
||||
for child in family.getChildList():
|
||||
walk(child)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_persons_sources(person):
|
||||
elist = person.getEventList()[:]
|
||||
|
||||
elist.append(person.getBirth())
|
||||
elist.append(person.getDeath())
|
||||
for event in elist:
|
||||
if private and event.getPrivacy():
|
||||
continue
|
||||
source_ref = event.getSourceRef()
|
||||
if source_ref != None:
|
||||
source_list.append(source_ref)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_familys_sources(family):
|
||||
for event in family.getEventList():
|
||||
if private and event.getPrivacy():
|
||||
continue
|
||||
source_ref = event.getSourceRef()
|
||||
if source_ref != None:
|
||||
source_list.append(source_ref)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def sortById(first,second):
|
||||
fid = first.getId()
|
||||
sid = second.getId()
|
||||
|
||||
if fid == sid:
|
||||
return 0
|
||||
elif fid < sid:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def sortByName(first,second):
|
||||
fsn = first.getPrimaryName().getSurname()
|
||||
ssn = second.getPrimaryName().getSurname()
|
||||
|
||||
if fsn == ssn:
|
||||
ffn = first.getPrimaryName().getFirstName()
|
||||
sfn = second.getPrimaryName().getFirstName()
|
||||
if ffn == sfn:
|
||||
return 0
|
||||
elif ffn < sfn:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
elif fsn < ssn:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_year( event ):
|
||||
year = 0
|
||||
if event != None:
|
||||
dateObj = event.getDateObj()
|
||||
if dateObj != None:
|
||||
year = dateObj.getYear()
|
||||
if year < 0:
|
||||
year = 0
|
||||
return year
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_place( event ):
|
||||
place = ""
|
||||
if event != None:
|
||||
place = event.getPlaceName()
|
||||
if place == "":
|
||||
place = " "
|
||||
return place
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_date( event ):
|
||||
date = ""
|
||||
if event != None:
|
||||
date = event.getDate()
|
||||
if date == "":
|
||||
date = " "
|
||||
return date
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def text_ref( s ):
|
||||
global string_list
|
||||
global number_of_records
|
||||
text_offset = string_list[s]
|
||||
data = chr( (number_of_records-1)/256 ) + chr( (number_of_records-1) % 256 )
|
||||
data = data + chr( text_offset/256 ) + chr( text_offset % 256 )
|
||||
return data
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def write_16_bit( i ):
|
||||
return chr( i / 256 ) + chr ( i % 256 )
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def write_32_bit( i ):
|
||||
return write_16_bit( i / 65536 ) + write_16_bit( i % 65536 )
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database, filename):
|
||||
global database_name
|
||||
global description
|
||||
global string_list
|
||||
global number_of_records
|
||||
|
||||
g = open(filename,"wb")
|
||||
|
||||
number_of_records = len(people_list)+len(family_list)+1
|
||||
|
||||
g.write("%s-PAFg" % (database_name))
|
||||
g.write("\0"*( 27-len(database_name) ) )
|
||||
g.write("\0\x08\0\4")
|
||||
g.write("\xb7\xd7\x66\xf1") # creation time in seconds since 1904-01-01
|
||||
g.write("\xb7\xd7\x66\xf1") # modification time
|
||||
g.write("\0\0\0\0") # backup time
|
||||
g.write("\0\0\0\0\0\0")
|
||||
|
||||
offset_infoblock = 80 + 8 * number_of_records
|
||||
g.write( write_16_bit( offset_infoblock ) )
|
||||
g.write("\0\0\0\0GdatPAFg\0\0\0\0\0\0\0\0")
|
||||
g.write( write_16_bit( number_of_records ) )
|
||||
|
||||
# collect all string contained in the data
|
||||
for person in people_list:
|
||||
string_list[person.getPrimaryName().getFirstName()] = 0
|
||||
string_list[person.getPrimaryName().getSurname()] = 0
|
||||
string_list[ get_place( person.getBirth() ) ] = 0
|
||||
string_list[ get_date( person.getBirth() ) ] = 0
|
||||
string_list[ get_place( person.getDeath() ) ] = 0
|
||||
string_list[ get_date( person.getDeath() ) ] = 0
|
||||
string_list[ person.getNote() ] = 0
|
||||
for family in family_list:
|
||||
string_list[ get_place( family.getMarriage() ) ] = 0
|
||||
string_list[ get_date( family.getMarriage() ) ] = 0
|
||||
strings = string_list.keys()
|
||||
strings.sort()
|
||||
|
||||
offset = 0
|
||||
text_block = ""
|
||||
for s in strings:
|
||||
text_block = text_block + s + "\0"
|
||||
string_list[s] = offset
|
||||
offset = offset + len(s) +1
|
||||
|
||||
id_to_record = {}
|
||||
fid_to_record = {}
|
||||
|
||||
record_nr = len(people_list)
|
||||
for family in family_list:
|
||||
fid_to_record[ family.getId() ] = record_nr
|
||||
record_nr = record_nr +1
|
||||
|
||||
next_pointer = offset_infoblock + 512
|
||||
person_data = []
|
||||
people_list.sort(sortByName)
|
||||
record_nr = 0
|
||||
for person in people_list:
|
||||
id_to_record[ person.getId() ] = record_nr
|
||||
record_nr = record_nr +1
|
||||
data = "\0\0"
|
||||
|
||||
if person.getNote() != "":
|
||||
data = data + "\x10"
|
||||
else:
|
||||
data = data + "\0"
|
||||
|
||||
data = data + "\x0f"
|
||||
data = data + write_16_bit( int(person.getId()[1:])+1 )
|
||||
data = data + write_16_bit( get_year(person.getBirth()) )
|
||||
data = data + write_16_bit( get_year(person.getDeath()) )
|
||||
|
||||
if person.getMainParents() != None:
|
||||
data = data + write_16_bit( fid_to_record[person.getMainParents().getId()] )
|
||||
else:
|
||||
data = data + "\xff\xff"
|
||||
|
||||
families = person.getFamilyList()
|
||||
if len(families) > 0:
|
||||
data = data + "\1"
|
||||
else:
|
||||
data = data + "\0"
|
||||
|
||||
if person.getGender() == Person.female:
|
||||
data = data + "\1"
|
||||
else:
|
||||
data = data + "\2"
|
||||
|
||||
if len(families) > 0:
|
||||
data = data + write_16_bit( fid_to_record[ families[0].getId() ] )
|
||||
|
||||
data = data + text_ref( person.getPrimaryName().getSurname() )
|
||||
data = data + text_ref( person.getPrimaryName().getFirstName() )
|
||||
if get_year(person.getBirth()) > 0 :
|
||||
data = data + text_ref( get_date(person.getBirth()) )
|
||||
data = data + text_ref( get_place(person.getBirth()) )
|
||||
if get_year(person.getDeath()) > 0 :
|
||||
data = data + text_ref( get_date(person.getDeath()) )
|
||||
data = data + text_ref( get_place(person.getDeath()) )
|
||||
|
||||
if person.getNote() != "":
|
||||
data = data + text_ref( person.getNote() )
|
||||
|
||||
person_data.append(data)
|
||||
|
||||
# pointer to record
|
||||
g.write( write_32_bit( next_pointer ) )
|
||||
g.write("\0\0\0\0")
|
||||
next_pointer = next_pointer + len(data)
|
||||
|
||||
family_data = []
|
||||
for family in family_list:
|
||||
data = "\0\1"
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
|
||||
if father != None:
|
||||
data = data + write_16_bit( id_to_record[father.getId()] )
|
||||
else:
|
||||
data = data + "\xff\xff"
|
||||
|
||||
if mother != None:
|
||||
data = data + write_16_bit( id_to_record[mother.getId()] )
|
||||
else:
|
||||
data = data + "\xff\xff"
|
||||
|
||||
data = data + write_16_bit( get_year( family.getMarriage() ) )
|
||||
data = data + "\3"
|
||||
|
||||
children = family.getChildList()
|
||||
data = data + chr( len(children) )
|
||||
for child in children:
|
||||
data = data + write_16_bit( id_to_record[child.getId()] )
|
||||
|
||||
data = data + text_ref( get_date(family.getMarriage()) )
|
||||
data = data + text_ref( get_place(family.getMarriage()) )
|
||||
family_data.append(data)
|
||||
|
||||
# pointer to record
|
||||
g.write( write_32_bit( next_pointer ) )
|
||||
g.write("\0\0\0\0")
|
||||
next_pointer = next_pointer + len(data)
|
||||
|
||||
|
||||
# pointer to textblock
|
||||
g.write( write_32_bit( next_pointer ) )
|
||||
g.write("\0\0\0\0\0\0")
|
||||
|
||||
|
||||
infoblock = "\xb7\xd7\x66\xf1\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
infoblock = infoblock + "\0\0\0\0\0\0\0\0\0\1\0\1\0\1\0\1"
|
||||
infoblock = infoblock + "\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1"
|
||||
infoblock = infoblock + "\0\1\0\1\0\1\0\1\0\x03" \
|
||||
+ write_16_bit( len(people_list) ) \
|
||||
+ write_16_bit( len(family_list) )
|
||||
infoblock = infoblock + "\0\1\0\0\0"
|
||||
infoblock = infoblock + description
|
||||
# owner = database.getResearcher()
|
||||
# if owner.getName() != "":
|
||||
infoblock = infoblock + ( "\0"*(512- len(infoblock)) )
|
||||
g.write(infoblock)
|
||||
|
||||
for data in person_data:
|
||||
g.write(data)
|
||||
|
||||
for data in family_data:
|
||||
g.write(data)
|
||||
|
||||
g.write(text_block)
|
||||
g.close()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
global db
|
||||
global database_name
|
||||
global description
|
||||
global topDialog
|
||||
global restrict
|
||||
global private
|
||||
|
||||
database_name = topDialog.get_widget("dbname").get_text()
|
||||
description = topDialog.get_widget("description").get_text()
|
||||
restrict = topDialog.get_widget("restrict").get_active()
|
||||
private = topDialog.get_widget("private").get_active()
|
||||
filter_obj = topDialog.get_widget("filter").get_menu().get_active()
|
||||
filter = filter_obj.get_data("filter")
|
||||
|
||||
name = topDialog.get_widget("filename").get_text()
|
||||
filter()
|
||||
|
||||
exportData(db,name)
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database,person):
|
||||
global db
|
||||
global topDialog
|
||||
global active_person
|
||||
|
||||
db = database
|
||||
active_person = person
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "pafexport.glade"
|
||||
|
||||
dic = {
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : on_ok_clicked
|
||||
}
|
||||
|
||||
topDialog = gtk.glade.XML(glade_file,"pafExport")
|
||||
topDialog.signal_autoconnect(dic)
|
||||
|
||||
filter_obj = topDialog.get_widget("filter")
|
||||
myMenu = gtk.Menu()
|
||||
menuitem = gtk.MenuItem(_("Entire Database"))
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",entire_database)
|
||||
menuitem.show()
|
||||
name = active_person.getPrimaryName().getRegularName()
|
||||
menuitem = gtk.MenuItem(_("Ancestors of %s") % name)
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",active_person_ancestors)
|
||||
menuitem.show()
|
||||
menuitem = gtk.MenuItem(_("Descendants of %s") % name)
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",active_person_descendants)
|
||||
menuitem.show()
|
||||
menuitem = gtk.MenuItem(_("Ancestors and Descendants of %s") % name)
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",active_person_ancestors_and_descendants)
|
||||
menuitem.show()
|
||||
menuitem = gtk.MenuItem(_("People somehow connected to %s") % name)
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",interconnected)
|
||||
menuitem.show()
|
||||
filter_obj.set_menu(myMenu)
|
||||
|
||||
topDialog.get_widget("pafExport").show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_export
|
||||
|
||||
register_export(writeData,_("Export to PAF for PalmOS"))
|
Loading…
x
Reference in New Issue
Block a user