* src/plugins/FanChart.py: remove print statement

* src/docgen/RTFDoc.py: change from TextDoc to BaseDoc
* src/docgen/PdfDoc.py: change from TextDoc to BaseDoc
* src/docgen/LaTeXDoc.py: change from TextDoc to BaseDoc
* src/docgen/KwordDoc.py: change from TextDoc to BaseDoc
* src/docgen/HtmlDoc.py: change from TextDoc to BaseDoc
* src/docgen/AbiWordDoc.py: change from TextDoc to BaseDoc
* src/docgen/AbiWord2Doc.py: change from TextDoc to BaseDoc


svn: r2036
This commit is contained in:
Don Allingham 2003-08-25 03:11:40 +00:00
parent 4ca9ab2667
commit 99161f8ca9
8 changed files with 61 additions and 62 deletions

View File

@ -28,7 +28,7 @@ Provides a TextDoc based interface to the AbiWord document format.
#-------------------------------------------------------------------------
import base64
import TextDoc
import BaseDoc
import Errors
import Plugins
import ImgManip
@ -41,14 +41,14 @@ from gettext import gettext as _
# Class Definitions
#
#-------------------------------------------------------------------------
class AbiWordDoc(TextDoc.TextDoc):
"""AbiWord document generator. Inherits from the TextDoc generic
class AbiWordDoc(BaseDoc.BaseDoc):
"""AbiWord document generator. Inherits from the BaseDoc generic
document interface class."""
def __init__(self,styles,type,template,orientation):
"""Initializes the AbiWordDoc class, calling the __init__ routine
of the parent TextDoc class"""
TextDoc.TextDoc.__init__(self,styles,type,template,orientation)
of the parent BaseDoc class"""
BaseDoc.BaseDoc.__init__(self,styles,type,template,orientation)
self.f = None
self.level = 0
self.new_page = 0
@ -96,7 +96,7 @@ class AbiWordDoc(TextDoc.TextDoc):
# page size section
self.f.write('<pagesize ')
self.f.write('pagetype="%s" ' % self.paper.get_name())
if self.orientation == TextDoc.PAPER_PORTRAIT:
if self.orientation == BaseDoc.PAPER_PORTRAIT:
self.f.write('orientation="portrait" ')
else:
self.f.write('orientation="landscape" ')
@ -118,11 +118,11 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write('<s type="P" name="%s" basedon="" followedby="" props="' % style_name)
self.f.write('margin-top:%.4fin; ' % (float(style.get_padding())/2.54))
self.f.write('margin-bottom:%.4fin; ' % (float(style.get_padding())/2.54))
if style.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
if style.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.f.write('text-align:right;')
elif style.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
elif style.get_alignment() == BaseDoc.PARA_ALIGN_LEFT:
self.f.write('text-align:left;')
elif style.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
elif style.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
self.f.write('text-align:center;')
else:
self.f.write('text-align:justify;')
@ -135,7 +135,7 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write(' text-indent:%.4fin;' % indent)
font = style.get_font()
self.f.write(' font-family:')
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('Arial; ')
else:
self.f.write('Times New Roman; ')

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Provides a TextDoc based interface to the AbiWord document format.
Provides a BaseDoc based interface to the AbiWord document format.
"""
#-------------------------------------------------------------------------
@ -29,7 +29,7 @@ Provides a TextDoc based interface to the AbiWord document format.
import os
import base64
import TextDoc
import BaseDoc
from latin_utf8 import latin_to_utf8
import string
import Plugins
@ -42,14 +42,14 @@ from gettext import gettext as _
# Class Definitions
#
#-------------------------------------------------------------------------
class AbiWordDoc(TextDoc.TextDoc):
"""AbiWord document generator. Inherits from the TextDoc generic
class AbiWordDoc(BaseDoc.BaseDoc):
"""AbiWord document generator. Inherits from the BaseDoc generic
document interface class."""
def __init__(self,styles,type,template,orientation):
"""Initializes the AbiWordDoc class, calling the __init__ routine
of the parent TextDoc class"""
TextDoc.TextDoc.__init__(self,styles,type,template,orientation)
of the parent BaseDoc class"""
BaseDoc.BaseDoc.__init__(self,styles,type,template,orientation)
self.f = None
self.level = 0
self.new_page = 0
@ -79,7 +79,7 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write('version="0.9.6.1" fileformat="1.0">\n')
self.f.write('<pagesize ')
self.f.write('pagetype="%s" ' % self.paper.get_name())
if self.orientation == TextDoc.PAPER_PORTRAIT:
if self.orientation == BaseDoc.PAPER_PORTRAIT:
self.f.write('orientation="portrait" ')
else:
self.f.write('orientation="landscape" ')
@ -158,11 +158,11 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write('<p props="')
self.f.write('margin-top:%.4fin; ' % (float(style.get_padding())/2.54))
self.f.write('margin-bottom:%.4fin; ' % (float(style.get_padding())/2.54))
if style.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
if style.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.f.write('text-align:right;')
elif style.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
elif style.get_alignment() == BaseDoc.PARA_ALIGN_LEFT:
self.f.write('text-align:left;')
elif style.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
elif style.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
self.f.write('text-align:center;')
else:
self.f.write('text-align:justify;')
@ -176,7 +176,7 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write('">')
font = style.get_font()
self.f.write('<c props="font-family:')
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('Arial;')
else:
self.f.write('Times New Roman;')
@ -203,7 +203,7 @@ class AbiWordDoc(TextDoc.TextDoc):
self.current_style = style
font = style.get_font()
self.cdata = '<c props="font-family:'
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.cdata = self.cdata + 'Arial;'
else:
self.cdata = self.cdata + 'Times New Roman;'
@ -245,7 +245,7 @@ class AbiWordDoc(TextDoc.TextDoc):
def start_bold(self):
font = self.current_style.get_font()
self.f.write('</c><c props="font-family:')
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('Arial;')
else:
self.f.write('Times New Roman;')
@ -263,7 +263,7 @@ class AbiWordDoc(TextDoc.TextDoc):
def end_bold(self):
font = self.current_style.get_font()
self.f.write('</c><c props="font-family:')
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('Arial;')
else:
self.f.write('Times New Roman;')

View File

@ -29,7 +29,7 @@ import ImgManip
import TarFile
import const
import Errors
import TextDoc
import BaseDoc
from gettext import gettext as _
@ -74,10 +74,10 @@ _bottom = [
# HtmlDoc
#
#------------------------------------------------------------------------
class HtmlDoc(TextDoc.TextDoc):
class HtmlDoc(BaseDoc.BaseDoc):
def __init__(self,styles,type,template,orientation,source=None):
TextDoc.TextDoc.__init__(self,styles,TextDoc.PaperStyle("",0,0),template,None)
BaseDoc.BaseDoc.__init__(self,styles,BaseDoc.PaperStyle("",0,0),template,None)
self.year = time.localtime(time.time())[0]
self.ext = '.html'
if source == None:
@ -116,7 +116,7 @@ class HtmlDoc(TextDoc.TextDoc):
self.ext = val
def set_owner(self,owner):
TextDoc.TextDoc.set_owner(self,owner)
BaseDoc.BaseDoc.set_owner(self,owner)
self.copyright = 'Copyright &copy; %d %s' % (self.year,self.owner)
def set_image_dir(self,dirname):
@ -295,7 +295,7 @@ class HtmlDoc(TextDoc.TextDoc):
italic = 'font-style:italic; '
if font.get_bold():
bold = 'font-weight:bold; '
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
family = '"Helvetica","Arial","sans-serif"'
else:
family = '"Times New Roman","Times","serif"'

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import TextDoc
import BaseDoc
from latin_utf8 import latin_to_utf8
import time
@ -40,7 +40,7 @@ def points(val):
#
#
#------------------------------------------------------------------------
class KwordDoc(TextDoc.TextDoc):
class KwordDoc(BaseDoc.BaseDoc):
def open(self,filename):
self.photo_list = []
@ -99,7 +99,7 @@ class KwordDoc(TextDoc.TextDoc):
self.f.write('width="%d" ' % points(self.width))
self.f.write('height="%d" ' % points(self.height))
if self.orientation == TextDoc.PAPER_PORTRAIT:
if self.orientation == BaseDoc.PAPER_PORTRAIT:
self.f.write('orientation="0" ')
else:
self.f.write('orientation="1" ')
@ -174,11 +174,11 @@ class KwordDoc(TextDoc.TextDoc):
pad = points(p.get_padding())/2
self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
if p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
if p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
self.f.write('<FLOW value="center"/>\n')
elif p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
elif p.get_alignment() == BaseDoc.PARA_ALIGN_JUSTIFY:
self.f.write('<FLOW value="justify"/>\n')
elif p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
elif p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.f.write('<FLOW value="right"/>\n')
else:
self.f.write('<FLOW value="left"/>\n')
@ -191,7 +191,7 @@ class KwordDoc(TextDoc.TextDoc):
font = p.get_font()
self.f.write('<FORMAT>\n')
if font.get_type_face==TextDoc.FONT_SANS_SERIF:
if font.get_type_face==BaseDoc.FONT_SANS_SERIF:
self.f.write('<FONT name="helvetica"/>\n')
else:
self.f.write('<FONT name="times"/>\n')
@ -269,7 +269,7 @@ class KwordDoc(TextDoc.TextDoc):
self.style_name = style_name
self.p = self.style_list[self.style_name]
self.font = self.p.get_font()
if self.font.get_type_face() == TextDoc.FONT_SERIF:
if self.font.get_type_face() == BaseDoc.FONT_SERIF:
self.font_face = "Arial"
else:
self.font_face = "Times New Roman"
@ -305,11 +305,11 @@ class KwordDoc(TextDoc.TextDoc):
pad = points(self.p.get_padding())/2
self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
if self.p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
if self.p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
self.f.write('<FLOW value="center"/>\n')
elif self.p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
elif self.p.get_alignment() == BaseDoc.PARA_ALIGN_JUSTIFY:
self.f.write('<FLOW value="justify"/>\n')
elif self.p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
elif self.p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.f.write('<FLOW value="right"/>\n')
else:
self.f.write('<FLOW value="left"/>\n')

View File

@ -35,7 +35,7 @@ import string
# gramps modules
#
#------------------------------------------------------------------------
import TextDoc
import BaseDoc
import Plugins
import ImgManip
import Errors
@ -65,8 +65,8 @@ class TexFont:
# LaTeXDon
#
#------------------------------------------------------------------------
class LaTeXDoc(TextDoc.TextDoc):
"""LaTeX document interface class. Derived from TextDoc"""
class LaTeXDoc(BaseDoc.BaseDoc):
"""LaTeX document interface class. Derived from BaseDoc"""
def open(self,filename):
"""Opens the specified file, making sure that it has the
@ -90,7 +90,7 @@ class LaTeXDoc(TextDoc.TextDoc):
options = "12pt"
if self.orientation == TextDoc.PAPER_LANDSCAPE:
if self.orientation == BaseDoc.PAPER_LANDSCAPE:
options = options + ",landscape"
# Paper selections are somewhat limited on a stock installation.
@ -176,7 +176,7 @@ class LaTeXDoc(TextDoc.TextDoc):
thisstyle.font_beg = thisstyle.font_beg + "\\hfill"
# Establish font face and shape
if font.get_type_face() == TextDoc.FONT_SANS_SERIF:
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
thisstyle.font_beg = thisstyle.font_beg + "\\sffamily"
thisstyle.font_end = "\\rmfamily" + thisstyle.font_end
if font.get_bold():

