pychecker fixes

svn: r1750
This commit is contained in:
Don Allingham
2003-06-16 04:57:25 +00:00
parent e6e150b63f
commit cf54cbc309
26 changed files with 106 additions and 73 deletions

View File

@@ -26,14 +26,14 @@ Provides a TextDoc based interface to the AbiWord document format.
# Imported Modules
#
#-------------------------------------------------------------------------
import os
import base64
import TextDoc
from latin_utf8 import latin_to_utf8
import string
import Errors
import Plugins
import ImgManip
from latin_utf8 import latin_to_utf8
from intl import gettext as _
#-------------------------------------------------------------------------
@@ -194,7 +194,6 @@ class AbiWordDoc(TextDoc.TextDoc):
self.icount += 1
def start_superscript(self):
fsize = self.my_para.get_font().get_size()
self.text = self.text + '<c props="text-position:superscript">'
def end_superscript(self):

View File

@@ -34,6 +34,7 @@ from latin_utf8 import latin_to_utf8
import string
import Plugins
import ImgManip
import Errors
from intl import gettext as _
#-------------------------------------------------------------------------
@@ -140,7 +141,6 @@ class AbiWordDoc(TextDoc.TextDoc):
self.f.write('height:%.3fin"/>' % act_height)
def start_superscript(self):
fsize = self.my_para.get_font().get_size()
self.text = self.text + '<c props="text-position:superscript">'
def end_superscript(self):

View File

@@ -28,7 +28,7 @@ import Plugins
import ImgManip
import TarFile
import const
import Errors
import TextDoc
from intl import gettext as _

View File

@@ -22,8 +22,7 @@ import TextDoc
from latin_utf8 import latin_to_utf8
import time
import StringIO
import string
import cStringIO
import gzip
import Errors
@@ -51,8 +50,8 @@ class KwordDoc(TextDoc.TextDoc):
else:
self.filename = filename
self.f = StringIO.StringIO()
self.m = StringIO.StringIO()
self.f = cStringIO.StringIO()
self.m = cStringIO.StringIO()
self.m.write('<?xml version="1.0" encoding="UTF-8"?>')
self.m.write('<!DOCTYPE document-info ><document-info>\n')

View File

@@ -38,6 +38,8 @@ import string
import TextDoc
import Plugins
import ImgManip
import Errors
from intl import gettext as _
#------------------------------------------------------------------------
@@ -206,15 +208,12 @@ class LaTeXDoc(TextDoc.TextDoc):
thisstyle.font_end = thisstyle.font_end + " "
left = style.get_left_margin()
right = style.get_right_margin()
first = style.get_first_indent() + left
thisstyle.leftIndent = left
thisstyle.firstLineIndent = first
self.latexstyle[style_name] = thisstyle
def close(self):
"""Clean up and close the document"""

View File

@@ -18,19 +18,40 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import string
from math import pi, cos, sin
import cStringIO
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
import Plugins
from intl import gettext as _
import Errors
import TextDoc
import DrawDoc
from intl import gettext as _
#-------------------------------------------------------------------------
#
# pt2cm - points to cm conversion
#
#-------------------------------------------------------------------------
def pt2cm(val):
return (float(val)/72.0)*2.54
#-------------------------------------------------------------------------
#
# PSDrawDoc
#
#-------------------------------------------------------------------------
class PSDrawDoc(DrawDoc.DrawDoc):
def __init__(self,styles,type,orientation):
@@ -129,7 +150,6 @@ class PSDrawDoc(DrawDoc.DrawDoc):
stype = self.draw_styles[style]
pname = stype.get_paragraph_style()
p = self.style_list[pname]
font = p.get_font()
self.f.write('gsave\n')
self.f.write('%.4f %.4f %.4f setrgbcolor\n' % rgb_color(stype.get_color()))

View File

@@ -231,11 +231,11 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
self.f.setFillColor(make_color(font.get_color()))
val = len(text)
y = ((-font.get_size() * val)/2.0) + font.get_size()
y = ((-size * val)/2.0) + size
for line in text:
self.f.drawCentredString(0,y,line.encode('iso-8859-1'))
y += font.get_size()
y += size
self.f.restoreState()
@@ -276,17 +276,14 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
self.f.restoreState()
def left_print(self,text,font,x,y):
size = font.get_size()
self.f.saveState()
self.f.setStrokeColor(make_color(font.get_color()))
self.pdf_set_font(font)
self.f.drawString(start_x,start_y,text.encode('iso-8859-1'))
self.f.drawString(x,y,text.encode('iso-8859-1'))
self.f.restoreState()
def make_color(c):
return Color(float(c[0])/255.0, float(c[1])/255.0, float(c[2])/255.0)

View File

@@ -26,6 +26,7 @@
import TextDoc
import Plugins
import ImgManip
import Errors
from intl import gettext as _

View File

@@ -99,13 +99,11 @@ class SvgDrawDoc(DrawDoc.DrawDoc):
font = p.get_font()
size = font.get_size()
height = size*(len(text))
width = 0
for line in text:
width = max(width,FontScale.string_width(font,line))
rangle = -((pi/180.0) * angle)
# rangle = -((pi/180.0) * angle)
centerx,centery = units((x+self.lmargin,y+self.tmargin))
yh = 0
@@ -116,15 +114,13 @@ class SvgDrawDoc(DrawDoc.DrawDoc):
ypos = (centery)
xd = 0
yd = yh
# xd = yh * sin(-rangle)
# yd = yh * cos(-rangle)
print centerx, centery, xpos, ypos, angle, line
# xd = yh * sin(-rangle)
# yd = yh * cos(-rangle)
self.f.write('<text ')
self.f.write('x="%4.2f" y="%4.2f" ' % (xpos+xd,ypos+yd))
# self.f.write('transform="rotate(%d) ' % angle)
# self.f.write(' translate(%.8f,%.8f)" ' % (-xpos,-ypos))
# self.f.write('transform="rotate(%d) ' % angle)
# self.f.write(' translate(%.8f,%.8f)" ' % (-xpos,-ypos))
self.f.write('style="fill:#%02x%02x%02x; '% font.get_color())
if font.get_bold():
self.f.write('font-weight:"bold";')