* src/docgen/PSDrawDoc.py (rgb_color): Remove function, import it

from ReportUtils instead.
* src/ReportUtils.py (rgb_color): Add function.
* src/docgen/PdfDoc.py: Use rgb_color from ReportUtils.
* src/docgen/LPRDoc.py: Use rgb_color from ReportUtils.


svn: r4070
This commit is contained in:
Alex Roitman 2005-02-22 01:59:28 +00:00
parent 60e01abcdd
commit 8ee891bee7
5 changed files with 30 additions and 14 deletions

View File

@ -8,6 +8,12 @@
* src/docgen/PSDrawDoc.py (draw_text,write_at):
Attempt latin1 encoding.
* src/docgen/PSDrawDoc.py (rgb_color): Remove function, import it
from ReportUtils instead.
* src/ReportUtils.py (rgb_color): Add function.
* src/docgen/PdfDoc.py: Use rgb_color from ReportUtils.
* src/docgen/LPRDoc.py: Use rgb_color from ReportUtils.
2005-02-20 Alex Roitman <shura@alex.neuro.umn.edu>
* src/docgen/LPRDoc.py (draw_path,draw_bar): Set proper linewidth.
* doc/gramps-manual/C/usage.xml: Update.

View File

@ -62,6 +62,12 @@ def cm2pt(cm):
"""
return cm*182.88
def rgb_color(color):
r = float(color[0])/255.0
g = float(color[1])/255.0
b = float(color[2])/255.0
return (r,g,b)
def draw_pie_chart(doc, center_x, center_y, radius, data, start=0):
"""
Draws a pie chart in the specified document. The data passed is plotted as

View File

@ -62,6 +62,7 @@ else:
#------------------------------------------------------------------------
import BaseDoc
import PluginMgr
from ReportUtils import rgb_color
#------------------------------------------------------------------------
#
@ -991,8 +992,8 @@ class LPRDoc(BaseDoc.BaseDoc):
self.brand_new_page = 0
stype = self.draw_styles[style]
self.gpc.setlinewidth(stype.get_line_width())
fill_color = [ val/255.0 for val in stype.get_fill_color()]
color = [ val/255.0 for val in stype.get_color()]
fill_color = rgb_color(stype.get_fill_color())
color = rgb_color(stype.get_color())
point = path[0]
x = cm2u(point[0]) + self.left_margin
@ -1040,7 +1041,7 @@ class LPRDoc(BaseDoc.BaseDoc):
if box_style.get_shadow():
ss = cm2u(box_style.get_shadow_space())
color = [ val/255.0 for val in _SHADOW_COLOR ]
color = rgb_color(_SHADOW_COLOR)
path = (
(x+ss,y-bh), (x+ss,y-bh-ss), (x+bw+ss,y-bh-ss),
(x+bw+ss,y-ss), (x+bw,y-ss), (x+bw,y-bh), (x+ss,y-bh),
@ -1085,8 +1086,8 @@ class LPRDoc(BaseDoc.BaseDoc):
stype = self.draw_styles[style]
self.gpc.setlinewidth(stype.get_line_width())
fill_color = [ val/255.0 for val in stype.get_fill_color() ]
color = [ val/255.0 for val in stype.get_color() ]
fill_color = rgb_color(stype.get_fill_color())
color = rgb_color(stype.get_color())
x = self.left_margin + cm2u(x1)
y = self.top_margin - cm2u(y1)

View File

@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#-------------------------------------------------------------------------
#
# python modules
@ -35,7 +37,7 @@ import PluginMgr
import Errors
import BaseDoc
from Report import run_print_dialog
from ReportUtils import pt2cm
from ReportUtils import pt2cm, rgb_color
#-------------------------------------------------------------------------
#
@ -404,11 +406,5 @@ class PSDrawDoc(BaseDoc.BaseDoc):
self.f.write("(%s) show\n" % lines[i])
self.f.write('grestore\n')
def rgb_color(color):
r = float(color[0])/255.0
g = float(color[1])/255.0
b = float(color[2])/255.0
return (r,g,b)
PluginMgr.register_draw_doc(_("PostScript"),PSDrawDoc,1,1,".ps",
_("Print a copy"));

View File

@ -20,6 +20,13 @@
# $Id$
#------------------------------------------------------------------------
#
# Python modules
#
#------------------------------------------------------------------------
from gettext import gettext as _
#------------------------------------------------------------------------
#
# gramps modules
@ -30,7 +37,7 @@ import PluginMgr
import Errors
import ImgManip
import GrampsMime
from gettext import gettext as _
from ReportUtils import rgb_color
_H = 'Helvetica'
_HB = 'Helvetica-Bold'
@ -611,7 +618,7 @@ class PdfDoc(BaseDoc.BaseDoc):
#
#------------------------------------------------------------------------
def make_color(c):
return Color(float(c[0])/255.0, float(c[1])/255.0, float(c[2])/255.0)
return Color(rgb_color(c))
#------------------------------------------------------------------------
#