* src/docgen/PSDrawDoc.py: Use ReportUtils.pt2cm.

* src/docgen/OpenOfficeDoc.py: Use ReportUtils.pt2cm.
	* src/docgen/ODFDoc.py: Use ReportUtils.pt2cm.


svn: r6858
This commit is contained in:
Alex Roitman 2006-06-04 18:27:50 +00:00
parent 1b473c8178
commit 5848cf17b2
4 changed files with 15 additions and 18 deletions

View File

@ -1,4 +1,7 @@
2006-06-04 Alex Roitman <shura@gramps-project.org> 2006-06-04 Alex Roitman <shura@gramps-project.org>
* src/docgen/PSDrawDoc.py: Use ReportUtils.pt2cm.
* src/docgen/OpenOfficeDoc.py: Use ReportUtils.pt2cm.
* src/docgen/ODFDoc.py: Use ReportUtils.pt2cm.
* src/ReportBase/Makefile.am (pkgdata_PYTHON): Remove _BookReport.py * src/ReportBase/Makefile.am (pkgdata_PYTHON): Remove _BookReport.py
* src/plugins/Makefile.am (pkgdata_PYTHON): Move BookReport.py * src/plugins/Makefile.am (pkgdata_PYTHON): Move BookReport.py

View File

@ -42,7 +42,6 @@ import BaseDoc
import const import const
from PluginUtils import register_text_doc, register_draw_doc, register_book_doc from PluginUtils import register_text_doc, register_draw_doc, register_book_doc
from ReportBase import ReportUtils from ReportBase import ReportUtils
pt2cm = ReportUtils.pt2cm
import ImgManip import ImgManip
import FontScale import FontScale
import Mime import Mime
@ -1014,13 +1013,14 @@ class ODFDoc(BaseDoc.BaseDoc):
if box_style.get_width(): if box_style.get_width():
sw = box_style.get_width()*2.0 # *1.2 sw = box_style.get_width()*2.0 # *1.2
else: else:
sw = pt2cm(FontScale.string_width(font,text))*1.3 sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
self.cntnt.write('<draw:frame text:anchor-type="paragraph" ') self.cntnt.write('<draw:frame text:anchor-type="paragraph" ')
self.cntnt.write('draw:z-index="2" ') self.cntnt.write('draw:z-index="2" ')
self.cntnt.write('draw:style-name="%s" ' % style) self.cntnt.write('draw:style-name="%s" ' % style)
self.cntnt.write('svg:width="%.2fcm" ' % sw) self.cntnt.write('svg:width="%.2fcm" ' % sw)
self.cntnt.write('svg:height="%.2fcm" ' % (pt2cm(font.get_size()*1.4))) self.cntnt.write('svg:height="%.2fcm" ' %
(ReportUtils.pt2cm(font.get_size()*1.4)))
self.cntnt.write('svg:x="%.2fcm" ' % float(x)) self.cntnt.write('svg:x="%.2fcm" ' % float(x))
self.cntnt.write('svg:y="%.2fcm">' % float(y)) self.cntnt.write('svg:y="%.2fcm">' % float(y))

View File

@ -42,7 +42,6 @@ import BaseDoc
import const import const
from PluginUtils import register_text_doc, register_draw_doc, register_book_doc from PluginUtils import register_text_doc, register_draw_doc, register_book_doc
from ReportBase import ReportUtils from ReportBase import ReportUtils
pt2cm = ReportUtils.pt2cm
import ImgManip import ImgManip
import FontScale import FontScale
import Mime import Mime
@ -891,7 +890,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
if box_style.get_width(): if box_style.get_width():
sw = box_style.get_width() sw = box_style.get_width()
else: else:
sw = pt2cm(FontScale.string_width(font,text))*1.3 sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
self.cntnt.write('<draw:text-box draw:style-name="%s" ' % style) self.cntnt.write('<draw:text-box draw:style-name="%s" ' % style)

View File

@ -29,19 +29,14 @@ from math import pi, cos, sin
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #Gramps modules
# Gramps modules
#
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from PluginUtils import register_draw_doc #from PluginUtils import register_draw_doc from ReportBase import
from ReportBase import Report, ReportUtils #Report, ReportUtils import Errors import BaseDoc from Utils import
pt2cm, rgb_color = ReportUtils.pt2cm, ReportUtils.rgb_color #gformat
import Errors
import BaseDoc
from Utils import gformat
def lrgb(grp): def lrgb(grp):
grp = rgb_color(grp) grp = ReportUtils.rgb_color(grp)
return (gformat(grp[0]),gformat(grp[1]),gformat(grp[2])) return (gformat(grp[0]),gformat(grp[1]),gformat(grp[2]))
def coords(grp): def coords(grp):
@ -191,7 +186,7 @@ class PSDrawDoc(BaseDoc.BaseDoc):
p = self.style_list[para_name] p = self.style_list[para_name]
x1 = x1 + self.lmargin x1 = x1 + self.lmargin
y1 = y1 + self.tmargin + pt2cm(p.get_font().get_size()) y1 = y1 + self.tmargin + ReportUtils.pt2cm(p.get_font().get_size())
(text,fdef) = self.encode_text(p,text) (text,fdef) = self.encode_text(p,text)
@ -350,8 +345,8 @@ class PSDrawDoc(BaseDoc.BaseDoc):
y2 = y2 + self.tmargin y2 = y2 + self.tmargin
box_type = self.draw_styles[style] box_type = self.draw_styles[style]
fill_color = rgb_color(box_type.get_fill_color()) fill_color = ReportUtils.rgb_color(box_type.get_fill_color())
color = rgb_color(box_type.get_color()) color = ReportUtils.rgb_color(box_type.get_color())
self.f.write('gsave\n') self.f.write('gsave\n')
self.f.write("%s cm %s cm moveto\n" % coords(self.translate(x1,y1))) self.f.write("%s cm %s cm moveto\n" % coords(self.translate(x1,y1)))