View File

@ -23,7 +23,7 @@
# gramps modules
#
#------------------------------------------------------------------------
import TextDoc
import BaseDoc
import Plugins
import Errors
import ImgManip
@ -64,7 +64,7 @@ class GrampsDocTemplate(BaseDocTemplate):
#
#
#------------------------------------------------------------------------
class PdfDoc(TextDoc.TextDoc):
class PdfDoc(BaseDoc.BaseDoc):
def open(self,filename):
if filename[-4:] != ".pdf":
@ -99,7 +99,7 @@ class PdfDoc(TextDoc.TextDoc):
pdf_style.fontSize = font.get_size()
pdf_style.bulletFontSize = font.get_size()
if font.get_type_face() == TextDoc.FONT_SERIF:
if font.get_type_face() == BaseDoc.FONT_SERIF:
if font.get_bold():
if font.get_italic():
pdf_style.fontName = "Times-BoldItalic"
@ -133,11 +133,11 @@ class PdfDoc(TextDoc.TextDoc):
pdf_style.bulletIndent = first
align = style.get_alignment()
if align == TextDoc.PARA_ALIGN_RIGHT:
if align == BaseDoc.PARA_ALIGN_RIGHT:
pdf_style.alignment = TA_RIGHT
elif align == TextDoc.PARA_ALIGN_LEFT:
elif align == BaseDoc.PARA_ALIGN_LEFT:
pdf_style.alignment = TA_LEFT
elif align == TextDoc.PARA_ALIGN_CENTER:
elif align == BaseDoc.PARA_ALIGN_CENTER:
pdf_style.alignment = TA_CENTER
else:
pdf_style.alignment = TA_JUSTIFY
@ -239,7 +239,7 @@ class PdfDoc(TextDoc.TextDoc):
p = self.my_para
f = p.get_font()
if f.get_type_face() == TextDoc.FONT_SANS_SERIF:
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if f.get_bold():
fn = 'Helvetica-Bold'
else:
@ -265,9 +265,9 @@ class PdfDoc(TextDoc.TextDoc):
self.tblstyle.append(('LINEABOVE', loc, loc, 1, black))
if self.my_table_style.get_bottom_border():
self.tblstyle.append(('LINEBELOW', loc, loc, 1, black))
if p.get_alignment() == TextDoc.PARA_ALIGN_LEFT:
if p.get_alignment() == BaseDoc.PARA_ALIGN_LEFT:
self.tblstyle.append(('ALIGN', loc, loc, 'LEFT'))
elif p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
elif p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.tblstyle.append(('ALIGN', loc, loc, 'RIGHT'))
else:
self.tblstyle.append(('ALIGN', loc, loc, 'CENTER'))

