diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7d7b5fa82..0d894fd13 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,7 +19,6 @@ src/DisplayState.py
src/Errors.py
src/ExportAssistant.py
src/ExportOptions.py
-src/FontScale.py
src/GrampsAboutDialog.py
src/GrampsCfg.py
src/GrampsDisplay.py
@@ -417,7 +416,18 @@ src/gen/plug/menu/_string.py
src/gen/plug/menu/_style.py
src/gen/plug/menu/_surnamecolor.py
src/gen/plug/menu/_text.py
+src/gen/plug/docgen/__init__.py
src/gen/plug/docgen/basedoc.py
+src/gen/plug/docgen/drawdoc.py
+src/gen/plug/docgen/fontscale.py
+src/gen/plug/docgen/fontstyle.py
+src/gen/plug/docgen/graphdoc.py
+src/gen/plug/docgen/graphicstyle.py
+src/gen/plug/docgen/paperstyle.py
+src/gen/plug/docgen/paragraphstyle.py
+src/gen/plug/docgen/stylesheet.py
+src/gen/plug/docgen/tablestyle.py
+src/gen/plug/docgen/textdoc.py
src/gen/plug/docbackend/__init__.py
src/gen/plug/docbackend/cairobackend.py
src/gen/plug/docbackend/docbackend.py
diff --git a/src/Makefile.am b/src/Makefile.am
index acaa50dd9..98d3fa4a3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,7 +49,6 @@ gdir_PYTHON = \
Errors.py\
ExportAssistant.py\
ExportOptions.py\
- FontScale.py\
GrampsAboutDialog.py\
GrampsCfg.py\
GrampsDisplay.py\
diff --git a/src/ReportBase/_CommandLineReport.py b/src/ReportBase/_CommandLineReport.py
index b110e29fc..33bf1e935 100644
--- a/src/ReportBase/_CommandLineReport.py
+++ b/src/ReportBase/_CommandLineReport.py
@@ -42,8 +42,8 @@ log = logging.getLogger(".")
#-------------------------------------------------------------------------
import gen
import Utils
-from gen.plug.docgen import StyleSheet, StyleSheetList, PaperStyle
-from gen.plug.docgen.basedoc import (PAPER_PORTRAIT, PAPER_LANDSCAPE)
+from gen.plug.docgen import (StyleSheet, StyleSheetList, PaperStyle,
+ PAPER_PORTRAIT, PAPER_LANDSCAPE)
from BasicUtils import name_displayer
from ReportBase import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, \
CATEGORY_GRAPHVIZ
diff --git a/src/ReportBase/_Endnotes.py b/src/ReportBase/_Endnotes.py
index d2b8cd7df..4ab2de32e 100644
--- a/src/ReportBase/_Endnotes.py
+++ b/src/ReportBase/_Endnotes.py
@@ -22,8 +22,7 @@
"""
Provide utilities for printing endnotes in text reports.
"""
-from gen.plug.docgen import FontStyle, ParagraphStyle
-from gen.plug.docgen.basedoc import FONT_SANS_SERIF
+from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
from gettext import gettext as _
def add_endnote_styles(style_sheet):
diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py
index b8164a964..4da25295a 100644
--- a/src/ReportBase/_PaperMenu.py
+++ b/src/ReportBase/_PaperMenu.py
@@ -40,10 +40,10 @@ import gobject
# GRAMPS modules
#
#-------------------------------------------------------------------------
-from gen.plug.docgen import PaperStyle, PaperSize
-from gen.plug.docgen.basedoc import (PAPER_PORTRAIT, PAPER_LANDSCAPE)
+from gen.plug.docgen import PaperStyle, PaperSize, PAPER_PORTRAIT, \
+ PAPER_LANDSCAPE
+from gen.plug.utils import gfloat
import const
-import Utils
from glade import Glade
#-------------------------------------------------------------------------
@@ -342,8 +342,8 @@ class PageSizeParser(handler.ContentHandler):
def startElement(self,tag,attrs):
if tag == "page":
name = attrs['name']
- height = Utils.gfloat(attrs['height'])
- width = Utils.gfloat(attrs['width'])
+ height = gfloat(attrs['height'])
+ width = gfloat(attrs['width'])
self.paper_list.append(PaperSize(name, height,width))
#-------------------------------------------------------------------------
diff --git a/src/ReportBase/_ReportOptions.py b/src/ReportBase/_ReportOptions.py
index c28aa8ed6..d7bd0ea78 100644
--- a/src/ReportBase/_ReportOptions.py
+++ b/src/ReportBase/_ReportOptions.py
@@ -55,7 +55,7 @@ except:
#-------------------------------------------------------------------------
import const
import Config
-from gen.plug.docgen.basedoc import PAPER_PORTRAIT
+from gen.plug.docgen import PAPER_PORTRAIT
from PluginUtils import _Options, GuiMenuOptions
#-------------------------------------------------------------------------
diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py
index ae6adda89..b35cd8df5 100644
--- a/src/ReportBase/_ReportUtils.py
+++ b/src/ReportBase/_ReportUtils.py
@@ -50,8 +50,7 @@ from gen.lib.person import Person
from BasicUtils import name_displayer as _nd
from Utils import media_path_full
from QuestionDialog import WarningDialog
-from gen.plug.docgen import IndexMark
-from gen.plug.docgen.basedoc import INDEX_TYPE_ALP
+from gen.plug.docgen import IndexMark, INDEX_TYPE_ALP
#------------------------------------------------------------------------
#
diff --git a/src/ReportBase/_StyleEditor.py b/src/ReportBase/_StyleEditor.py
index de3042361..3eea1ec25 100644
--- a/src/ReportBase/_StyleEditor.py
+++ b/src/ReportBase/_StyleEditor.py
@@ -50,8 +50,7 @@ from gtk.gdk import Color
#------------------------------------------------------------------------
import Utils
import const
-from gen.plug.docgen import StyleSheet
-from gen.plug.docgen.basedoc import (FONT_SERIF, FONT_SANS_SERIF,
+from gen.plug.docgen import (StyleSheet, FONT_SERIF, FONT_SANS_SERIF,
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
PARA_ALIGN_JUSTIFY)
import ListModel
diff --git a/src/Simple/_SimpleDoc.py b/src/Simple/_SimpleDoc.py
index c1a4b91e9..190baae2d 100644
--- a/src/Simple/_SimpleDoc.py
+++ b/src/Simple/_SimpleDoc.py
@@ -21,9 +21,8 @@
"""
Provide a simplified database access interface to the GRAMPS database.
"""
-from gen.plug.docgen import StyleSheet, ParagraphStyle,\
- TableStyle, TableCellStyle
-from gen.plug.docgen.basedoc import FONT_SANS_SERIF, PARA_ALIGN_LEFT
+from gen.plug.docgen import StyleSheet, ParagraphStyle, TableStyle,\
+ TableCellStyle, FONT_SANS_SERIF, PARA_ALIGN_LEFT
class SimpleDoc(object):
"""
diff --git a/src/Utils.py b/src/Utils.py
index 8d32e0aae..3120cbfb8 100644
--- a/src/Utils.py
+++ b/src/Utils.py
@@ -431,33 +431,6 @@ from warnings import warn
def set_titles(window, title, t, msg=None):
warn('The Utils.set_titles is deprecated. Use ManagedWindow methods')
-def gfloat(val):
- """Convert to floating number, taking care of possible locale differences.
-
- Useful for reading float values from text entry fields
- while under non-English locale.
- """
-
- try:
- return float(val)
- except:
- try:
- return float(val.replace('.', ', '))
- except:
- return float(val.replace(', ', '.'))
- return 0.0
-
-def gformat(val):
- """Performs ('%.3f' % val) formatting with the resulting string always
- using dot ('.') as a decimal point.
-
- Useful for writing float values into XML when under non-English locale.
- """
-
- decimal_point = locale.localeconv()['decimal_point']
- return_val = "%.3f" % val
- return return_val.replace(decimal_point, '.')
-
def search_for(name):
if name.startswith( '"' ):
name = name.split('"')[1]
diff --git a/src/docgen/ODSDoc.py b/src/docgen/ODSDoc.py
index 06607f3e3..e7585839f 100644
--- a/src/docgen/ODSDoc.py
+++ b/src/docgen/ODSDoc.py
@@ -35,7 +35,7 @@ from gettext import gettext as _
# Gramps modules
#
#-------------------------------------------------------------------------
-from gen.plug.docgen.basedoc import FONT_SERIF
+from gen.plug.docgen import FONT_SERIF
from docgen import SpreadSheetDoc
import const
diff --git a/src/docgen/OpenSpreadSheet.py b/src/docgen/OpenSpreadSheet.py
index 33c4d3270..5c76ee6f3 100644
--- a/src/docgen/OpenSpreadSheet.py
+++ b/src/docgen/OpenSpreadSheet.py
@@ -35,7 +35,7 @@ from gettext import gettext as _
# Gramps modules
#
#-------------------------------------------------------------------------
-from gen.plug.docgen.basedoc import FONT_SERIF
+from gen.plug.docgen import FONT_SERIF
from SpreadSheetDoc import SpreadSheetDoc
import const
diff --git a/src/docgen/SpreadSheetDoc.py b/src/docgen/SpreadSheetDoc.py
index dba82e2e4..e428564fd 100644
--- a/src/docgen/SpreadSheetDoc.py
+++ b/src/docgen/SpreadSheetDoc.py
@@ -19,8 +19,7 @@
#
from gen.plug.docgen import FontStyle, ParagraphStyle, TableStyle,\
- TableCellStyle
-from gen.plug.docgen.basedoc import PAPER_PORTRAIT
+ TableCellStyle,PAPER_PORTRAIT
#------------------------------------------------------------------------
#
diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py
index 443f5c4f8..5197e38ef 100644
--- a/src/docgen/TextBufDoc.py
+++ b/src/docgen/TextBufDoc.py
@@ -35,8 +35,7 @@ import pango
# Gramps modules
#
#------------------------------------------------------------------------
-from gen.plug.docgen import BaseDoc, TextDoc
-from gen.plug.docgen.basedoc import (FONT_SERIF, PARA_ALIGN_RIGHT,
+from gen.plug.docgen import (BaseDoc, TextDoc, FONT_SERIF, PARA_ALIGN_RIGHT,
FONT_SANS_SERIF, FONT_MONOSPACE, PARA_ALIGN_CENTER,
PARA_ALIGN_LEFT)
import ManagedWindow
diff --git a/src/gen/plug/__init__.py b/src/gen/plug/__init__.py
index 2583f8a1e..3cbc91707 100644
--- a/src/gen/plug/__init__.py
+++ b/src/gen/plug/__init__.py
@@ -26,6 +26,7 @@ from _manager import PluginManager
from _import import ImportPlugin
from _export import ExportPlugin
from _docgenplugin import DocGenPlugin
+from utils import *
-__all__ = [ "docgen", "menu", Plugin, PluginManager, ImportPlugin,
- ExportPlugin, DocGenPlugin ]
+__all__ = [ "docbackend", "docgen", "menu", Plugin, PluginManager,
+ ImportPlugin, ExportPlugin, DocGenPlugin ]
diff --git a/src/gen/plug/docbackend/Makefile b/src/gen/plug/docbackend/Makefile
deleted file mode 100644
index b5e364c25..000000000
--- a/src/gen/plug/docbackend/Makefile
+++ /dev/null
@@ -1,388 +0,0 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
-# src/gen/plug/docbackend/Makefile. Generated from Makefile.in by configure.
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-
-# This is the src/gen/plug/menu level Makefile for Gramps
-# We could use GNU make's ':=' syntax for nice wildcard use,
-# but that is not necessarily portable.
-# If not using GNU make, then list all .py files individually
-
-pkglibdir = $(libdir)/gramps
-pkgincludedir = $(includedir)/gramps
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = src/gen/plug/docbackend
-DIST_COMMON = $(pkgdata_PYTHON) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkgdatadir)"
-pkgdataPYTHON_INSTALL = $(INSTALL_DATA)
-py_compile = $(top_srcdir)/py-compile
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-pkgdatadir = $(datadir)/gramps/gen/plug/docbackend
-ACLOCAL = ${SHELL} /home/Frog/trunk/missing --run aclocal-1.10
-ALL_LINGUAS = hu zh_CN cs da de es fr it nb nl nn pl pt_BR ro ru sv eo fi lt sk tr bg hr sl ca mk sq he
-AMTAR = ${SHELL} /home/Frog/trunk/missing --run tar
-AUTOCONF = ${SHELL} /home/Frog/trunk/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/Frog/trunk/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/Frog/trunk/missing --run automake-1.10
-AWK = gawk
-BINSH = /bin/sh
-CATALOGS = hu.gmo zh_CN.gmo cs.gmo da.gmo de.gmo es.gmo fr.gmo it.gmo nb.gmo nl.gmo nn.gmo pl.gmo pt_BR.gmo ro.gmo ru.gmo sv.gmo eo.gmo fi.gmo lt.gmo sk.gmo tr.gmo bg.gmo hr.gmo sl.gmo ca.gmo mk.gmo sq.gmo he.gmo
-CATOBJEXT = .gmo
-CC = gcc
-CCDEPMODE = depmode=none
-CFLAGS = -g -O2
-CPP = gcc -E
-CPPFLAGS =
-CYGPATH_W = echo
-DATADIRNAME = share
-DEFS = -DPACKAGE_NAME=\"gramps\" -DPACKAGE_TARNAME=\"gramps\" -DPACKAGE_VERSION=\"3.2.0\" -DPACKAGE_STRING=\"gramps\ 3.2.0\" -DPACKAGE_BUGREPORT=\"gramps-bugs@lists.sourceforge.net\" -DPACKAGE=\"gramps\" -DVERSION=\"3.2.0\" -DGETTEXT_PACKAGE=\"gramps\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1
-DEPDIR = .deps
-ECHO_C =
-ECHO_N = -n
-ECHO_T =
-EGREP = /bin/grep -E
-EXEEXT =
-GETTEXT_PACKAGE = gramps
-GMOFILES = hu.gmo zh_CN.gmo cs.gmo da.gmo de.gmo es.gmo fr.gmo it.gmo nb.gmo nl.gmo nn.gmo pl.gmo pt_BR.gmo ro.gmo ru.gmo sv.gmo eo.gmo fi.gmo lt.gmo sk.gmo tr.gmo bg.gmo hr.gmo sl.gmo ca.gmo mk.gmo sq.gmo he.gmo
-GMSGFMT = /usr/bin/msgfmt
-GREP = /bin/grep
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-INSTOBJEXT = .mo
-INTLLIBS =
-INTLTOOL_EXTRACT = /usr/bin/intltool-extract
-INTLTOOL_MERGE = /usr/bin/intltool-merge
-INTLTOOL_PERL = /usr/bin/perl
-INTLTOOL_UPDATE = /usr/bin/intltool-update
-LDFLAGS =
-LIBOBJS =
-LIBS =
-LTLIBOBJS =
-MAKEINFO = ${SHELL} /home/Frog/trunk/missing --run makeinfo
-MKDIR_P = /bin/mkdir -p
-MKINSTALLDIRS = ./mkinstalldirs
-MSGFMT = /usr/bin/msgfmt
-MSGFMT_OPTS = -c
-MSGMERGE = /usr/bin/msgmerge
-OBJEXT = o
-PACKAGE = gramps
-PACKAGE_BUGREPORT = gramps-bugs@lists.sourceforge.net
-PACKAGE_NAME = gramps
-PACKAGE_STRING = gramps 3.2.0
-PACKAGE_TARNAME = gramps
-PACKAGE_VERSION = 3.2.0
-PATH_SEPARATOR = :
-POFILES = hu.po zh_CN.po cs.po da.po de.po es.po fr.po it.po nb.po nl.po nn.po pl.po pt_BR.po ro.po ru.po sv.po eo.po fi.po lt.po sk.po tr.po bg.po hr.po sl.po ca.po mk.po sq.po he.po
-POSUB = po
-PO_IN_DATADIR_FALSE =
-PO_IN_DATADIR_TRUE =
-PYTHON = /usr/bin/python
-PYTHON_EXEC_PREFIX = ${exec_prefix}
-PYTHON_PLATFORM = linux2
-PYTHON_PREFIX = ${prefix}
-PYTHON_VERSION = 2.6
-RELEASE = 0.SVN12592
-SET_MAKE =
-SHARED_MIME_DIR = $(prefix)/share/mime
-SHELL = /bin/sh
-STRIP =
-USE_NLS = yes
-VERSION = 3.2.0
-VERSIONSTRING = 3.2.0-0.SVN12592
-XGETTEXT = /usr/bin/xgettext
-abs_builddir = /home/Frog/trunk/src/gen/plug/docbackend
-abs_srcdir = /home/Frog/trunk/src/gen/plug/docbackend
-abs_top_builddir = /home/Frog/trunk
-abs_top_srcdir = /home/Frog/trunk
-ac_ct_CC = gcc
-am__include = include
-am__leading_dot = .
-am__quote =
-am__tar = ${AMTAR} chof - "$$tardir"
-am__untar = ${AMTAR} xf -
-bindir = ${exec_prefix}/bin
-build_alias =
-builddir = .
-datadir = ${datarootdir}
-datarootdir = ${prefix}/share
-docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
-dvidir = ${docdir}
-exec_prefix = ${prefix}
-host_alias =
-htmldir = ${docdir}
-includedir = ${prefix}/include
-infodir = ${datarootdir}/info
-install_sh = $(SHELL) /home/Frog/trunk/install-sh
-libdir = ${exec_prefix}/lib
-libexecdir = ${exec_prefix}/libexec
-localedir = ${datarootdir}/locale
-localstatedir = ${prefix}/var
-mandir = ${datarootdir}/man
-mkdir_p = /bin/mkdir -p
-oldincludedir = /usr/include
-pdfdir = ${docdir}
-pkgpyexecdir = ${pyexecdir}/gramps/gen/plug/docbackend
-pkgpythondir = ${pythondir}/gramps/gen/plug/docbackend
-prefix = /usr/local
-program_transform_name = s,x,x,
-psdir = ${docdir}
-pyexecdir = ${exec_prefix}/lib/python2.6/site-packages
-pythondir = ${prefix}/lib/python2.6/site-packages
-sbindir = ${exec_prefix}/sbin
-sharedstatedir = ${prefix}/com
-srcdir = .
-sysconfdir = ${prefix}/etc
-target_alias =
-top_build_prefix = ../../../../
-top_builddir = ../../../..
-top_srcdir = ../../../..
-pkgdata_PYTHON = \
- __init__.py \
- cairobackend.py \
- docbackend.py \
- latexbackend.py
-
-
-# Clean up all the byte-compiled files
-MOSTLYCLEANFILES = *pyc *pyo
-GRAMPS_PY_MODPATH = "../../../"
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gen/plug/docbackend/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/gen/plug/docbackend/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkgdataPYTHON: $(pkgdata_PYTHON)
- @$(NORMAL_INSTALL)
- test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
- @list='$(pkgdata_PYTHON)'; dlist=''; for p in $$list; do\
- if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
- if test -f $$b$$p; then \
- f=$(am__strip_dir) \
- dlist="$$dlist $$f"; \
- echo " $(pkgdataPYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- $(pkgdataPYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
- else :; fi; \
- done; \
- if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgdatadir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgdatadir)" $$dlist; \
- fi; \
- else :; fi
-
-uninstall-pkgdataPYTHON:
- @$(NORMAL_UNINSTALL)
- @list='$(pkgdata_PYTHON)'; dlist=''; for p in $$list; do\
- f=$(am__strip_dir) \
- rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$${f}c"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$${f}o"; \
- done
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
- for dir in "$(DESTDIR)$(pkgdatadir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pkgdataPYTHON
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pkgdataPYTHON
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic distclean \
- distclean-generic distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-pkgdataPYTHON install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
- uninstall-am uninstall-pkgdataPYTHON
-
-
-pycheck:
- (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
- pychecker $(pkgdata_PYTHON));
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/gen/plug/docbackend/Makefile.in b/src/gen/plug/docbackend/Makefile.in
deleted file mode 100644
index e5ce6e201..000000000
--- a/src/gen/plug/docbackend/Makefile.in
+++ /dev/null
@@ -1,388 +0,0 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# This is the src/gen/plug/menu level Makefile for Gramps
-# We could use GNU make's ':=' syntax for nice wildcard use,
-# but that is not necessarily portable.
-# If not using GNU make, then list all .py files individually
-VPATH = @srcdir@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = src/gen/plug/docbackend
-DIST_COMMON = $(pkgdata_PYTHON) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkgdatadir)"
-pkgdataPYTHON_INSTALL = $(INSTALL_DATA)
-py_compile = $(top_srcdir)/py-compile
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-pkgdatadir = $(datadir)/@PACKAGE@/gen/plug/docbackend
-ACLOCAL = @ACLOCAL@
-ALL_LINGUAS = @ALL_LINGUAS@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BINSH = @BINSH@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DATADIRNAME = @DATADIRNAME@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INSTOBJEXT = @INSTOBJEXT@
-INTLLIBS = @INTLLIBS@
-INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
-INTLTOOL_MERGE = @INTLTOOL_MERGE@
-INTLTOOL_PERL = @INTLTOOL_PERL@
-INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-MSGFMT_OPTS = @MSGFMT_OPTS@
-MSGMERGE = @MSGMERGE@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-POFILES = @POFILES@
-POSUB = @POSUB@
-PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
-PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RELEASE = @RELEASE@
-SET_MAKE = @SET_MAKE@
-SHARED_MIME_DIR = @SHARED_MIME_DIR@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-VERSIONSTRING = @VERSIONSTRING@
-XGETTEXT = @XGETTEXT@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build_alias = @build_alias@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host_alias = @host_alias@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@/gen/plug/docbackend
-pkgpythondir = @pkgpythondir@/gen/plug/docbackend
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-pkgdata_PYTHON = \
- __init__.py \
- cairobackend.py \
- docbackend.py \
- latexbackend.py
-
-
-# Clean up all the byte-compiled files
-MOSTLYCLEANFILES = *pyc *pyo
-GRAMPS_PY_MODPATH = "../../../"
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gen/plug/docbackend/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/gen/plug/docbackend/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkgdataPYTHON: $(pkgdata_PYTHON)
- @$(NORMAL_INSTALL)
- test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
- @list='$(pkgdata_PYTHON)'; dlist=''; for p in $$list; do\
- if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
- if test -f $$b$$p; then \
- f=$(am__strip_dir) \
- dlist="$$dlist $$f"; \
- echo " $(pkgdataPYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- $(pkgdataPYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
- else :; fi; \
- done; \
- if test -n "$$dlist"; then \
- if test -z "$(DESTDIR)"; then \
- PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgdatadir)" $$dlist; \
- else \
- PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgdatadir)" $$dlist; \
- fi; \
- else :; fi
-
-uninstall-pkgdataPYTHON:
- @$(NORMAL_UNINSTALL)
- @list='$(pkgdata_PYTHON)'; dlist=''; for p in $$list; do\
- f=$(am__strip_dir) \
- rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$${f}c"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$${f}o"; \
- done
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
- for dir in "$(DESTDIR)$(pkgdatadir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pkgdataPYTHON
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pkgdataPYTHON
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic distclean \
- distclean-generic distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-pkgdataPYTHON install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
- uninstall-am uninstall-pkgdataPYTHON
-
-
-pycheck:
- (export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
- pychecker $(pkgdata_PYTHON));
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/gen/plug/docgen/Makefile.am b/src/gen/plug/docgen/Makefile.am
index 2c5898f47..5557d5687 100644
--- a/src/gen/plug/docgen/Makefile.am
+++ b/src/gen/plug/docgen/Makefile.am
@@ -7,7 +7,17 @@ pkgdatadir = $(datadir)/@PACKAGE@/gen/plug/docgen
pkgdata_PYTHON = \
__init__.py \
- basedoc.py
+ basedoc.py \
+ drawdoc.py \
+ fontscale.py \
+ fontstyle.py \
+ graphdoc.py \
+ graphicstyle.py \
+ paperstyle.py \
+ paragraphstyle.py \
+ stylesheet.py \
+ tablestyle.py \
+ textdoc.py
pkgpyexecdir = @pkgpyexecdir@/gen/plug/docgen
pkgpythondir = @pkgpythondir@/gen/plug/docgen
diff --git a/src/gen/plug/docgen/__init__.py b/src/gen/plug/docgen/__init__.py
index 5f665376a..e1764289f 100644
--- a/src/gen/plug/docgen/__init__.py
+++ b/src/gen/plug/docgen/__init__.py
@@ -25,6 +25,14 @@ The docgen package providing the API the document generating plugins can use.
A docgen plugin should fully implement this api for TextDoc or DrawDoc
"""
-from basedoc import BaseDoc, PaperSize, PaperStyle, FontStyle, ParagraphStyle,\
- TableStyle, TableCellStyle, StyleSheetList, StyleSheet,\
- SheetParser, GraphicsStyle, TextDoc, IndexMark, DrawDoc, GVDoc
+from basedoc import BaseDoc
+from paperstyle import PaperSize, PaperStyle, PAPER_PORTRAIT, PAPER_LANDSCAPE
+from fontstyle import FontStyle, FONT_SANS_SERIF, FONT_SERIF, FONT_MONOSPACE
+from paragraphstyle import ParagraphStyle, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,\
+ PARA_ALIGN_RIGHT, PARA_ALIGN_JUSTIFY
+from tablestyle import TableStyle, TableCellStyle
+from stylesheet import StyleSheetList, StyleSheet, SheetParser
+from graphicstyle import GraphicsStyle, SOLID, DASHED
+from textdoc import TextDoc, IndexMark,INDEX_TYPE_ALP, INDEX_TYPE_TOC
+from drawdoc import DrawDoc
+from graphdoc import GVDoc
diff --git a/src/gen/plug/docgen/basedoc.py b/src/gen/plug/docgen/basedoc.py
index e25dfa802..1f617e1ff 100644
--- a/src/gen/plug/docgen/basedoc.py
+++ b/src/gen/plug/docgen/basedoc.py
@@ -34,23 +34,13 @@ interfaces should be derived from the core classes.
# standard python modules
#
#-------------------------------------------------------------------------
-import os
-from xml.sax.saxutils import escape
-
-def escxml(string):
- """
- Escapes XML special characters.
- """
- return escape(string, { '"' : '"' } )
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import Utils
-import FontScale
-import const
+from stylesheet import StyleSheet
#-------------------------------------------------------------------------
#
@@ -58,1273 +48,7 @@ import const
#
#-------------------------------------------------------------------------
import logging
-log = logging.getLogger(".BaseDoc")
-
-#-------------------------------------------------------------------------
-#
-# SAX interface
-#
-#-------------------------------------------------------------------------
-try:
- from xml.sax import make_parser, handler, SAXParseException
-except ImportError:
- from _xmlplus.sax import make_parser, handler, SAXParseException
-
-#-------------------------------------------------------------------------
-#
-# constants
-#
-#-------------------------------------------------------------------------
-FONT_SANS_SERIF = 0
-FONT_SERIF = 1
-FONT_MONOSPACE = 2
-
-#-------------------------------------------------------------------------
-#
-# Page orientation
-#
-#-------------------------------------------------------------------------
-PAPER_PORTRAIT = 0
-PAPER_LANDSCAPE = 1
-
-#-------------------------------------------------------------------------
-#
-# Paragraph alignment
-#
-#-------------------------------------------------------------------------
-PARA_ALIGN_CENTER = 0
-PARA_ALIGN_LEFT = 1
-PARA_ALIGN_RIGHT = 2
-PARA_ALIGN_JUSTIFY = 3
-
-#-------------------------------------------------------------------------
-#
-# Text vs. Graphics mode
-#
-#-------------------------------------------------------------------------
-TEXT_MODE = 0
-GRAPHICS_MODE = 1
-
-#-------------------------------------------------------------------------
-#
-# Line style
-#
-#-------------------------------------------------------------------------
-SOLID = 0
-DASHED = 1
-
-#-------------------------------------------------------------------------
-#
-# IndexMark types
-#
-#-------------------------------------------------------------------------
-INDEX_TYPE_ALP = 0
-INDEX_TYPE_TOC = 1
-
-#------------------------------------------------------------------------
-#
-# cnv2color
-#
-#------------------------------------------------------------------------
-def cnv2color(text):
- """
- converts a hex value in the form of #XXXXXX into a tuple of integers
- representing the RGB values
- """
- return (int(text[1:3], 16), int(text[3:5], 16), int(text[5:7], 16))
-
-#------------------------------------------------------------------------
-#
-# PaperSize
-#
-#------------------------------------------------------------------------
-class PaperSize(object):
- """
- Defines the dimensions of a sheet of paper. All dimensions are in
- centimeters.
- """
- def __init__(self, name, height, width):
- """
- Create a new paper style with.
-
- @param name: name of the new style
- @param height: page height in centimeters
- @param width: page width in centimeters
- """
- self.name = name
- self.height = height
- self.width = width
-
- def get_name(self):
- "Return the name of the paper style"
- return self.name
-
- def get_height(self):
- "Return the page height in cm"
- return self.height
-
- def set_height(self, height):
- "Set the page height in cm"
- self.height = height
-
- def get_width(self):
- "Return the page width in cm"
- return self.width
-
- def set_width(self, width):
- "Set the page width in cm"
- self.width = width
-
- def get_height_inches(self):
- "Return the page height in inches"
- return self.height / 2.54
-
- def get_width_inches(self):
- "Return the page width in inches"
- return self.width / 2.54
-
-#------------------------------------------------------------------------
-#
-# PaperStyle
-#
-#------------------------------------------------------------------------
-class PaperStyle(object):
- """
- Define the various options for a sheet of paper.
- """
- def __init__(self, size, orientation,
- lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54):
- """
- Create a new paper style.
-
- @param size: size of the new style
- @type size: PaperSize
- @param orientation: page orientation
- @type orientation: PAPER_PORTRAIT or PAPER_LANDSCAPE
-
- """
- self.__orientation = orientation
-
- if orientation == PAPER_PORTRAIT:
- self.__size = PaperSize(size.get_name(),
- size.get_height(),
- size.get_width())
- else:
- self.__size = PaperSize(size.get_name(),
- size.get_width(),
- size.get_height())
- self.__lmargin = lmargin
- self.__rmargin = rmargin
- self.__tmargin = tmargin
- self.__bmargin = bmargin
-
- def get_size(self):
- """
- Return the size of the paper.
-
- @returns: object indicating the paper size
- @rtype: PaperSize
-
- """
- return self.__size
-
- def get_orientation(self):
- """
- Return the orientation of the page.
-
- @returns: PAPER_PORTRIAT or PAPER_LANDSCAPE
- @rtype: int
-
- """
- return self.__orientation
-
- def get_usable_width(self):
- """
- Return the width of the page area in centimeters.
-
- The value is the page width less the margins.
-
- """
- return self.__size.get_width() - (self.__rmargin + self.__lmargin)
-
- def get_usable_height(self):
- """
- Return the height of the page area in centimeters.
-
- The value is the page height less the margins.
-
- """
- return self.__size.get_height() - (self.__tmargin + self.__bmargin)
-
- def get_right_margin(self):
- """
- Return the right margin.
-
- @returns: Right margin in centimeters
- @rtype: float
-
- """
- return self.__rmargin
-
- def get_left_margin(self):
- """
- Return the left margin.
-
- @returns: Left margin in centimeters
- @rtype: float
-
- """
- return self.__lmargin
-
- def get_top_margin(self):
- """
- Return the top margin.
-
- @returns: Top margin in centimeters
- @rtype: float
-
- """
- return self.__tmargin
-
- def get_bottom_margin(self):
- """
- Return the bottom margin.
-
- @returns: Bottom margin in centimeters
- @rtype: float
-
- """
- return self.__bmargin
-
-#------------------------------------------------------------------------
-#
-# FontStyle
-#
-#------------------------------------------------------------------------
-class FontStyle(object):
- """
- Defines a font style. Controls the font face, size, color, and
- attributes. In order to remain generic, the only font faces available
- are FONT_SERIF and FONT_SANS_SERIF. Document formatters should convert
- these to the appropriate fonts for the target format.
-
- The FontStyle represents the desired characteristics. There are no
- guarentees that the document format generator will be able implement
- all or any of the characteristics.
- """
-
- def __init__(self, style=None):
- """
- Create a new FontStyle object, accepting the default values.
-
- @param style: if specified, initializes the FontStyle from the passed
- FontStyle instead of using the defaults.
- """
- if style:
- self.face = style.face
- self.size = style.size
- self.italic = style.italic
- self.bold = style.bold
- self.color = style.color
- self.under = style.under
- else:
- self.face = FONT_SERIF
- self.size = 12
- self.italic = 0
- self.bold = 0
- self.color = (0, 0, 0)
- self.under = 0
-
- def set(self, face=None, size=None, italic=None, bold=None,
- underline=None, color=None):
- """
- Set font characteristics.
-
- @param face: font type face, either FONT_SERIF or FONT_SANS_SERIF
- @param size: type face size in points
- @param italic: True enables italics, False disables italics
- @param bold: True enables bold face, False disables bold face
- @param underline: True enables underline, False disables underline
- @param color: an RGB color representation in the form of three integers
- in the range of 0-255 represeting the red, green, and blue
- components of a color.
- """
- if face is not None:
- self.set_type_face(face)
- if size is not None:
- self.set_size(size)
- if italic is not None:
- self.set_italic(italic)
- if bold is not None:
- self.set_bold(bold)
- if underline is not None:
- self.set_underline(underline)
- if color is not None:
- self.set_color(color)
-
- def set_italic(self, val):
- "0 disables italics, 1 enables italics"
- self.italic = val
-
- def get_italic(self):
- "1 indicates use italics"
- return self.italic
-
- def set_bold(self, val):
- "0 disables bold face, 1 enables bold face"
- self.bold = val
-
- def get_bold(self):
- "1 indicates use bold face"
- return self.bold
-
- def set_color(self, val):
- "sets the color using an RGB color tuple"
- self.color = val
-
- def get_color(self):
- "Return an RGB color tuple"
- return self.color
-
- def set_size(self, val):
- "sets font size in points"
- self.size = val
-
- def get_size(self):
- "returns font size in points"
- return self.size
-
- def set_type_face(self, val):
- "sets the font face type"
- self.face = val
-
- def get_type_face(self):
- "returns the font face type"
- return self.face
-
- def set_underline(self, val):
- "1 enables underlining"
- self.under = val
-
- def get_underline(self):
- "1 indicates underlining"
- return self.under
-
-#------------------------------------------------------------------------
-#
-# TableStyle
-#
-#------------------------------------------------------------------------
-class TableStyle(object):
- """
- Specifies the style or format of a table. The TableStyle contains the
- characteristics of table width (in percentage of the full width), the
- number of columns, and the width of each column as a percentage of the
- width of the table.
- """
- def __init__(self, obj=None):
- """
- Create a new TableStyle object, with the values initialized to
- empty, with allocating space for up to 100 columns.
-
- @param obj: if not None, then the object created gets is attributes
- from the passed object instead of being initialized to empty.
- """
- if obj:
- self.width = obj.width
- self.columns = obj.columns
- self.colwid = obj.colwid[:]
- else:
- self.width = 0
- self.columns = 0
- self.colwid = [ 0 ] * 100
-
- def set_width(self, width):
- """
- Set the width of the table in terms of percent of the available
- width
- """
- self.width = width
-
- def get_width(self):
- """
- Return the specified width as a percentage of the available space
- """
- return self.width
-
- def set_columns(self, columns):
- """
- Set the number of columns.
-
- @param columns: number of columns that should be used.
- """
- self.columns = columns
-
- def get_columns(self):
- """
- Return the number of columns
- """
- return self.columns
-
- def set_column_widths(self, clist):
- """
- Set the width of all the columns at once, taking the percentages
- from the passed list.
- """
- self.columns = len(clist)
- for i in range(self.columns):
- self.colwid[i] = clist[i]
-
- def set_column_width(self, index, width):
- """
- Set the width of a specified column to the specified width.
-
- @param index: column being set (index starts at 0)
- @param width: percentage of the table width assigned to the column
- """
- self.colwid[index] = width
-
- def get_column_width(self, index):
- """
- Return the column width of the specified column as a percentage of
- the entire table width.
-
- @param index: column to return (index starts at 0)
- """
- return self.colwid[index]
-
-#------------------------------------------------------------------------
-#
-# TableCellStyle
-#
-#------------------------------------------------------------------------
-class TableCellStyle(object):
- """
- Defines the style of a particular table cell. Characteristics are:
- right border, left border, top border, bottom border, and padding.
- """
- def __init__(self, obj=None):
- """
- Create a new TableCellStyle instance.
-
- @param obj: if not None, specifies that the values should be
- copied from the passed object instead of being initialized to empty.
- """
- if obj:
- self.rborder = obj.rborder
- self.lborder = obj.lborder
- self.tborder = obj.tborder
- self.bborder = obj.bborder
- self.padding = obj.padding
- self.longlist = obj.longlist
- else:
- self.rborder = 0
- self.lborder = 0
- self.tborder = 0
- self.bborder = 0
- self.padding = 0
- self.longlist = 0
-
- def set_padding(self, val):
- "Return the cell padding in centimeters"
- self.padding = val
-
- def set_right_border(self, val):
- """
- Defines if a right border in used
-
- @param val: if True, a right border is used, if False, it is not
- """
- self.rborder = val
-
- def set_left_border(self, val):
- """
- Defines if a left border in used
-
- @param val: if True, a left border is used, if False, it is not
- """
- self.lborder = val
-
- def set_top_border(self, val):
- """
- Defines if a top border in used
-
- @param val: if True, a top border is used, if False, it is not
- """
- self.tborder = val
-
- def set_bottom_border(self, val):
- """
- Defines if a bottom border in used
-
- @param val: if 1, a bottom border is used, if 0, it is not
- """
- self.bborder = val
-
- def set_longlist(self, val):
- self.longlist = val
-
- def get_padding(self):
- "Return the cell padding in centimeters"
- return self.padding
-
- def get_right_border(self):
- "Return 1 if a right border is requested"
- return self.rborder
-
- def get_left_border(self):
- "Return 1 if a left border is requested"
- return self.lborder
-
- def get_top_border(self):
- "Return 1 if a top border is requested"
- return self.tborder
-
- def get_bottom_border(self):
- "Return 1 if a bottom border is requested"
- return self.bborder
-
- def get_longlist(self):
- return self.longlist
-
-#------------------------------------------------------------------------
-#
-# ParagraphStyle
-#
-#------------------------------------------------------------------------
-class ParagraphStyle(object):
- """
- Defines the characteristics of a paragraph. The characteristics are:
- font (a FontStyle instance), right margin, left margin, first indent,
- top margin, bottom margin, alignment, level, top border, bottom border,
- right border, left border, padding, and background color.
-
- """
- def __init__(self, source=None):
- """
- @param source: if not None, then the ParagraphStyle is created
- using the values of the source instead of the default values.
- """
- if source:
- self.font = FontStyle(source.font)
- self.rmargin = source.rmargin
- self.lmargin = source.lmargin
- self.first_indent = source.first_indent
- self.tmargin = source.tmargin
- self.bmargin = source.bmargin
- self.align = source.align
- self.level = source.level
- self.top_border = source.top_border
- self.bottom_border = source.bottom_border
- self.right_border = source.right_border
- self.left_border = source.left_border
- self.pad = source.pad
- self.bgcolor = source.bgcolor
- self.description = source.description
- self.tabs = source.tabs
- else:
- self.font = FontStyle()
- self.rmargin = 0
- self.lmargin = 0
- self.tmargin = 0
- self.bmargin = 0
- self.first_indent = 0
- self.align = PARA_ALIGN_LEFT
- self.level = 0
- self.top_border = 0
- self.bottom_border = 0
- self.right_border = 0
- self.left_border = 0
- self.pad = 0
- self.bgcolor = (255, 255, 255)
- self.description = ""
- self.tabs = []
-
- def set_description(self, text):
- """
- Set the desciption of the paragraph
- """
- self.description = text
-
- def get_description(self):
- """
- Return the desciption of the paragraph
- """
- return self.description
-
- def set(self, rmargin=None, lmargin=None, first_indent=None,
- tmargin=None, bmargin=None, align=None,
- tborder=None, bborder=None, rborder=None, lborder=None,
- pad=None, bgcolor=None, font=None):
- """
- Allows the values of the object to be set.
-
- @param rmargin: right indent in centimeters
- @param lmargin: left indent in centimeters
- @param first_indent: first line indent in centimeters
- @param tmargin: space above paragraph in centimeters
- @param bmargin: space below paragraph in centimeters
- @param align: alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
- @param tborder: non zero indicates that a top border should be used
- @param bborder: non zero indicates that a bottom border should be used
- @param rborder: non zero indicates that a right border should be used
- @param lborder: non zero indicates that a left border should be used
- @param pad: padding in centimeters
- @param bgcolor: background color of the paragraph as an RGB tuple.
- @param font: FontStyle instance that defines the font
- """
- if font is not None:
- self.font = FontStyle(font)
- if pad is not None:
- self.set_padding(pad)
- if tborder is not None:
- self.set_top_border(tborder)
- if bborder is not None:
- self.set_bottom_border(bborder)
- if rborder is not None:
- self.set_right_border(rborder)
- if lborder is not None:
- self.set_left_border(lborder)
- if bgcolor is not None:
- self.set_background_color(bgcolor)
- if align is not None:
- self.set_alignment(align)
- if rmargin is not None:
- self.set_right_margin(rmargin)
- if lmargin is not None:
- self.set_left_margin(lmargin)
- if first_indent is not None:
- self.set_first_indent(first_indent)
- if tmargin is not None:
- self.set_top_margin(tmargin)
- if bmargin is not None:
- self.set_bottom_margin(bmargin)
-
- def set_header_level(self, level):
- """
- Set the header level for the paragraph. This is useful for
- numbered paragraphs. A value of 1 indicates a header level
- format of X, a value of two implies X.X, etc. A value of zero
- means no header level.
- """
- self.level = level
-
- def get_header_level(self):
- "Return the header level of the paragraph"
- return self.level
-
- def set_font(self, font):
- """
- Set the font style of the paragraph.
-
- @param font: FontStyle object containing the font definition to use.
- """
- self.font = FontStyle(font)
-
- def get_font(self):
- "Return the FontStyle of the paragraph"
- return self.font
-
- def set_padding(self, val):
- """
- Set the paragraph padding in centimeters
-
- @param val: floating point value indicating the padding in centimeters
- """
- self.pad = val
-
- def get_padding(self):
- """Return a the padding of the paragraph"""
- return self.pad
-
- def set_top_border(self, val):
- """
- Set the presence or absence of top border.
-
- @param val: True indicates a border should be used, False indicates
- no border.
- """
- self.top_border = val
-
- def get_top_border(self):
- "Return 1 if a top border is specified"
- return self.top_border
-
- def set_bottom_border(self, val):
- """
- Set the presence or absence of bottom border.
-
- @param val: True indicates a border should be used, False
- indicates no border.
- """
- self.bottom_border = val
-
- def get_bottom_border(self):
- "Return 1 if a bottom border is specified"
- return self.bottom_border
-
- def set_left_border(self, val):
- """
- Set the presence or absence of left border.
-
- @param val: True indicates a border should be used, False
- indicates no border.
- """
- self.left_border = val
-
- def get_left_border(self):
- "Return 1 if a left border is specified"
- return self.left_border
-
- def set_right_border(self, val):
- """
- Set the presence or absence of rigth border.
-
- @param val: True indicates a border should be used, False
- indicates no border.
- """
- self.right_border = val
-
- def get_right_border(self):
- "Return 1 if a right border is specified"
- return self.right_border
-
- def get_background_color(self):
- """
- Return a tuple indicating the RGB components of the background
- color
- """
- return self.bgcolor
-
- def set_background_color(self, color):
- """
- Set the background color of the paragraph.
-
- @param color: tuple representing the RGB components of a color
- (0,0,0) to (255,255,255)
- """
- self.bgcolor = color
-
- def set_alignment(self, align):
- """
- Set the paragraph alignment.
-
- @param align: PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER,
- or PARA_ALIGN_JUSTIFY
- """
- self.align = align
-
- def get_alignment(self):
- "Return the alignment of the paragraph"
- return self.align
-
- def get_alignment_text(self):
- """
- Return a text string representing the alginment, either 'left',
- 'right', 'center', or 'justify'
- """
- if self.align == PARA_ALIGN_LEFT:
- return "left"
- elif self.align == PARA_ALIGN_CENTER:
- return "center"
- elif self.align == PARA_ALIGN_RIGHT:
- return "right"
- elif self.align == PARA_ALIGN_JUSTIFY:
- return "justify"
- return "unknown"
-
- def set_left_margin(self, value):
- "sets the left indent in centimeters"
- self.lmargin = value
-
- def set_right_margin(self, value):
- "sets the right indent in centimeters"
- self.rmargin = value
-
- def set_first_indent(self, value):
- "sets the first line indent in centimeters"
- self.first_indent = value
-
- def set_top_margin(self, value):
- "sets the space above paragraph in centimeters"
- self.tmargin = value
-
- def set_bottom_margin(self, value):
- "sets the space below paragraph in centimeters"
- self.bmargin = value
-
- def get_left_margin(self):
- "returns the left indent in centimeters"
- return self.lmargin
-
- def get_right_margin(self):
- "returns the right indent in centimeters"
- return self.rmargin
-
- def get_first_indent(self):
- "returns the first line indent in centimeters"
- return self.first_indent
-
- def get_top_margin(self):
- "returns the space above paragraph in centimeters"
- return self.tmargin
-
- def get_bottom_margin(self):
- "returns the space below paragraph in centimeters"
- return self.bmargin
-
- def set_tabs(self, tab_stops):
- assert isinstance(tab_stops, list)
- self.tabs = tab_stops
-
- def get_tabs(self):
- return self.tabs
-
-#------------------------------------------------------------------------
-#
-# StyleSheetList
-#
-#------------------------------------------------------------------------
-class StyleSheetList(object):
- """
- Interface into the user's defined style sheets. Each StyleSheetList
- has a predefined default style specified by the report. Additional
- styles are loaded from a specified XML file if it exists.
- """
-
- def __init__(self, filename, defstyle):
- """
- Create a new StyleSheetList from the specified default style and
- any other styles that may be defined in the specified file.
-
- file - XML file that contains style definitions
- defstyle - default style
- """
- defstyle.set_name('default')
- self.map = { "default" : defstyle }
- self.file = os.path.join(const.HOME_DIR, filename)
- self.parse()
-
- def delete_style_sheet(self, name):
- """
- Remove a style from the list. Since each style must have a
- unique name, the name is used to delete the stylesheet.
-
- name - Name of the style to delete
- """
- del self.map[name]
-
- def get_style_sheet_map(self):
- """
- Return the map of names to styles.
- """
- return self.map
-
- def get_style_sheet(self, name):
- """
- Return the StyleSheet associated with the name
-
- name - name associated with the desired StyleSheet.
- """
- return self.map[name]
-
- def get_style_names(self):
- "Return a list of all the style names in the StyleSheetList"
- return self.map.keys()
-
- def set_style_sheet(self, name, style):
- """
- Add or replaces a StyleSheet in the StyleSheetList. The
- default style may not be replaced.
-
- name - name assocated with the StyleSheet to add or replace.
- style - definition of the StyleSheet
- """
- style.set_name(name)
- if name != "default":
- self.map[name] = style
-
- def save(self):
- """
- Saves the current StyleSheet definitions to the associated file.
- """
- xml_file = open(self.file,"w")
- xml_file.write("\n")
- xml_file.write('\n')
-
- for name, sheet in self.map.iteritems():
- if name == "default":
- continue
- xml_file.write('\n' % escxml(name))
- for p_name in sheet.get_paragraph_style_names():
- para = sheet.get_paragraph_style(p_name)
- xml_file.write('\n')
- xml_file.write('\n')
- xml_file.write('\n')
- xml_file.close()
-
- def parse(self):
- """
- Loads the StyleSheets from the associated file, if it exists.
- """
- try:
- if os.path.isfile(self.file):
- parser = make_parser()
- parser.setContentHandler(SheetParser(self))
- the_file = open(self.file)
- parser.parse(the_file)
- the_file.close()
- except (IOError,OSError,SAXParseException):
- pass
-
-#------------------------------------------------------------------------
-#
-# StyleSheet
-#
-#------------------------------------------------------------------------
-class StyleSheet(object):
- """
- A collection of named paragraph styles.
- """
-
- def __init__(self, obj=None):
- """
- Create a new empty StyleSheet.
-
- @param obj: if not None, creates the StyleSheet from the values in
- obj, instead of creating an empty StyleSheet
- """
- self.para_styles = {}
- self.draw_styles = {}
- self.table_styles = {}
- self.cell_styles = {}
- self.name = ""
- if obj is not None:
- for style_name, style in obj.para_styles.iteritems():
- self.para_styles[style_name] = ParagraphStyle(style)
- for style_name, style in obj.draw_styles.iteritems():
- self.draw_styles[style_name] = GraphicsStyle(style)
- for style_name, style in obj.table_styles.iteritems():
- self.table_styles[style_name] = TableStyle(style)
- for style_name, style in obj.cell_styles.iteritems():
- self.cell_styles[style_name] = TableCellStyle(style)
-
- def set_name(self, name):
- """
- Set the name of the StyleSheet
-
- @param name: The name to be given to the StyleSheet
- """
- self.name = name
-
- def get_name(self):
- """
- Return the name of the StyleSheet
- """
- return self.name
-
- def clear(self):
- "Remove all styles from the StyleSheet"
- self.para_styles = {}
- self.draw_styles = {}
- self.table_styles = {}
- self.cell_styles = {}
-
- def is_empty(self):
- "Checks if any styles are defined"
- style_count = len(self.para_styles) + \
- len(self.draw_styles) + \
- len(self.table_styles) + \
- len(self.cell_styles)
- if style_count > 0:
- return False
- else:
- return True
-
- def add_paragraph_style(self, name, style):
- """
- Add a paragraph style to the style sheet.
-
- @param name: The name of the ParagraphStyle
- @param style: ParagraphStyle instance to be added.
- """
- self.para_styles[name] = ParagraphStyle(style)
-
- def get_paragraph_style(self, name):
- """
- Return the ParagraphStyle associated with the name
-
- @param name: name of the ParagraphStyle that is wanted
- """
- return ParagraphStyle(self.para_styles[name])
-
- def get_paragraph_style_names(self):
- "Return the the list of paragraph names in the StyleSheet"
- return self.para_styles.keys()
-
- def add_draw_style(self, name, style):
- """
- Add a draw style to the style sheet.
-
- @param name: The name of the GraphicsStyle
- @param style: GraphicsStyle instance to be added.
- """
- self.draw_styles[name] = GraphicsStyle(style)
-
- def get_draw_style(self, name):
- """
- Return the GraphicsStyle associated with the name
-
- @param name: name of the GraphicsStyle that is wanted
- """
- return GraphicsStyle(self.draw_styles[name])
-
- def get_draw_style_names(self):
- "Return the the list of draw style names in the StyleSheet"
- return self.draw_styles.keys()
-
- def add_table_style(self, name, style):
- """
- Add a table style to the style sheet.
-
- @param name: The name of the TableStyle
- @param style: TableStyle instance to be added.
- """
- self.table_styles[name] = TableStyle(style)
-
- def get_table_style(self, name):
- """
- Return the TableStyle associated with the name
-
- @param name: name of the TableStyle that is wanted
- """
- return TableStyle(self.table_styles[name])
-
- def get_table_style_names(self):
- "Return the the list of table style names in the StyleSheet"
- return self.table_styles.keys()
-
- def add_cell_style(self, name, style):
- """
- Add a cell style to the style sheet.
-
- @param name: The name of the TableCellStyle
- @param style: TableCellStyle instance to be added.
- """
- self.cell_styles[name] = TableCellStyle(style)
-
- def get_cell_style(self, name):
- """
- Return the TableCellStyle associated with the name
-
- @param name: name of the TableCellStyle that is wanted
- """
- return TableCellStyle(self.cell_styles[name])
-
- def get_cell_style_names(self):
- "Return the the list of cell style names in the StyleSheet"
- return self.cell_styles.keys()
-
-#-------------------------------------------------------------------------
-#
-# SheetParser
-#
-#-------------------------------------------------------------------------
-class SheetParser(handler.ContentHandler):
- """
- SAX parsing class for the StyleSheetList XML file.
- """
-
- def __init__(self, sheetlist):
- """
- Create a SheetParser class that populates the passed StyleSheetList
- class.
-
- sheetlist - StyleSheetList instance to be loaded from the file.
- """
- handler.ContentHandler.__init__(self)
- self.sheetlist = sheetlist
- self.f = None
- self.p = None
- self.s = None
- self.sname = None
- self.pname = None
-
- def startElement(self, tag, attrs):
- """
- Overridden class that handles the start of a XML element
- """
- if tag == "sheet":
- self.s = StyleSheet(self.sheetlist.map["default"])
- self.sname = attrs['name']
- elif tag == "font":
- self.f = FontStyle()
- self.f.set_type_face(int(attrs['face']))
- self.f.set_size(int(attrs['size']))
- self.f.set_italic(int(attrs['italic']))
- self.f.set_bold(int(attrs['bold']))
- self.f.set_underline(int(attrs['underline']))
- self.f.set_color(cnv2color(attrs['color']))
- elif tag == "para":
- if attrs.has_key('description'):
- self.p.set_description(attrs['description'])
- self.p.set_right_margin(Utils.gfloat(attrs['rmargin']))
- self.p.set_right_margin(Utils.gfloat(attrs['rmargin']))
- self.p.set_left_margin(Utils.gfloat(attrs['lmargin']))
- self.p.set_first_indent(Utils.gfloat(attrs['first']))
- try:
- # This is needed to read older style files
- # lacking tmargin and bmargin
- self.p.set_top_margin(Utils.gfloat(attrs['tmargin']))
- self.p.set_bottom_margin(Utils.gfloat(attrs['bmargin']))
- except KeyError:
- pass
- self.p.set_padding(Utils.gfloat(attrs['pad']))
- self.p.set_alignment(int(attrs['align']))
- self.p.set_right_border(int(attrs['rborder']))
- self.p.set_header_level(int(attrs['level']))
- self.p.set_left_border(int(attrs['lborder']))
- self.p.set_top_border(int(attrs['tborder']))
- self.p.set_bottom_border(int(attrs['bborder']))
- self.p.set_background_color(cnv2color(attrs['bgcolor']))
- elif tag == "style":
- self.p = ParagraphStyle()
- self.pname = attrs['name']
-
- def endElement(self, tag):
- "Overridden class that handles the start of a XML element"
- if tag == "style":
- self.p.set_font(self.f)
- self.s.add_paragraph_style(self.pname, self.p)
- elif tag == "sheet":
- self.sheetlist.set_style_sheet(self.sname, self.s)
-
-#------------------------------------------------------------------------
-#
-# GraphicsStyle
-#
-#------------------------------------------------------------------------
-class GraphicsStyle(object):
- """
- Defines the properties of graphics objects, such as line width,
- color, fill, ect.
- """
- def __init__(self, obj=None):
- """
- Initialize the object with default values, unless a source
- object is specified. In that case, make a copy of the source
- object.
- """
- if obj:
- self.para_name = obj.para_name
- self.shadow = obj.shadow
- self.shadow_space = obj.shadow_space
- self.color = obj.color
- self.fill_color = obj.fill_color
- self.lwidth = obj.lwidth
- self.lstyle = obj.lstyle
- else:
- self.para_name = ""
- self.shadow = 0
- self.shadow_space = 0.2
- self.lwidth = 0.5
- self.color = (0, 0, 0)
- self.fill_color = (255, 255, 255)
- self.lstyle = SOLID
-
- def set_line_width(self, val):
- """
- sets the line width
- """
- self.lwidth = val
-
- def get_line_width(self):
- """
- Return the name of the StyleSheet
- """
- return self.lwidth
-
- def get_line_style(self):
- return self.lstyle
-
- def set_line_style(self, val):
- self.lstyle = val
-
- def set_paragraph_style(self, val):
- self.para_name = val
-
- def set_shadow(self, val, space=0.2):
- self.shadow = val
- self.shadow_space = space
-
- def get_shadow_space(self):
- return self.shadow_space
-
- def set_color(self, val):
- self.color = val
-
- def set_fill_color(self, val):
- self.fill_color = val
-
- def get_paragraph_style(self):
- return self.para_name
-
- def get_shadow(self):
- return self.shadow
-
- def get_color(self):
- return self.color
-
- def get_fill_color(self):
- return self.fill_color
-
-#------------------------------------------------------------------------
-#
-# IndexMark
-#
-#------------------------------------------------------------------------
-class IndexMark(object):
- """
- Defines a mark to be associated with text for indexing.
- """
- def __init__(self, key="", itype=INDEX_TYPE_ALP, level=1):
- """
- Initialize the object with default values, unless values are specified.
- """
- self.key = key
- self.type = itype
- self.level = level
+log = logging.getLogger(".basedoc")
#------------------------------------------------------------------------
#
@@ -1398,318 +122,3 @@ class BaseDoc(object):
def close(self):
"Closes the document"
raise NotImplementedError
-
-
-#------------------------------------------------------------------------
-#
-# TextDoc
-#
-#------------------------------------------------------------------------
-
-class TextDoc(object):
- """
- Abstract Interface for text document generators. Output formats for
- text reports must implment this interface to be used by the report
- system.
- """
- def page_break(self):
- "Forces a page break, creating a new page"
- raise NotImplementedError
-
- def start_bold(self):
- raise NotImplementedError
-
- def end_bold(self):
- raise NotImplementedError
-
- def start_superscript(self):
- raise NotImplementedError
-
- def end_superscript(self):
- raise NotImplementedError
-
- def start_paragraph(self, style_name, leader=None):
- """
- Starts a new paragraph, using the specified style name.
-
- @param style_name: name of the ParagraphStyle to use for the
- paragraph.
- @param leader: Leading text for a paragraph. Typically used
- for numbering.
- """
- raise NotImplementedError
-
- def end_paragraph(self):
- "Ends the current parsgraph"
- raise NotImplementedError
-
- def start_table(self, name, style_name):
- """
- Starts a new table.
-
- @param name: Unique name of the table.
- @param style_name: TableStyle to use for the new table
- """
- raise NotImplementedError
-
- def end_table(self):
- "Ends the current table"
- raise NotImplementedError
-
- def start_row(self):
- "Starts a new row on the current table"
- raise NotImplementedError
-
- def end_row(self):
- "Ends the current row on the current table"
- raise NotImplementedError
-
- def start_cell(self, style_name, span=1):
- """
- Starts a new table cell, using the paragraph style specified.
-
- @param style_name: TableCellStyle to use for the cell
- @param span: number of columns to span
- """
- raise NotImplementedError
-
- def end_cell(self):
- "Ends the current table cell"
- raise NotImplementedError
-
- def write_text(self, text, mark=None):
- """
- Writes the text in the current paragraph. Should only be used after a
- start_paragraph and before an end_paragraph.
-
- @param text: text to write.
- @param mark: IndexMark to use for indexing (if supported)
- """
- raise NotImplementedError
-
- def write_markup(self, text, s_tags):
- """
- Writes the text in the current paragraph. Should only be used after a
- start_paragraph and before an end_paragraph. Not all backends support
- s_tags, then the same happens as with write_text. Backends supporting
- write_markup will overwrite this method
-
- @param text: text to write. The text is assumed to be _not_ escaped
- @param s_tags: assumed to be list of styledtexttags to apply to the
- text
- """
- self.write_text(text)
-
- def write_note(self, text, format, style_name):
- """
- Writes the note's text and take care of paragraphs,
- depending on the format.
-
- @param text: text to write.
- @param format: format to use for writing. True for flowed text,
- 1 for preformatted text.
- """
- raise NotImplementedError
-
- def write_styled_note(self, styledtext, format, style_name):
- """
- Convenience function to write a styledtext to the cairo doc.
- styledtext : assumed a StyledText object to write
- format : = 0 : Flowed, = 1 : Preformatted
- style_name : name of the style to use for default presentation
-
- overwrite this method if the backend supports styled notes
- """
- text = str(styledtext)
- self.write_note(text, format, style_name)
-
- def write_text_citation(self, text, mark=None):
- """Method to write text with GRAMPS citation marks"""
- if not text:
- return
- parts = text.split("")
- markset = False
- for piece in parts:
- if not piece:
- # a text 'text ...' splits as '', 'text..'
- continue
- piecesplit = piece.split("")
- if len(piecesplit) == 2:
- self.start_superscript()
- self.write_text(piecesplit[0])
- self.end_superscript()
- if not piecesplit[1]:
- #text ended with ' ... '
- continue
- if not markset:
- self.write_text(piecesplit[1], mark)
- markset = True
- else:
- self.write_text(piecesplit[1])
- else:
- if not markset:
- self.write_text(piece, mark)
- markset = True
- else:
- self.write_text(piece)
-
- def add_media_object(self, name, align, w_cm, h_cm):
- """
- Add a photo of the specified width (in centimeters)
-
- @param name: filename of the image to add
- @param align: alignment of the image. Valid values are 'left',
- 'right', 'center', and 'single'
- @param w_cm: width in centimeters
- @param h_cm: height in centimeters
- """
- raise NotImplementedError
-
-#------------------------------------------------------------------------
-#
-# DrawDoc
-#
-#------------------------------------------------------------------------
-class DrawDoc(object):
- """
- Abstract Interface for graphical document generators. Output formats
- for graphical reports must implment this interface to be used by the
- report system.
- """
-
- def start_page(self):
- raise NotImplementedError
-
- def end_page(self):
- raise NotImplementedError
-
- def get_usable_width(self):
- """
- Return the width of the text area in centimeters. The value is
- the page width less the margins.
- """
- width = self.paper.get_size().get_width()
- right = self.paper.get_right_margin()
- left = self.paper.get_left_margin()
- return width - (right + left)
-
- def get_usable_height(self):
- """
- Return the height of the text area in centimeters. The value is
- the page height less the margins.
- """
- height = self.paper.get_size().get_height()
- top = self.paper.get_top_margin()
- bottom = self.paper.get_bottom_margin()
- return height - (top + bottom)
-
- def string_width(self, fontstyle, text):
- "Determine the width need for text in given font"
- return FontScale.string_width(fontstyle, text)
-
- def draw_path(self, style, path):
- raise NotImplementedError
-
- def draw_box(self, style, text, x, y, w, h):
- raise NotImplementedError
-
- def draw_text(self, style, text, x1, y1):
- raise NotImplementedError
-
- def center_text(self, style, text, x1, y1):
- raise NotImplementedError
-
- def rotate_text(self, style, text, x, y, angle):
- raise NotImplementedError
-
- def draw_line(self, style, x1, y1, x2, y2):
- raise NotImplementedError
-
-#-------------------------------------------------------------------------------
-#
-# GVDoc
-#
-#-------------------------------------------------------------------------------
-class GVDoc(object):
- """
- Abstract Interface for Graphviz document generators. Output formats
- for Graphviz reports must implment this interface to be used by the
- report system.
- """
- def add_node(self, node_id, label, shape="", color="",
- style="", fillcolor="", url="", htmloutput=False):
- """
- Add a node to this graph. Nodes can be different shapes like boxes and
- circles.
-
- @param node_id: A unique identification value for this node.
- Example: "p55"
- @type node_id: string
- @param label: The text to be displayed in the node.
- Example: "John Smith"
- @type label: string
- @param shape: The shape for the node.
- Examples: "box", "ellipse", "circle"
- @type shape: string
- @param color: The color of the node line.
- Examples: "blue", "lightyellow"
- @type color: string
- @param style: The style of the node.
- @type style: string
- @param fillcolor: The fill color for the node.
- Examples: "blue", "lightyellow"
- @type fillcolor: string
- @param url: A URL for the node.
- @type url: string
- @param htmloutput: Whether the label contains HTML.
- @type htmloutput: boolean
- @return: nothing
- """
- raise NotImplementedError
-
- def add_link(self, id1, id2, style="", head="", tail="", comment=""):
- """
- Add a link between two nodes.
-
- @param id1: The unique identifier of the starting node.
- Example: "p55"
- @type id1: string
- @param id2: The unique identifier of the ending node.
- Example: "p55"
- @type id2: string
- @param comment: A text string displayed at the end of the link line.
- Example: "person C is the son of person A and person B"
- @type comment: string
- @return: nothing
- """
- raise NotImplementedError
-
- def add_comment(self, comment):
- """
- Add a comment to the source file.
-
- @param comment: A text string to add as a comment.
- Example: "Next comes the individuals."
- @type comment: string
- @return: nothing
- """
- raise NotImplementedError
-
- def start_subgraph(self, graph_id):
- """
- Start a subgraph in this graph.
-
- @param id: The unique identifier of the subgraph.
- Example: "p55"
- @type id1: string
- @return: nothing
- """
- raise NotImplementedError
-
- def end_subgraph(self):
- """
- End a subgraph that was previously started in this graph.
-
- @return: nothing
- """
- raise NotImplementedError
diff --git a/src/gen/plug/docgen/drawdoc.py b/src/gen/plug/docgen/drawdoc.py
new file mode 100644
index 000000000..d7006c7aa
--- /dev/null
+++ b/src/gen/plug/docgen/drawdoc.py
@@ -0,0 +1,107 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+import fontscale
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".drawdoc")
+
+#------------------------------------------------------------------------
+#
+# DrawDoc
+#
+#------------------------------------------------------------------------
+class DrawDoc(object):
+ """
+ Abstract Interface for graphical document generators. Output formats
+ for graphical reports must implment this interface to be used by the
+ report system.
+ """
+
+ def start_page(self):
+ raise NotImplementedError
+
+ def end_page(self):
+ raise NotImplementedError
+
+ def get_usable_width(self):
+ """
+ Return the width of the text area in centimeters. The value is
+ the page width less the margins.
+ """
+ width = self.paper.get_size().get_width()
+ right = self.paper.get_right_margin()
+ left = self.paper.get_left_margin()
+ return width - (right + left)
+
+ def get_usable_height(self):
+ """
+ Return the height of the text area in centimeters. The value is
+ the page height less the margins.
+ """
+ height = self.paper.get_size().get_height()
+ top = self.paper.get_top_margin()
+ bottom = self.paper.get_bottom_margin()
+ return height - (top + bottom)
+
+ def string_width(self, fontstyle, text):
+ "Determine the width need for text in given font"
+ return fontscale.string_width(fontstyle, text)
+
+ def draw_path(self, style, path):
+ raise NotImplementedError
+
+ def draw_box(self, style, text, x, y, w, h):
+ raise NotImplementedError
+
+ def draw_text(self, style, text, x1, y1):
+ raise NotImplementedError
+
+ def center_text(self, style, text, x1, y1):
+ raise NotImplementedError
+
+ def rotate_text(self, style, text, x, y, angle):
+ raise NotImplementedError
+
+ def draw_line(self, style, x1, y1, x2, y2):
+ raise NotImplementedError
diff --git a/src/FontScale.py b/src/gen/plug/docgen/fontscale.py
similarity index 99%
rename from src/FontScale.py
rename to src/gen/plug/docgen/fontscale.py
index 46fbb2ba8..8d77633f3 100644
--- a/src/FontScale.py
+++ b/src/gen/plug/docgen/fontscale.py
@@ -258,6 +258,8 @@ def string_width(font, text):
"""
returns with width of a string in the specified font
"""
+ ## TODO: Does it not make sense to use writing on a pango Layout to know
+ ## text width?
i = font.get_type_face()
j = font.get_bold() + font.get_italic()*2
s = font.get_size()
diff --git a/src/gen/plug/docgen/fontstyle.py b/src/gen/plug/docgen/fontstyle.py
new file mode 100644
index 000000000..39f14094a
--- /dev/null
+++ b/src/gen/plug/docgen/fontstyle.py
@@ -0,0 +1,170 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".fontstyle")
+
+
+#-------------------------------------------------------------------------
+#
+# constants
+#
+#-------------------------------------------------------------------------
+FONT_SANS_SERIF = 0
+FONT_SERIF = 1
+FONT_MONOSPACE = 2
+
+#------------------------------------------------------------------------
+#
+# FontStyle
+#
+#------------------------------------------------------------------------
+class FontStyle(object):
+ """
+ Defines a font style. Controls the font face, size, color, and
+ attributes. In order to remain generic, the only font faces available
+ are FONT_SERIF and FONT_SANS_SERIF. Document formatters should convert
+ these to the appropriate fonts for the target format.
+
+ The FontStyle represents the desired characteristics. There are no
+ guarentees that the document format generator will be able implement
+ all or any of the characteristics.
+ """
+
+ def __init__(self, style=None):
+ """
+ Create a new FontStyle object, accepting the default values.
+
+ @param style: if specified, initializes the FontStyle from the passed
+ FontStyle instead of using the defaults.
+ """
+ if style:
+ self.face = style.face
+ self.size = style.size
+ self.italic = style.italic
+ self.bold = style.bold
+ self.color = style.color
+ self.under = style.under
+ else:
+ self.face = FONT_SERIF
+ self.size = 12
+ self.italic = 0
+ self.bold = 0
+ self.color = (0, 0, 0)
+ self.under = 0
+
+ def set(self, face=None, size=None, italic=None, bold=None,
+ underline=None, color=None):
+ """
+ Set font characteristics.
+
+ @param face: font type face, either FONT_SERIF or FONT_SANS_SERIF
+ @param size: type face size in points
+ @param italic: True enables italics, False disables italics
+ @param bold: True enables bold face, False disables bold face
+ @param underline: True enables underline, False disables underline
+ @param color: an RGB color representation in the form of three integers
+ in the range of 0-255 represeting the red, green, and blue
+ components of a color.
+ """
+ if face is not None:
+ self.set_type_face(face)
+ if size is not None:
+ self.set_size(size)
+ if italic is not None:
+ self.set_italic(italic)
+ if bold is not None:
+ self.set_bold(bold)
+ if underline is not None:
+ self.set_underline(underline)
+ if color is not None:
+ self.set_color(color)
+
+ def set_italic(self, val):
+ "0 disables italics, 1 enables italics"
+ self.italic = val
+
+ def get_italic(self):
+ "1 indicates use italics"
+ return self.italic
+
+ def set_bold(self, val):
+ "0 disables bold face, 1 enables bold face"
+ self.bold = val
+
+ def get_bold(self):
+ "1 indicates use bold face"
+ return self.bold
+
+ def set_color(self, val):
+ "sets the color using an RGB color tuple"
+ self.color = val
+
+ def get_color(self):
+ "Return an RGB color tuple"
+ return self.color
+
+ def set_size(self, val):
+ "sets font size in points"
+ self.size = val
+
+ def get_size(self):
+ "returns font size in points"
+ return self.size
+
+ def set_type_face(self, val):
+ "sets the font face type"
+ self.face = val
+
+ def get_type_face(self):
+ "returns the font face type"
+ return self.face
+
+ def set_underline(self, val):
+ "1 enables underlining"
+ self.under = val
+
+ def get_underline(self):
+ "1 indicates underlining"
+ return self.under
diff --git a/src/gen/plug/docgen/graphdoc.py b/src/gen/plug/docgen/graphdoc.py
new file mode 100644
index 000000000..c4b1c4a1f
--- /dev/null
+++ b/src/gen/plug/docgen/graphdoc.py
@@ -0,0 +1,130 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".graphdoc")
+
+#-------------------------------------------------------------------------------
+#
+# GVDoc
+#
+#-------------------------------------------------------------------------------
+class GVDoc(object):
+ """
+ Abstract Interface for Graphviz document generators. Output formats
+ for Graphviz reports must implment this interface to be used by the
+ report system.
+ """
+ def add_node(self, node_id, label, shape="", color="",
+ style="", fillcolor="", url="", htmloutput=False):
+ """
+ Add a node to this graph. Nodes can be different shapes like boxes and
+ circles.
+
+ @param node_id: A unique identification value for this node.
+ Example: "p55"
+ @type node_id: string
+ @param label: The text to be displayed in the node.
+ Example: "John Smith"
+ @type label: string
+ @param shape: The shape for the node.
+ Examples: "box", "ellipse", "circle"
+ @type shape: string
+ @param color: The color of the node line.
+ Examples: "blue", "lightyellow"
+ @type color: string
+ @param style: The style of the node.
+ @type style: string
+ @param fillcolor: The fill color for the node.
+ Examples: "blue", "lightyellow"
+ @type fillcolor: string
+ @param url: A URL for the node.
+ @type url: string
+ @param htmloutput: Whether the label contains HTML.
+ @type htmloutput: boolean
+ @return: nothing
+ """
+ raise NotImplementedError
+
+ def add_link(self, id1, id2, style="", head="", tail="", comment=""):
+ """
+ Add a link between two nodes.
+
+ @param id1: The unique identifier of the starting node.
+ Example: "p55"
+ @type id1: string
+ @param id2: The unique identifier of the ending node.
+ Example: "p55"
+ @type id2: string
+ @param comment: A text string displayed at the end of the link line.
+ Example: "person C is the son of person A and person B"
+ @type comment: string
+ @return: nothing
+ """
+ raise NotImplementedError
+
+ def add_comment(self, comment):
+ """
+ Add a comment to the source file.
+
+ @param comment: A text string to add as a comment.
+ Example: "Next comes the individuals."
+ @type comment: string
+ @return: nothing
+ """
+ raise NotImplementedError
+
+ def start_subgraph(self, graph_id):
+ """
+ Start a subgraph in this graph.
+
+ @param id: The unique identifier of the subgraph.
+ Example: "p55"
+ @type id1: string
+ @return: nothing
+ """
+ raise NotImplementedError
+
+ def end_subgraph(self):
+ """
+ End a subgraph that was previously started in this graph.
+
+ @return: nothing
+ """
+ raise NotImplementedError
diff --git a/src/gen/plug/docgen/graphicstyle.py b/src/gen/plug/docgen/graphicstyle.py
new file mode 100644
index 000000000..46fca60b7
--- /dev/null
+++ b/src/gen/plug/docgen/graphicstyle.py
@@ -0,0 +1,135 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".graphicstyle")
+
+#-------------------------------------------------------------------------
+#
+# Line style
+#
+#-------------------------------------------------------------------------
+SOLID = 0
+DASHED = 1
+
+#------------------------------------------------------------------------
+#
+# GraphicsStyle
+#
+#------------------------------------------------------------------------
+class GraphicsStyle(object):
+ """
+ Defines the properties of graphics objects, such as line width,
+ color, fill, ect.
+ """
+ def __init__(self, obj=None):
+ """
+ Initialize the object with default values, unless a source
+ object is specified. In that case, make a copy of the source
+ object.
+ """
+ if obj:
+ self.para_name = obj.para_name
+ self.shadow = obj.shadow
+ self.shadow_space = obj.shadow_space
+ self.color = obj.color
+ self.fill_color = obj.fill_color
+ self.lwidth = obj.lwidth
+ self.lstyle = obj.lstyle
+ else:
+ self.para_name = ""
+ self.shadow = 0
+ self.shadow_space = 0.2
+ self.lwidth = 0.5
+ self.color = (0, 0, 0)
+ self.fill_color = (255, 255, 255)
+ self.lstyle = SOLID
+
+ def set_line_width(self, val):
+ """
+ sets the line width
+ """
+ self.lwidth = val
+
+ def get_line_width(self):
+ """
+ Return the name of the StyleSheet
+ """
+ return self.lwidth
+
+ def get_line_style(self):
+ return self.lstyle
+
+ def set_line_style(self, val):
+ self.lstyle = val
+
+ def set_paragraph_style(self, val):
+ self.para_name = val
+
+ def set_shadow(self, val, space=0.2):
+ self.shadow = val
+ self.shadow_space = space
+
+ def get_shadow_space(self):
+ return self.shadow_space
+
+ def set_color(self, val):
+ self.color = val
+
+ def set_fill_color(self, val):
+ self.fill_color = val
+
+ def get_paragraph_style(self):
+ return self.para_name
+
+ def get_shadow(self):
+ return self.shadow
+
+ def get_color(self):
+ return self.color
+
+ def get_fill_color(self):
+ return self.fill_color
diff --git a/src/gen/plug/docgen/paperstyle.py b/src/gen/plug/docgen/paperstyle.py
new file mode 100644
index 000000000..f3e92b8a1
--- /dev/null
+++ b/src/gen/plug/docgen/paperstyle.py
@@ -0,0 +1,217 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".paperstyle")
+
+#-------------------------------------------------------------------------
+#
+# Page orientation
+#
+#-------------------------------------------------------------------------
+PAPER_PORTRAIT = 0
+PAPER_LANDSCAPE = 1
+
+#------------------------------------------------------------------------
+#
+# PaperSize
+#
+#------------------------------------------------------------------------
+class PaperSize(object):
+ """
+ Defines the dimensions of a sheet of paper. All dimensions are in
+ centimeters.
+ """
+ def __init__(self, name, height, width):
+ """
+ Create a new paper style with.
+
+ @param name: name of the new style
+ @param height: page height in centimeters
+ @param width: page width in centimeters
+ """
+ self.name = name
+ self.height = height
+ self.width = width
+
+ def get_name(self):
+ "Return the name of the paper style"
+ return self.name
+
+ def get_height(self):
+ "Return the page height in cm"
+ return self.height
+
+ def set_height(self, height):
+ "Set the page height in cm"
+ self.height = height
+
+ def get_width(self):
+ "Return the page width in cm"
+ return self.width
+
+ def set_width(self, width):
+ "Set the page width in cm"
+ self.width = width
+
+ def get_height_inches(self):
+ "Return the page height in inches"
+ return self.height / 2.54
+
+ def get_width_inches(self):
+ "Return the page width in inches"
+ return self.width / 2.54
+
+#------------------------------------------------------------------------
+#
+# PaperStyle
+#
+#------------------------------------------------------------------------
+class PaperStyle(object):
+ """
+ Define the various options for a sheet of paper.
+ """
+ def __init__(self, size, orientation,
+ lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54):
+ """
+ Create a new paper style.
+
+ @param size: size of the new style
+ @type size: PaperSize
+ @param orientation: page orientation
+ @type orientation: PAPER_PORTRAIT or PAPER_LANDSCAPE
+
+ """
+ self.__orientation = orientation
+
+ if orientation == PAPER_PORTRAIT:
+ self.__size = PaperSize(size.get_name(),
+ size.get_height(),
+ size.get_width())
+ else:
+ self.__size = PaperSize(size.get_name(),
+ size.get_width(),
+ size.get_height())
+ self.__lmargin = lmargin
+ self.__rmargin = rmargin
+ self.__tmargin = tmargin
+ self.__bmargin = bmargin
+
+ def get_size(self):
+ """
+ Return the size of the paper.
+
+ @returns: object indicating the paper size
+ @rtype: PaperSize
+
+ """
+ return self.__size
+
+ def get_orientation(self):
+ """
+ Return the orientation of the page.
+
+ @returns: PAPER_PORTRIAT or PAPER_LANDSCAPE
+ @rtype: int
+
+ """
+ return self.__orientation
+
+ def get_usable_width(self):
+ """
+ Return the width of the page area in centimeters.
+
+ The value is the page width less the margins.
+
+ """
+ return self.__size.get_width() - (self.__rmargin + self.__lmargin)
+
+ def get_usable_height(self):
+ """
+ Return the height of the page area in centimeters.
+
+ The value is the page height less the margins.
+
+ """
+ return self.__size.get_height() - (self.__tmargin + self.__bmargin)
+
+ def get_right_margin(self):
+ """
+ Return the right margin.
+
+ @returns: Right margin in centimeters
+ @rtype: float
+
+ """
+ return self.__rmargin
+
+ def get_left_margin(self):
+ """
+ Return the left margin.
+
+ @returns: Left margin in centimeters
+ @rtype: float
+
+ """
+ return self.__lmargin
+
+ def get_top_margin(self):
+ """
+ Return the top margin.
+
+ @returns: Top margin in centimeters
+ @rtype: float
+
+ """
+ return self.__tmargin
+
+ def get_bottom_margin(self):
+ """
+ Return the bottom margin.
+
+ @returns: Bottom margin in centimeters
+ @rtype: float
+
+ """
+ return self.__bmargin
diff --git a/src/gen/plug/docgen/paragraphstyle.py b/src/gen/plug/docgen/paragraphstyle.py
new file mode 100644
index 000000000..6eca9de78
--- /dev/null
+++ b/src/gen/plug/docgen/paragraphstyle.py
@@ -0,0 +1,349 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+from fontstyle import FontStyle
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".paragraphstyle")
+
+#-------------------------------------------------------------------------
+#
+# Paragraph alignment
+#
+#-------------------------------------------------------------------------
+PARA_ALIGN_CENTER = 0
+PARA_ALIGN_LEFT = 1
+PARA_ALIGN_RIGHT = 2
+PARA_ALIGN_JUSTIFY = 3
+
+#------------------------------------------------------------------------
+#
+# ParagraphStyle
+#
+#------------------------------------------------------------------------
+class ParagraphStyle(object):
+ """
+ Defines the characteristics of a paragraph. The characteristics are:
+ font (a FontStyle instance), right margin, left margin, first indent,
+ top margin, bottom margin, alignment, level, top border, bottom border,
+ right border, left border, padding, and background color.
+
+ """
+ def __init__(self, source=None):
+ """
+ @param source: if not None, then the ParagraphStyle is created
+ using the values of the source instead of the default values.
+ """
+ if source:
+ self.font = FontStyle(source.font)
+ self.rmargin = source.rmargin
+ self.lmargin = source.lmargin
+ self.first_indent = source.first_indent
+ self.tmargin = source.tmargin
+ self.bmargin = source.bmargin
+ self.align = source.align
+ self.level = source.level
+ self.top_border = source.top_border
+ self.bottom_border = source.bottom_border
+ self.right_border = source.right_border
+ self.left_border = source.left_border
+ self.pad = source.pad
+ self.bgcolor = source.bgcolor
+ self.description = source.description
+ self.tabs = source.tabs
+ else:
+ self.font = FontStyle()
+ self.rmargin = 0
+ self.lmargin = 0
+ self.tmargin = 0
+ self.bmargin = 0
+ self.first_indent = 0
+ self.align = PARA_ALIGN_LEFT
+ self.level = 0
+ self.top_border = 0
+ self.bottom_border = 0
+ self.right_border = 0
+ self.left_border = 0
+ self.pad = 0
+ self.bgcolor = (255, 255, 255)
+ self.description = ""
+ self.tabs = []
+
+ def set_description(self, text):
+ """
+ Set the desciption of the paragraph
+ """
+ self.description = text
+
+ def get_description(self):
+ """
+ Return the desciption of the paragraph
+ """
+ return self.description
+
+ def set(self, rmargin=None, lmargin=None, first_indent=None,
+ tmargin=None, bmargin=None, align=None,
+ tborder=None, bborder=None, rborder=None, lborder=None,
+ pad=None, bgcolor=None, font=None):
+ """
+ Allows the values of the object to be set.
+
+ @param rmargin: right indent in centimeters
+ @param lmargin: left indent in centimeters
+ @param first_indent: first line indent in centimeters
+ @param tmargin: space above paragraph in centimeters
+ @param bmargin: space below paragraph in centimeters
+ @param align: alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
+ @param tborder: non zero indicates that a top border should be used
+ @param bborder: non zero indicates that a bottom border should be used
+ @param rborder: non zero indicates that a right border should be used
+ @param lborder: non zero indicates that a left border should be used
+ @param pad: padding in centimeters
+ @param bgcolor: background color of the paragraph as an RGB tuple.
+ @param font: FontStyle instance that defines the font
+ """
+ if font is not None:
+ self.font = FontStyle(font)
+ if pad is not None:
+ self.set_padding(pad)
+ if tborder is not None:
+ self.set_top_border(tborder)
+ if bborder is not None:
+ self.set_bottom_border(bborder)
+ if rborder is not None:
+ self.set_right_border(rborder)
+ if lborder is not None:
+ self.set_left_border(lborder)
+ if bgcolor is not None:
+ self.set_background_color(bgcolor)
+ if align is not None:
+ self.set_alignment(align)
+ if rmargin is not None:
+ self.set_right_margin(rmargin)
+ if lmargin is not None:
+ self.set_left_margin(lmargin)
+ if first_indent is not None:
+ self.set_first_indent(first_indent)
+ if tmargin is not None:
+ self.set_top_margin(tmargin)
+ if bmargin is not None:
+ self.set_bottom_margin(bmargin)
+
+ def set_header_level(self, level):
+ """
+ Set the header level for the paragraph. This is useful for
+ numbered paragraphs. A value of 1 indicates a header level
+ format of X, a value of two implies X.X, etc. A value of zero
+ means no header level.
+ """
+ self.level = level
+
+ def get_header_level(self):
+ "Return the header level of the paragraph"
+ return self.level
+
+ def set_font(self, font):
+ """
+ Set the font style of the paragraph.
+
+ @param font: FontStyle object containing the font definition to use.
+ """
+ self.font = FontStyle(font)
+
+ def get_font(self):
+ "Return the FontStyle of the paragraph"
+ return self.font
+
+ def set_padding(self, val):
+ """
+ Set the paragraph padding in centimeters
+
+ @param val: floating point value indicating the padding in centimeters
+ """
+ self.pad = val
+
+ def get_padding(self):
+ """Return a the padding of the paragraph"""
+ return self.pad
+
+ def set_top_border(self, val):
+ """
+ Set the presence or absence of top border.
+
+ @param val: True indicates a border should be used, False indicates
+ no border.
+ """
+ self.top_border = val
+
+ def get_top_border(self):
+ "Return 1 if a top border is specified"
+ return self.top_border
+
+ def set_bottom_border(self, val):
+ """
+ Set the presence or absence of bottom border.
+
+ @param val: True indicates a border should be used, False
+ indicates no border.
+ """
+ self.bottom_border = val
+
+ def get_bottom_border(self):
+ "Return 1 if a bottom border is specified"
+ return self.bottom_border
+
+ def set_left_border(self, val):
+ """
+ Set the presence or absence of left border.
+
+ @param val: True indicates a border should be used, False
+ indicates no border.
+ """
+ self.left_border = val
+
+ def get_left_border(self):
+ "Return 1 if a left border is specified"
+ return self.left_border
+
+ def set_right_border(self, val):
+ """
+ Set the presence or absence of rigth border.
+
+ @param val: True indicates a border should be used, False
+ indicates no border.
+ """
+ self.right_border = val
+
+ def get_right_border(self):
+ "Return 1 if a right border is specified"
+ return self.right_border
+
+ def get_background_color(self):
+ """
+ Return a tuple indicating the RGB components of the background
+ color
+ """
+ return self.bgcolor
+
+ def set_background_color(self, color):
+ """
+ Set the background color of the paragraph.
+
+ @param color: tuple representing the RGB components of a color
+ (0,0,0) to (255,255,255)
+ """
+ self.bgcolor = color
+
+ def set_alignment(self, align):
+ """
+ Set the paragraph alignment.
+
+ @param align: PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER,
+ or PARA_ALIGN_JUSTIFY
+ """
+ self.align = align
+
+ def get_alignment(self):
+ "Return the alignment of the paragraph"
+ return self.align
+
+ def get_alignment_text(self):
+ """
+ Return a text string representing the alginment, either 'left',
+ 'right', 'center', or 'justify'
+ """
+ if self.align == PARA_ALIGN_LEFT:
+ return "left"
+ elif self.align == PARA_ALIGN_CENTER:
+ return "center"
+ elif self.align == PARA_ALIGN_RIGHT:
+ return "right"
+ elif self.align == PARA_ALIGN_JUSTIFY:
+ return "justify"
+ return "unknown"
+
+ def set_left_margin(self, value):
+ "sets the left indent in centimeters"
+ self.lmargin = value
+
+ def set_right_margin(self, value):
+ "sets the right indent in centimeters"
+ self.rmargin = value
+
+ def set_first_indent(self, value):
+ "sets the first line indent in centimeters"
+ self.first_indent = value
+
+ def set_top_margin(self, value):
+ "sets the space above paragraph in centimeters"
+ self.tmargin = value
+
+ def set_bottom_margin(self, value):
+ "sets the space below paragraph in centimeters"
+ self.bmargin = value
+
+ def get_left_margin(self):
+ "returns the left indent in centimeters"
+ return self.lmargin
+
+ def get_right_margin(self):
+ "returns the right indent in centimeters"
+ return self.rmargin
+
+ def get_first_indent(self):
+ "returns the first line indent in centimeters"
+ return self.first_indent
+
+ def get_top_margin(self):
+ "returns the space above paragraph in centimeters"
+ return self.tmargin
+
+ def get_bottom_margin(self):
+ "returns the space below paragraph in centimeters"
+ return self.bmargin
+
+ def set_tabs(self, tab_stops):
+ assert isinstance(tab_stops, list)
+ self.tabs = tab_stops
+
+ def get_tabs(self):
+ return self.tabs
diff --git a/src/gen/plug/docgen/stylesheet.py b/src/gen/plug/docgen/stylesheet.py
new file mode 100644
index 000000000..1dd7a0486
--- /dev/null
+++ b/src/gen/plug/docgen/stylesheet.py
@@ -0,0 +1,432 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+import os
+from xml.sax.saxutils import escape
+
+def escxml(string):
+ """
+ Escapes XML special characters.
+ """
+ return escape(string, { '"' : '"' } )
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+import const
+from gen.plug.utils import gformat, gfloat
+from paragraphstyle import ParagraphStyle
+from fontstyle import FontStyle
+from tablestyle import TableStyle, TableCellStyle
+from graphicstyle import GraphicsStyle
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".stylesheet")
+
+#-------------------------------------------------------------------------
+#
+# SAX interface
+#
+#-------------------------------------------------------------------------
+try:
+ from xml.sax import make_parser, handler, SAXParseException
+except ImportError:
+ from _xmlplus.sax import make_parser, handler, SAXParseException
+
+#------------------------------------------------------------------------
+#
+# cnv2color
+#
+#------------------------------------------------------------------------
+def cnv2color(text):
+ """
+ converts a hex value in the form of #XXXXXX into a tuple of integers
+ representing the RGB values
+ """
+ return (int(text[1:3], 16), int(text[3:5], 16), int(text[5:7], 16))
+
+
+#------------------------------------------------------------------------
+#
+# StyleSheetList
+#
+#------------------------------------------------------------------------
+class StyleSheetList(object):
+ """
+ Interface into the user's defined style sheets. Each StyleSheetList
+ has a predefined default style specified by the report. Additional
+ styles are loaded from a specified XML file if it exists.
+ """
+
+ def __init__(self, filename, defstyle):
+ """
+ Create a new StyleSheetList from the specified default style and
+ any other styles that may be defined in the specified file.
+
+ file - XML file that contains style definitions
+ defstyle - default style
+ """
+ defstyle.set_name('default')
+ self.map = { "default" : defstyle }
+ self.file = os.path.join(const.HOME_DIR, filename)
+ self.parse()
+
+ def delete_style_sheet(self, name):
+ """
+ Remove a style from the list. Since each style must have a
+ unique name, the name is used to delete the stylesheet.
+
+ name - Name of the style to delete
+ """
+ del self.map[name]
+
+ def get_style_sheet_map(self):
+ """
+ Return the map of names to styles.
+ """
+ return self.map
+
+ def get_style_sheet(self, name):
+ """
+ Return the StyleSheet associated with the name
+
+ name - name associated with the desired StyleSheet.
+ """
+ return self.map[name]
+
+ def get_style_names(self):
+ "Return a list of all the style names in the StyleSheetList"
+ return self.map.keys()
+
+ def set_style_sheet(self, name, style):
+ """
+ Add or replaces a StyleSheet in the StyleSheetList. The
+ default style may not be replaced.
+
+ name - name assocated with the StyleSheet to add or replace.
+ style - definition of the StyleSheet
+ """
+ style.set_name(name)
+ if name != "default":
+ self.map[name] = style
+
+ def save(self):
+ """
+ Saves the current StyleSheet definitions to the associated file.
+ """
+ xml_file = open(self.file,"w")
+ xml_file.write("\n")
+ xml_file.write('\n')
+
+ for name, sheet in self.map.iteritems():
+ if name == "default":
+ continue
+ xml_file.write('\n' % escxml(name))
+ for p_name in sheet.get_paragraph_style_names():
+ para = sheet.get_paragraph_style(p_name)
+ xml_file.write('\n')
+ xml_file.write('\n')
+ xml_file.write('\n')
+ xml_file.close()
+
+ def parse(self):
+ """
+ Loads the StyleSheets from the associated file, if it exists.
+ """
+ try:
+ if os.path.isfile(self.file):
+ parser = make_parser()
+ parser.setContentHandler(SheetParser(self))
+ the_file = open(self.file)
+ parser.parse(the_file)
+ the_file.close()
+ except (IOError,OSError,SAXParseException):
+ pass
+
+#------------------------------------------------------------------------
+#
+# StyleSheet
+#
+#------------------------------------------------------------------------
+class StyleSheet(object):
+ """
+ A collection of named paragraph styles.
+ """
+
+ def __init__(self, obj=None):
+ """
+ Create a new empty StyleSheet.
+
+ @param obj: if not None, creates the StyleSheet from the values in
+ obj, instead of creating an empty StyleSheet
+ """
+ self.para_styles = {}
+ self.draw_styles = {}
+ self.table_styles = {}
+ self.cell_styles = {}
+ self.name = ""
+ if obj is not None:
+ for style_name, style in obj.para_styles.iteritems():
+ self.para_styles[style_name] = ParagraphStyle(style)
+ for style_name, style in obj.draw_styles.iteritems():
+ self.draw_styles[style_name] = GraphicsStyle(style)
+ for style_name, style in obj.table_styles.iteritems():
+ self.table_styles[style_name] = TableStyle(style)
+ for style_name, style in obj.cell_styles.iteritems():
+ self.cell_styles[style_name] = TableCellStyle(style)
+
+ def set_name(self, name):
+ """
+ Set the name of the StyleSheet
+
+ @param name: The name to be given to the StyleSheet
+ """
+ self.name = name
+
+ def get_name(self):
+ """
+ Return the name of the StyleSheet
+ """
+ return self.name
+
+ def clear(self):
+ "Remove all styles from the StyleSheet"
+ self.para_styles = {}
+ self.draw_styles = {}
+ self.table_styles = {}
+ self.cell_styles = {}
+
+ def is_empty(self):
+ "Checks if any styles are defined"
+ style_count = len(self.para_styles) + \
+ len(self.draw_styles) + \
+ len(self.table_styles) + \
+ len(self.cell_styles)
+ if style_count > 0:
+ return False
+ else:
+ return True
+
+ def add_paragraph_style(self, name, style):
+ """
+ Add a paragraph style to the style sheet.
+
+ @param name: The name of the ParagraphStyle
+ @param style: ParagraphStyle instance to be added.
+ """
+ self.para_styles[name] = ParagraphStyle(style)
+
+ def get_paragraph_style(self, name):
+ """
+ Return the ParagraphStyle associated with the name
+
+ @param name: name of the ParagraphStyle that is wanted
+ """
+ return ParagraphStyle(self.para_styles[name])
+
+ def get_paragraph_style_names(self):
+ "Return the the list of paragraph names in the StyleSheet"
+ return self.para_styles.keys()
+
+ def add_draw_style(self, name, style):
+ """
+ Add a draw style to the style sheet.
+
+ @param name: The name of the GraphicsStyle
+ @param style: GraphicsStyle instance to be added.
+ """
+ self.draw_styles[name] = GraphicsStyle(style)
+
+ def get_draw_style(self, name):
+ """
+ Return the GraphicsStyle associated with the name
+
+ @param name: name of the GraphicsStyle that is wanted
+ """
+ return GraphicsStyle(self.draw_styles[name])
+
+ def get_draw_style_names(self):
+ "Return the the list of draw style names in the StyleSheet"
+ return self.draw_styles.keys()
+
+ def add_table_style(self, name, style):
+ """
+ Add a table style to the style sheet.
+
+ @param name: The name of the TableStyle
+ @param style: TableStyle instance to be added.
+ """
+ self.table_styles[name] = TableStyle(style)
+
+ def get_table_style(self, name):
+ """
+ Return the TableStyle associated with the name
+
+ @param name: name of the TableStyle that is wanted
+ """
+ return TableStyle(self.table_styles[name])
+
+ def get_table_style_names(self):
+ "Return the the list of table style names in the StyleSheet"
+ return self.table_styles.keys()
+
+ def add_cell_style(self, name, style):
+ """
+ Add a cell style to the style sheet.
+
+ @param name: The name of the TableCellStyle
+ @param style: TableCellStyle instance to be added.
+ """
+ self.cell_styles[name] = TableCellStyle(style)
+
+ def get_cell_style(self, name):
+ """
+ Return the TableCellStyle associated with the name
+
+ @param name: name of the TableCellStyle that is wanted
+ """
+ return TableCellStyle(self.cell_styles[name])
+
+ def get_cell_style_names(self):
+ "Return the the list of cell style names in the StyleSheet"
+ return self.cell_styles.keys()
+
+#-------------------------------------------------------------------------
+#
+# SheetParser
+#
+#-------------------------------------------------------------------------
+class SheetParser(handler.ContentHandler):
+ """
+ SAX parsing class for the StyleSheetList XML file.
+ """
+
+ def __init__(self, sheetlist):
+ """
+ Create a SheetParser class that populates the passed StyleSheetList
+ class.
+
+ sheetlist - StyleSheetList instance to be loaded from the file.
+ """
+ handler.ContentHandler.__init__(self)
+ self.sheetlist = sheetlist
+ self.f = None
+ self.p = None
+ self.s = None
+ self.sname = None
+ self.pname = None
+
+ def startElement(self, tag, attrs):
+ """
+ Overridden class that handles the start of a XML element
+ """
+ if tag == "sheet":
+ self.s = StyleSheet(self.sheetlist.map["default"])
+ self.sname = attrs['name']
+ elif tag == "font":
+ self.f = FontStyle()
+ self.f.set_type_face(int(attrs['face']))
+ self.f.set_size(int(attrs['size']))
+ self.f.set_italic(int(attrs['italic']))
+ self.f.set_bold(int(attrs['bold']))
+ self.f.set_underline(int(attrs['underline']))
+ self.f.set_color(cnv2color(attrs['color']))
+ elif tag == "para":
+ if attrs.has_key('description'):
+ self.p.set_description(attrs['description'])
+ self.p.set_right_margin(gfloat(attrs['rmargin']))
+ self.p.set_right_margin(gfloat(attrs['rmargin']))
+ self.p.set_left_margin(gfloat(attrs['lmargin']))
+ self.p.set_first_indent(gfloat(attrs['first']))
+ try:
+ # This is needed to read older style files
+ # lacking tmargin and bmargin
+ self.p.set_top_margin(gfloat(attrs['tmargin']))
+ self.p.set_bottom_margin(gfloat(attrs['bmargin']))
+ except KeyError:
+ pass
+ self.p.set_padding(gfloat(attrs['pad']))
+ self.p.set_alignment(int(attrs['align']))
+ self.p.set_right_border(int(attrs['rborder']))
+ self.p.set_header_level(int(attrs['level']))
+ self.p.set_left_border(int(attrs['lborder']))
+ self.p.set_top_border(int(attrs['tborder']))
+ self.p.set_bottom_border(int(attrs['bborder']))
+ self.p.set_background_color(cnv2color(attrs['bgcolor']))
+ elif tag == "style":
+ self.p = ParagraphStyle()
+ self.pname = attrs['name']
+
+ def endElement(self, tag):
+ "Overridden class that handles the start of a XML element"
+ if tag == "style":
+ self.p.set_font(self.f)
+ self.s.add_paragraph_style(self.pname, self.p)
+ elif tag == "sheet":
+ self.sheetlist.set_style_sheet(self.sname, self.s)
diff --git a/src/gen/plug/docgen/tablestyle.py b/src/gen/plug/docgen/tablestyle.py
new file mode 100644
index 000000000..6e2b06ba6
--- /dev/null
+++ b/src/gen/plug/docgen/tablestyle.py
@@ -0,0 +1,222 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".tablestyle")
+
+#------------------------------------------------------------------------
+#
+# TableStyle
+#
+#------------------------------------------------------------------------
+class TableStyle(object):
+ """
+ Specifies the style or format of a table. The TableStyle contains the
+ characteristics of table width (in percentage of the full width), the
+ number of columns, and the width of each column as a percentage of the
+ width of the table.
+ """
+ def __init__(self, obj=None):
+ """
+ Create a new TableStyle object, with the values initialized to
+ empty, with allocating space for up to 100 columns.
+
+ @param obj: if not None, then the object created gets is attributes
+ from the passed object instead of being initialized to empty.
+ """
+ if obj:
+ self.width = obj.width
+ self.columns = obj.columns
+ self.colwid = obj.colwid[:]
+ else:
+ self.width = 0
+ self.columns = 0
+ self.colwid = [ 0 ] * 100
+
+ def set_width(self, width):
+ """
+ Set the width of the table in terms of percent of the available
+ width
+ """
+ self.width = width
+
+ def get_width(self):
+ """
+ Return the specified width as a percentage of the available space
+ """
+ return self.width
+
+ def set_columns(self, columns):
+ """
+ Set the number of columns.
+
+ @param columns: number of columns that should be used.
+ """
+ self.columns = columns
+
+ def get_columns(self):
+ """
+ Return the number of columns
+ """
+ return self.columns
+
+ def set_column_widths(self, clist):
+ """
+ Set the width of all the columns at once, taking the percentages
+ from the passed list.
+ """
+ self.columns = len(clist)
+ for i in range(self.columns):
+ self.colwid[i] = clist[i]
+
+ def set_column_width(self, index, width):
+ """
+ Set the width of a specified column to the specified width.
+
+ @param index: column being set (index starts at 0)
+ @param width: percentage of the table width assigned to the column
+ """
+ self.colwid[index] = width
+
+ def get_column_width(self, index):
+ """
+ Return the column width of the specified column as a percentage of
+ the entire table width.
+
+ @param index: column to return (index starts at 0)
+ """
+ return self.colwid[index]
+
+#------------------------------------------------------------------------
+#
+# TableCellStyle
+#
+#------------------------------------------------------------------------
+class TableCellStyle(object):
+ """
+ Defines the style of a particular table cell. Characteristics are:
+ right border, left border, top border, bottom border, and padding.
+ """
+ def __init__(self, obj=None):
+ """
+ Create a new TableCellStyle instance.
+
+ @param obj: if not None, specifies that the values should be
+ copied from the passed object instead of being initialized to empty.
+ """
+ if obj:
+ self.rborder = obj.rborder
+ self.lborder = obj.lborder
+ self.tborder = obj.tborder
+ self.bborder = obj.bborder
+ self.padding = obj.padding
+ self.longlist = obj.longlist
+ else:
+ self.rborder = 0
+ self.lborder = 0
+ self.tborder = 0
+ self.bborder = 0
+ self.padding = 0
+ self.longlist = 0
+
+ def set_padding(self, val):
+ "Return the cell padding in centimeters"
+ self.padding = val
+
+ def set_right_border(self, val):
+ """
+ Defines if a right border in used
+
+ @param val: if True, a right border is used, if False, it is not
+ """
+ self.rborder = val
+
+ def set_left_border(self, val):
+ """
+ Defines if a left border in used
+
+ @param val: if True, a left border is used, if False, it is not
+ """
+ self.lborder = val
+
+ def set_top_border(self, val):
+ """
+ Defines if a top border in used
+
+ @param val: if True, a top border is used, if False, it is not
+ """
+ self.tborder = val
+
+ def set_bottom_border(self, val):
+ """
+ Defines if a bottom border in used
+
+ @param val: if 1, a bottom border is used, if 0, it is not
+ """
+ self.bborder = val
+
+ def set_longlist(self, val):
+ self.longlist = val
+
+ def get_padding(self):
+ "Return the cell padding in centimeters"
+ return self.padding
+
+ def get_right_border(self):
+ "Return 1 if a right border is requested"
+ return self.rborder
+
+ def get_left_border(self):
+ "Return 1 if a left border is requested"
+ return self.lborder
+
+ def get_top_border(self):
+ "Return 1 if a top border is requested"
+ return self.tborder
+
+ def get_bottom_border(self):
+ "Return 1 if a bottom border is requested"
+ return self.bborder
+
+ def get_longlist(self):
+ return self.longlist
diff --git a/src/gen/plug/docgen/textdoc.py b/src/gen/plug/docgen/textdoc.py
new file mode 100644
index 000000000..a025506a6
--- /dev/null
+++ b/src/gen/plug/docgen/textdoc.py
@@ -0,0 +1,238 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2002 Gary Shao
+# Copyright (C) 2007 Brian G. Matherly
+# Copyright (C) 2009 Benny Malengier
+# Copyright (C) 2009 Gary Burton
+#
+# 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
+#
+
+# $Id: basedoc.py 12591 2009-05-29 22:25:44Z bmcage $
+
+
+
+#-------------------------------------------------------------------------
+#
+# standard python modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# GRAMPS modules
+#
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+#
+# set up logging
+#
+#-------------------------------------------------------------------------
+import logging
+log = logging.getLogger(".textdoc")
+
+#-------------------------------------------------------------------------
+#
+# IndexMark types
+#
+#-------------------------------------------------------------------------
+INDEX_TYPE_ALP = 0
+INDEX_TYPE_TOC = 1
+
+#------------------------------------------------------------------------
+#
+# IndexMark
+#
+#------------------------------------------------------------------------
+class IndexMark(object):
+ """
+ Defines a mark to be associated with text for indexing.
+ """
+ def __init__(self, key="", itype=INDEX_TYPE_ALP, level=1):
+ """
+ Initialize the object with default values, unless values are specified.
+ """
+ self.key = key
+ self.type = itype
+ self.level = level
+
+
+#------------------------------------------------------------------------
+#
+# TextDoc
+#
+#------------------------------------------------------------------------
+
+class TextDoc(object):
+ """
+ Abstract Interface for text document generators. Output formats for
+ text reports must implment this interface to be used by the report
+ system.
+ """
+ def page_break(self):
+ "Forces a page break, creating a new page"
+ raise NotImplementedError
+
+ def start_bold(self):
+ raise NotImplementedError
+
+ def end_bold(self):
+ raise NotImplementedError
+
+ def start_superscript(self):
+ raise NotImplementedError
+
+ def end_superscript(self):
+ raise NotImplementedError
+
+ def start_paragraph(self, style_name, leader=None):
+ """
+ Starts a new paragraph, using the specified style name.
+
+ @param style_name: name of the ParagraphStyle to use for the
+ paragraph.
+ @param leader: Leading text for a paragraph. Typically used
+ for numbering.
+ """
+ raise NotImplementedError
+
+ def end_paragraph(self):
+ "Ends the current parsgraph"
+ raise NotImplementedError
+
+ def start_table(self, name, style_name):
+ """
+ Starts a new table.
+
+ @param name: Unique name of the table.
+ @param style_name: TableStyle to use for the new table
+ """
+ raise NotImplementedError
+
+ def end_table(self):
+ "Ends the current table"
+ raise NotImplementedError
+
+ def start_row(self):
+ "Starts a new row on the current table"
+ raise NotImplementedError
+
+ def end_row(self):
+ "Ends the current row on the current table"
+ raise NotImplementedError
+
+ def start_cell(self, style_name, span=1):
+ """
+ Starts a new table cell, using the paragraph style specified.
+
+ @param style_name: TableCellStyle to use for the cell
+ @param span: number of columns to span
+ """
+ raise NotImplementedError
+
+ def end_cell(self):
+ "Ends the current table cell"
+ raise NotImplementedError
+
+ def write_text(self, text, mark=None):
+ """
+ Writes the text in the current paragraph. Should only be used after a
+ start_paragraph and before an end_paragraph.
+
+ @param text: text to write.
+ @param mark: IndexMark to use for indexing (if supported)
+ """
+ raise NotImplementedError
+
+ def write_markup(self, text, s_tags):
+ """
+ Writes the text in the current paragraph. Should only be used after a
+ start_paragraph and before an end_paragraph. Not all backends support
+ s_tags, then the same happens as with write_text. Backends supporting
+ write_markup will overwrite this method
+
+ @param text: text to write. The text is assumed to be _not_ escaped
+ @param s_tags: assumed to be list of styledtexttags to apply to the
+ text
+ """
+ self.write_text(text)
+
+ def write_note(self, text, format, style_name):
+ """
+ Writes the note's text and take care of paragraphs,
+ depending on the format.
+
+ @param text: text to write.
+ @param format: format to use for writing. True for flowed text,
+ 1 for preformatted text.
+ """
+ raise NotImplementedError
+
+ def write_styled_note(self, styledtext, format, style_name):
+ """
+ Convenience function to write a styledtext to the cairo doc.
+ styledtext : assumed a StyledText object to write
+ format : = 0 : Flowed, = 1 : Preformatted
+ style_name : name of the style to use for default presentation
+
+ overwrite this method if the backend supports styled notes
+ """
+ text = str(styledtext)
+ self.write_note(text, format, style_name)
+
+ def write_text_citation(self, text, mark=None):
+ """Method to write text with GRAMPS citation marks"""
+ if not text:
+ return
+ parts = text.split("")
+ markset = False
+ for piece in parts:
+ if not piece:
+ # a text 'text ...' splits as '', 'text..'
+ continue
+ piecesplit = piece.split("")
+ if len(piecesplit) == 2:
+ self.start_superscript()
+ self.write_text(piecesplit[0])
+ self.end_superscript()
+ if not piecesplit[1]:
+ #text ended with ' ... '
+ continue
+ if not markset:
+ self.write_text(piecesplit[1], mark)
+ markset = True
+ else:
+ self.write_text(piecesplit[1])
+ else:
+ if not markset:
+ self.write_text(piece, mark)
+ markset = True
+ else:
+ self.write_text(piece)
+
+ def add_media_object(self, name, align, w_cm, h_cm):
+ """
+ Add a photo of the specified width (in centimeters)
+
+ @param name: filename of the image to add
+ @param align: alignment of the image. Valid values are 'left',
+ 'right', 'center', and 'single'
+ @param w_cm: width in centimeters
+ @param h_cm: height in centimeters
+ """
+ raise NotImplementedError
diff --git a/src/gen/plug/utils.py b/src/gen/plug/utils.py
new file mode 100644
index 000000000..a1e0be57a
--- /dev/null
+++ b/src/gen/plug/utils.py
@@ -0,0 +1,52 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2009 B. Malengier
+#
+# 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
+#
+
+# $Id: __init__.py 10055 2008-02-18 20:07:09Z acraphae $
+
+"""
+General utility functions usefull for the generic plugin system
+"""
+
+def gfloat(val):
+ """Convert to floating number, taking care of possible locale differences.
+
+ Useful for reading float values from text entry fields
+ while under non-English locale.
+ """
+
+ try:
+ return float(val)
+ except:
+ try:
+ return float(val.replace('.', ', '))
+ except:
+ return float(val.replace(', ', '.'))
+ return 0.0
+
+def gformat(val):
+ """Performs ('%.3f' % val) formatting with the resulting string always
+ using dot ('.') as a decimal point.
+
+ Useful for writing float values into XML when under non-English locale.
+ """
+
+ decimal_point = locale.localeconv()['decimal_point']
+ return_val = "%.3f" % val
+ return return_val.replace(decimal_point, '.')
diff --git a/src/gen/utils/__init__.py b/src/gen/utils/__init__.py
index e76f655c1..d1d3c14a0 100644
--- a/src/gen/utils/__init__.py
+++ b/src/gen/utils/__init__.py
@@ -18,8 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+"""
+Generic utilities usefull for users of the gen package
+"""
+
from dbutils import *
from progressmon import ProgressMonitor
from longop import LongOpStatus
from callback import Callback
-
diff --git a/src/plugins/Records.py b/src/plugins/Records.py
index cfdc56ef8..7cad0df03 100644
--- a/src/plugins/Records.py
+++ b/src/plugins/Records.py
@@ -35,8 +35,7 @@ from TransUtils import sgettext as _
#
#------------------------------------------------------------------------
from gen.lib import ChildRefType, Date, EventType, Name
-from gen.plug.docgen import FontStyle, ParagraphStyle
-from gen.plug.docgen.basedoc import FONT_SANS_SERIF
+from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
from BasicUtils import name_displayer
from DataViews import register, Gramplet
from gen.plug.menu import (BooleanOption, EnumeratedListOption,
diff --git a/src/plugins/docgen/AsciiDoc.py b/src/plugins/docgen/AsciiDoc.py
index d3c49693a..3f702dcad 100644
--- a/src/plugins/docgen/AsciiDoc.py
+++ b/src/plugins/docgen/AsciiDoc.py
@@ -34,8 +34,8 @@ from gettext import gettext as _
# Gramps modules
#
#------------------------------------------------------------------------
-from gen.plug.docgen import BaseDoc, TextDoc
-from gen.plug.docgen.basedoc import (PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER)
+from gen.plug.docgen import BaseDoc, TextDoc,\
+ PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER
from gen.plug import PluginManager, DocGenPlugin
import Errors
import Utils
diff --git a/src/plugins/docgen/GtkPrint.py b/src/plugins/docgen/GtkPrint.py
index 6a43b4223..532c02b07 100644
--- a/src/plugins/docgen/GtkPrint.py
+++ b/src/plugins/docgen/GtkPrint.py
@@ -42,7 +42,7 @@ from math import radians
# Gramps modules
#
#------------------------------------------------------------------------
-from gen.plug.docgen.basedoc import PAPER_PORTRAIT
+from gen.plug.docgen import PAPER_PORTRAIT
import libcairodoc
from gen.plug import PluginManager, DocGenPlugin
import Errors
diff --git a/src/plugins/docgen/HtmlDoc.py b/src/plugins/docgen/HtmlDoc.py
index 7d64b4480..b7a7df044 100644
--- a/src/plugins/docgen/HtmlDoc.py
+++ b/src/plugins/docgen/HtmlDoc.py
@@ -42,8 +42,7 @@ import ImgManip
import tarfile
import const
import Errors
-from gen.plug.docgen import BaseDoc, TextDoc
-from gen.plug.docgen.basedoc import FONT_SANS_SERIF
+from gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF
from QuestionDialog import ErrorDialog, WarningDialog
import Utils
diff --git a/src/plugins/docgen/LaTeXDoc.py b/src/plugins/docgen/LaTeXDoc.py
index c9248d357..2f22511ae 100644
--- a/src/plugins/docgen/LaTeXDoc.py
+++ b/src/plugins/docgen/LaTeXDoc.py
@@ -41,8 +41,7 @@ from gettext import gettext as _
#------------------------------------------------------------------------
from gen.plug import PluginManager, DocGenPlugin
-from gen.plug.docgen import BaseDoc, TextDoc
-from gen.plug.docgen.basedoc import PAPER_LANDSCAPE, FONT_SANS_SERIF
+from gen.plug.docgen import BaseDoc, TextDoc, PAPER_LANDSCAPE, FONT_SANS_SERIF
from gen.plug.docbackend import LateXBackend, latexescape
import ImgManip
import Errors
diff --git a/src/plugins/docgen/ODFDoc.py b/src/plugins/docgen/ODFDoc.py
index ae52bf3b0..64e870e82 100644
--- a/src/plugins/docgen/ODFDoc.py
+++ b/src/plugins/docgen/ODFDoc.py
@@ -44,15 +44,15 @@ from xml.sax.saxutils import escape
# Gramps modules
#
#-------------------------------------------------------------------------
-from gen.plug.docgen import BaseDoc, TextDoc, DrawDoc
-from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, DASHED, PAPER_PORTRAIT,
+from gen.plug import PluginManager, DocGenPlugin
+from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc,
+ FONT_SANS_SERIF, DASHED, PAPER_PORTRAIT,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
INDEX_TYPE_ALP, PARA_ALIGN_RIGHT)
+from gen.plug.docgen.fontscale import string_width
import const
-from gen.plug import PluginManager, DocGenPlugin
from ReportBase import ReportUtils
import ImgManip
-import FontScale
import Utils
import Errors
@@ -988,7 +988,7 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
height = size*(len(text))
width = 0
for line in text:
- width = max(width, FontScale.string_width(font, line))
+ width = max(width, string_width(font, line))
wcm = ReportUtils.pt2cm(width)
hcm = ReportUtils.pt2cm(height)
@@ -1061,7 +1061,7 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
para_name = box_style.get_paragraph_style()
pstyle = style_sheet.get_paragraph_style(para_name)
font = pstyle.get_font()
- sw = ReportUtils.pt2cm(FontScale.string_width(font, text))*1.3
+ sw = ReportUtils.pt2cm(string_width(font, text))*1.3
self.cntnt.write('