* src/docgen/PSDrawDoc.py: Change from Text/DrawDoc to BaseDoc

* src/docgen/SvgDrawDoc.py: Change from Text/DrawDoc to BaseDoc


svn: r2076
This commit is contained in:
Don Allingham 2003-09-02 02:56:42 +00:00
parent c08b854d79
commit 421c8abb17
2 changed files with 14 additions and 16 deletions

View File

@ -33,8 +33,7 @@ from math import pi, cos, sin
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Plugins import Plugins
import Errors import Errors
import TextDoc import BaseDoc
import DrawDoc
from Report import run_print_dialog from Report import run_print_dialog
from gettext import gettext as _ from gettext import gettext as _
@ -53,10 +52,10 @@ def pt2cm(val):
# PSDrawDoc # PSDrawDoc
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class PSDrawDoc(DrawDoc.DrawDoc): class PSDrawDoc(BaseDoc.BaseDoc):
def __init__(self,styles,type,orientation): def __init__(self,styles,type,orientation):
DrawDoc.DrawDoc.__init__(self,styles,type,orientation) BaseDoc.BaseDoc.__init__(self,styles,type,orientation)
self.f = None self.f = None
self.filename = None self.filename = None
self.level = 0 self.level = 0
@ -64,7 +63,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
def fontdef(self,para): def fontdef(self,para):
font = para.get_font() font = para.get_font()
if font.get_type_face() == TextDoc.FONT_SERIF: if font.get_type_face() == BaseDoc.FONT_SERIF:
if font.get_bold(): if font.get_bold():
if font.get_italic(): if font.get_italic():
font_name = "/Times-BoldItalic" font_name = "/Times-BoldItalic"
@ -110,7 +109,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('%%LanguageLevel: 2\n') self.f.write('%%LanguageLevel: 2\n')
self.f.write('%%Pages: (atend)\n') self.f.write('%%Pages: (atend)\n')
self.f.write('%%PageOrder: Ascend\n') self.f.write('%%PageOrder: Ascend\n')
if self.orientation != TextDoc.PAPER_PORTRAIT: if self.orientation != BaseDoc.PAPER_PORTRAIT:
self.f.write('%%Orientation: Landscape\n') self.f.write('%%Orientation: Landscape\n')
else: else:
self.f.write('%%Orientation: Portrait\n') self.f.write('%%Orientation: Portrait\n')
@ -140,7 +139,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.page = self.page + 1 self.page = self.page + 1
self.f.write("%%Page:") self.f.write("%%Page:")
self.f.write("%d %d\n" % (self.page,self.page)) self.f.write("%d %d\n" % (self.page,self.page))
if self.orientation != TextDoc.PAPER_PORTRAIT: if self.orientation != BaseDoc.PAPER_PORTRAIT:
self.f.write('90 rotate %5.2f cm %5.2f cm translate\n' % (0,-1*self.height)) self.f.write('90 rotate %5.2f cm %5.2f cm translate\n' % (0,-1*self.height))
def end_page(self): def end_page(self):
@ -261,7 +260,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('gsave\n') self.f.write('gsave\n')
self.f.write('newpath\n') self.f.write('newpath\n')
self.f.write('%.4f setlinewidth\n' % stype.get_line_width()) self.f.write('%.4f setlinewidth\n' % stype.get_line_width())
if stype.get_line_style() == DrawDoc.SOLID: if stype.get_line_style() == BaseDoc.SOLID:
self.f.write('[] 0 setdash\n') self.f.write('[] 0 setdash\n')
else: else:
self.f.write('[2 4] 0 setdash\n') self.f.write('[2 4] 0 setdash\n')
@ -292,7 +291,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1)) self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1))
self.f.write('%f cm %f cm lineto\n' % self.translate(x2,y2)) self.f.write('%f cm %f cm lineto\n' % self.translate(x2,y2))
self.f.write('%.4f setlinewidth\n' % stype.get_line_width()) self.f.write('%.4f setlinewidth\n' % stype.get_line_width())
if stype.get_line_style() == DrawDoc.SOLID: if stype.get_line_style() == BaseDoc.SOLID:
self.f.write('[] 0 setdash\n') self.f.write('[] 0 setdash\n')
else: else:
self.f.write('[2 4] 0 setdash\n') self.f.write('[2 4] 0 setdash\n')

View File

@ -33,8 +33,7 @@ from math import pi, cos, sin, fabs
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Plugins import Plugins
from gettext import gettext as _ from gettext import gettext as _
import TextDoc import BaseDoc
import DrawDoc
import Errors import Errors
import FontScale import FontScale
@ -43,10 +42,10 @@ import FontScale
# SvgDrawDoc # SvgDrawDoc
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class SvgDrawDoc(DrawDoc.DrawDoc): class SvgDrawDoc(BaseDoc.BaseDoc):
def __init__(self,styles,type,orientation): def __init__(self,styles,type,orientation):
DrawDoc.DrawDoc.__init__(self,styles,type,orientation) BaseDoc.BaseDoc.__init__(self,styles,type,orientation)
self.f = None self.f = None
self.filename = None self.filename = None
self.level = 0 self.level = 0
@ -127,7 +126,7 @@ class SvgDrawDoc(DrawDoc.DrawDoc):
if font.get_italic(): if font.get_italic():
self.f.write('font-style:"italic";') self.f.write('font-style:"italic";')
self.f.write('font-size:%d; ' % size) self.f.write('font-size:%d; ' % size)
if font.get_type_face() == TextDoc.FONT_SANS_SERIF: if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('font-family:sans-serif;') self.f.write('font-family:sans-serif;')
else: else:
self.f.write('font-family:serif;') self.f.write('font-family:serif;')
@ -223,7 +222,7 @@ class SvgDrawDoc(DrawDoc.DrawDoc):
if font.get_italic(): if font.get_italic():
self.f.write(' font-style:"italic";') self.f.write(' font-style:"italic";')
self.f.write(' font-size:%d;' % font_size) self.f.write(' font-size:%d;' % font_size)
if font.get_type_face() == TextDoc.FONT_SANS_SERIF: if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write(' font-family:sans-serif;') self.f.write(' font-family:sans-serif;')
else: else:
self.f.write(' font-family:serif;') self.f.write(' font-family:serif;')
@ -251,7 +250,7 @@ class SvgDrawDoc(DrawDoc.DrawDoc):
if font.get_italic(): if font.get_italic():
self.f.write('font-style:"italic";') self.f.write('font-style:"italic";')
self.f.write('font-size:%d; ' % font_size) self.f.write('font-size:%d; ' % font_size)
if font.get_type_face() == TextDoc.FONT_SANS_SERIF: if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.f.write('font-family:sans-serif;') self.f.write('font-family:sans-serif;')
else: else:
self.f.write('font-family:serif;') self.f.write('font-family:serif;')