dabo Commit
Revision 5145
Date: 2009-03-24 04:41:52 -0700 (Tue, 24 Mar 2009)
Author: Pedro.Gato
Trac: http://trac.dabodev.com/changeset/5145
Changed:
U trunk/dabo/lib/reportWriter.py
Log:
Added scaleMode=proportional to report images. Also changed the docstring to
reflect ScaleModes closer to dImage ScaleModes
Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py 2009-03-23 13:28:11 UTC (rev 5144)
+++ trunk/dabo/lib/reportWriter.py 2009-03-24 11:41:52 UTC (rev 5145)
@@ -592,8 +592,9 @@
self.AvailableProps["ScaleMode"] = toPropDict(str, "scale",
"""Specifies how to handle frame and image of
differing size.
- "scale" will change the image size to fit the
frame. "clip" will
- display the image in the frame as-is.""")
+ "scale" or "strech" will change the image size
to fit the frame.
+ "clip" will display the image in the frame
as-is.
+ "proportional" resizes the image to fit in the
frame without changing its proportions.""")
class BarGraph(Drawable):
"""Represents a bar graph"""
@@ -1108,6 +1109,7 @@
borderColor = obj.getProp("borderColor")
mask = obj.getProp("imageMask")
mode = obj.getProp("scaleMode")
+ preserveRatio = False
c.translate(x, y)
c.rotate(rotation)
@@ -1149,9 +1151,12 @@
# width/height, resulting in clipping.
width, height = None, None
+ elif mode == "proportional":
+ preserveRatio = True
+
if img:
try:
- c.drawImage(img, 0, 0, width, height,
mask)
+ c.drawImage(img, 0, 0, width, height,
mask, preserveAspectRatio=preserveRatio)
except StandardError:
c.drawCentredString(0, 0, "<< Image
expr error >>")
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]