View File

@ -20,10 +20,10 @@
#------------------------------------------------------------------------
#
# Load the base TextDoc class
# Load the base BaseDoc class
#
#------------------------------------------------------------------------
import TextDoc
import BaseDoc
import Plugins
import ImgManip
import Errors
@ -48,7 +48,7 @@ def twips(cm):
# use style sheets. Instead it writes raw formatting.
#
#------------------------------------------------------------------------
class RTFDoc(TextDoc.TextDoc):
class RTFDoc(BaseDoc.BaseDoc):
#--------------------------------------------------------------------
#
@ -140,7 +140,7 @@ class RTFDoc(TextDoc.TextDoc):
size = f.get_size()*2
bgindex = self.color_map[p.get_background_color()]
fgindex = self.color_map[f.get_color()]
if f.get_type_face() == TextDoc.FONT_SERIF:
if f.get_type_face() == BaseDoc.FONT_SERIF:
self.font_type = '\\f0\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
else:
self.font_type = '\\f1\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
@ -155,14 +155,14 @@ class RTFDoc(TextDoc.TextDoc):
if not self.in_table:
self.f.write('\\pard')
if p.get_alignment() == TextDoc.PARA_ALIGN_RIGHT:
if p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
self.f.write('\\qr')
elif p.get_alignment() == TextDoc.PARA_ALIGN_CENTER:
elif p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
self.f.write('\\qc')
self.f.write('\\ri%d' % twips(p.get_right_margin()))
self.f.write('\\li%d' % twips(p.get_left_margin()))
self.f.write('\\fi%d' % twips(p.get_first_indent()))
if p.get_alignment() == TextDoc.PARA_ALIGN_JUSTIFY:
if p.get_alignment() == BaseDoc.PARA_ALIGN_JUSTIFY:
self.f.write('\\qj')
if p.get_padding():
self.f.write('\\sa%d' % twips(p.get_padding()/2.0))

View File

@ -211,7 +211,6 @@ class FanChart:
def circle_1(self,center,y,size):
(xc,yc) = self.doc.draw_wedge("c1", center, y, size, 180, 360)
print center, y, xc, yc
self.doc.rotate_text("c1n", self.get_info(self.map[0]), xc, yc ,0)
def circle_2(self,center,y,size):