[Checkins] SVN: z3c.rml/trunk/ Implemented ``clip`` attribute of ``path`` directive. See RML example 041.

Stephen Richter cvs-admin at zope.org
Wed Dec 19 06:48:12 UTC 2012


Log message for revision 128770:
  Implemented ``clip`` attribute of ``path`` directive. See RML example 041.
  

Changed:
  U   z3c.rml/trunk/CHANGES.txt
  U   z3c.rml/trunk/RML-DIFFERENCES.txt
  U   z3c.rml/trunk/src/z3c/rml/canvas.py
  A   z3c.rml/trunk/src/z3c/rml/tests/input/400x200.gif
  A   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-036-numbering-contd.rml
  A   z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-041-masking.rml

-=-
Modified: z3c.rml/trunk/CHANGES.txt
===================================================================
--- z3c.rml/trunk/CHANGES.txt	2012-12-19 05:50:08 UTC (rev 128769)
+++ z3c.rml/trunk/CHANGES.txt	2012-12-19 06:48:12 UTC (rev 128770)
@@ -7,8 +7,10 @@
 
 - Implemented ``saveState`` and ``restoreState`` directives. (LP #666194)
 
-- Implemented "storyPlace" directive. (LP #665941)
+- Implemented ``storyPlace`` directive. (LP #665941)
 
+- Implemented ``clip`` attribute of ``path`` directive. See RML example 041.
+
 - Don't show "doc" namespace in reference snippets.
 
 - Create a list of RML2PDF and z3c.rml differences.

Modified: z3c.rml/trunk/RML-DIFFERENCES.txt
===================================================================
--- z3c.rml/trunk/RML-DIFFERENCES.txt	2012-12-19 05:50:08 UTC (rev 128769)
+++ z3c.rml/trunk/RML-DIFFERENCES.txt	2012-12-19 06:48:12 UTC (rev 128770)
@@ -30,11 +30,11 @@
 
 - blockTable: -repeatRows, -alignment
 
-- docAssert (reportlab.platypus.flowables.DocAssert)
+- docAssert (reportlab.platypus.flowables.DocAssert) (Test 39)
 
 - docAssign (reportlab.platypus.flowables.DocAssign)
 
-- docElse
+- docElse (reportlab.platypus.flowables.DocIf)
 
 - docIf (reportlab.platypus.flowables.DocIf)
 
@@ -48,7 +48,7 @@
 
 - widget
 
-- para: -fontNAme, -fontSize, -leading, -leftIndent, -rightIndent,
+- para: -fontName, -fontSize, -leading, -leftIndent, -rightIndent,
   -firstLineIndent, -spaceBefore, -spaceAfter, -alignement, -bulletFontName,
   -bulletFontSize, -bulletIndent, -textColor, -backColor, -keepWithText,
   -wordWrap, -borderColor, -borderWidth, -borderPadding, -borderRadius,
@@ -62,8 +62,6 @@
 
 - evalString
 
-- storyPlace
-
 - -keepTogether
 
 - pto
@@ -76,7 +74,7 @@
 
 - includePdfPages
 
-- plugInGraphic
+- plugInGraphic (Test 037)
 
 - barCodeFlowable: tracking, routing, width -> widthSize, height -> heightSize,
   -strokeWidth, -fillColor
@@ -174,3 +172,7 @@
 - logConfig
 
 - -pdfInclude
+
+- codesnippet
+
+- rectangle, table row, table cell, etc.: href and/or destination (Test 038)

Modified: z3c.rml/trunk/src/z3c/rml/canvas.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/canvas.py	2012-12-19 05:50:08 UTC (rev 128769)
+++ z3c.rml/trunk/src/z3c/rml/canvas.py	2012-12-19 06:48:12 UTC (rev 128770)
@@ -506,6 +506,13 @@
         default=False,
         required=False)
 
+    clip = attr.Boolean(
+        title=u'Clip Path',
+        description=(u"A flag specifying whether the path should clip "
+                     u"overlapping elements."),
+        default=False,
+        required=False)
+
 class Path(CanvasRMLDirective):
     signature = IPath
     factories = {
@@ -543,7 +550,10 @@
         if kwargs.pop('close', False):
             self.path.close()
 
-        canvas.drawPath(self.path, **kwargs)
+        if kwargs.pop('clip', False):
+            canvas.clipPath(self.path, **kwargs)
+        else:
+            canvas.drawPath(self.path, **kwargs)
 
 
 class IFill(interfaces.IRMLDirectiveSignature):
@@ -604,12 +614,14 @@
     sx = attr.Float(
         title=u'X-Scaling-Factor',
         description=(u'The scaling factor applied on x-coordinates.'),
-        required=True)
+        default=1,
+        required=False)
 
     sy = attr.Float(
         title=u'Y-Scaling-Factor',
         description=(u'The scaling factor applied on y-coordinates.'),
-        required=True)
+        default=1,
+        required=False)
 
 class Scale(CanvasRMLDirective):
     signature = IScale

Added: z3c.rml/trunk/src/z3c/rml/tests/input/400x200.gif
===================================================================
(Binary files differ)


Property changes on: z3c.rml/trunk/src/z3c/rml/tests/input/400x200.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-036-numbering-contd.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-036-numbering-contd.rml	                        (rev 0)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-036-numbering-contd.rml	2012-12-19 06:48:12 UTC (rev 128770)
@@ -0,0 +1,95 @@
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="test_036_numbering_contd.pdf" invariant="1">
+
+<template showBoundary="1">
+
+        <pageTemplate id="Itemization">
+        <pageGraphics>
+		    <setFont name="Helvetica-Bold" size="18"/>
+		    <drawString x="35" y="783">RML Example 37: Numbering_contd</drawString>
+			<image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
+    		<image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />
+		</pageGraphics>
+           <frame id="second" x1="35" y1="45" width="525" height="590"/>
+        </pageTemplate>
+
+
+</template>
+
+<stylesheet>
+	<initialize>
+	<alias id="style.normal" value="style.Normal"/>
+	</initialize>
+	<paraStyle name="h1" fontName="Helvetica-BoldOblique" fontSize="32" leading="36"/>
+	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12"/>
+	<paraStyle name="normal_indent" parent="normal" leftIndent="36"/>
+	<paraStyle name="normal_indent_lv_2" parent="normal" leftIndent="72"/>
+	<paraStyle name="intro"  fontName="Helvetica" fontSize="12" leading="12" spaceAfter="12"/>
+</stylesheet>
+
+<story>
+
+<storyPlace x="35" y="660" width="525" height="73" origin="page">
+<para style="intro">RML (Report Markup Language) is ReportLab's own language for specifying the appearance of a printed page, which is converted into PDF by the utility rml2pdf.</para>
+<hr color="white" thickness="8pt"/>
+<para style="intro">These RML samples showcase techniques and features for generating various types of ouput and are distributed within our commercial package as test cases. Each should be self explanatory and stand alone.</para>
+<illustration height="3" width="525" align="center">
+<fill color= "(0,0.99,0.97,0.0)" />
+<rect x="0" y = "-12" width="525" height="3" round="1" fill="1" stroke = "Yes" />
+</illustration>
+</storyPlace>
+<para style="h1">Demo of sequencing tag for multi-level numbering</para>
+
+<para style="normal">This is to check we re-initialise the sequence at the start of each document.
+If the numbers start 5,6,7... we're in trouble.
+</para>
+
+<para style="normal_indent">
+   <b><seq id="level_1"/></b> <b><u>Heading</u></b>.  Lorem ipsum dolor sit amet....  This contains a tag to "get" the current 
+   value of the <b>level_1</b> counter, and increments it after display.  The tag looks like <b>&lt;seq id="level_1"&gt;</b>.
+</para>
+
+
+<para style="normal_indent">
+   <b><seq id="level_1"/>.</b> <b><u>Heading</u></b>.  Lorem ipsum dolor sit amet...
+</para>
+
+<para style="normal_indent">
+   <b><seq id="level_1"/>.</b> <b><u>Another heading</u></b>.  Duis bibendum  
+urna ac....  In the paragraphs below we use two <b>seq</b> tags; the level 2 one is as you would expect and increments, bt the level 1 tag has 
+<b>&lt;seq id="level_1" inc="no"&gt;</b>, meaning "do not increment".  You can also pass in an integer, to increment by 0, 1 or something else entirely; you could count 
+down if you wanted to.  
+</para>
+
+
+<para style="normal_indent_lv_2">
+   <b><seq id="level_1" inc="no"/>.<seq id="level_2"/></b> <b><u>Yet another  
+heading</u></b>.  Morbi laoreet magna sit amet...
+</para>
+<para style="normal_indent_lv_2">
+   <b><seq id="level_1" inc="no"/>.<seq id="level_2"/></b> <b><u>Yet another  
+heading</u></b>.  Morbi laoreet magna sit amet...
+</para>
+<para style="normal_indent_lv_2">
+   <b><seq id="level_1" inc="no"/>.<seq id="level_2" /></b> <b><u>Yet another  
+heading</u></b>.  Morbi laoreet magna sit amet...
+</para>
+
+
+<para style="normal_indent">
+   <b><seq id="level_1"/>.</b> <b><u>Back to outer level</u></b>.  Duis bibendum  
+urna ac...
+</para>
+
+<para style="normal_indent_lv_2">
+   <b><seq id="level_1" inc="no"/>.<seq id="level_2" inc="5"/></b> <b><u>Just for the hell of it,
+   jump ahead 5 at the inner level using inc="5"...</u></b>.  Morbi laoreet magna sit amet...
+</para>
+<para style="normal_indent_lv_2">
+   <b><seq id="level_1" inc="no"/>.<seq id="level_2"/></b> <b><u>Yet another  
+heading</u></b>.  Morbi laoreet magna sit amet...
+</para>
+
+</story>
+
+</document>

Added: z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-041-masking.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-041-masking.rml	                        (rev 0)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/rml-examples-041-masking.rml	2012-12-19 06:48:12 UTC (rev 128770)
@@ -0,0 +1,67 @@
+<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
+<document filename="test_041_masking.pdf" invariant="1">
+
+<template pageSize="a4" leftMargin="72" showBoundary="1">
+	<pageTemplate id="main" pageSize="a4 portrait">
+	<pageGraphics>
+	<setFont name="Helvetica-Bold" size="18"/>
+		    <drawString x="35" y="783">RML Example 42: Masking</drawString>
+			<image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
+    		<image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />
+		<saveState/>
+		<translate dy="500" dx="200"/>
+		<saveState/>
+		<stroke color="red" width="1"/>
+		<translate dy="133" dx="40"/>
+		<scale sy="-1"/>
+		<path x="0" y="89.93" close="yes" stroke="yes" clip="yes">
+			<moveto>128.755 15.979</moveto>
+			<curvesto>43.5303 37.2158 10.1621 71.8726 0 78.8896</curvesto>
+			0 164.063
+			<curvesto>40.6992 167.07 105.996 158.279 174.089 141.313</curvesto>
+			<curvesto>237.792 125.438 281.841 105.292 319.089 83.2666</curvesto>
+			319.089 3.646
+			<curvesto>274.999 -2.29736 203.875 -2.73926 128.755 15.9795</curvesto>
+		</path>
+		<scale sy="-1"/>
+		<translate dy="-183" dx="-40"/>
+		<image file="400x200.gif" x="0" y="0" width="400" height="200"/>
+		<restoreState/>
+		<restoreState/>
+	</pageGraphics>
+	<frame id="second" x1="35" y1="45" width="525" height="420"/>
+	</pageTemplate>
+</template>
+
+<stylesheet>
+	<initialize>
+	<alias id="style.normal" value="style.Normal"/>
+	</initialize>
+	<paraStyle name="h1" fontName="Helvetica-BoldOblique" fontSize="32" leading="36"/>
+	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12"/>
+	<paraStyle name="spaced" fontName="Helvetica" fontSize="10" leading="12" 
+		spaceBefore="12" spaceAfter="12"/>
+		<paraStyle name="intro"  fontName="Helvetica" fontSize="12" leading="12" spaceAfter="12"/>
+</stylesheet>
+
+<story>
+<storyPlace x="35" y="660" width="525" height="73" origin="page">
+<para style="intro">RML (Report Markup Language) is ReportLab's own language for specifying the appearance of a printed page, which is converted into PDF by the utility rml2pdf.</para>
+<hr color="white" thickness="8pt"/>
+<para style="intro">These RML samples showcase techniques and features for generating various types of ouput and are distributed within our commercial package as test cases. Each should be self explanatory and stand alone.</para>
+<illustration height="3" width="525" align="center">
+<fill color= "(0,0.99,0.97,0.0)" />
+<rect x="0" y = "-12" width="525" height="3" round="1" fill="1" stroke = "Yes" />
+</illustration>
+</storyPlace>
+
+	<para style="normal">Hello World.  This is a normal paragraph. Blah <font color="red">IPO</font> blah blah blah blah growth forecast blah
+blah blah forecast blah.Blah blah blah blah blah blah blah blah blah blah blah profit blah blah blah blah blah
+blah blah blah blah blah IPO.Blah blah blah blah blah blah blah reengineering blah growth blah blah blah
+proactive direction strategic blah blah blah forward-thinking blah.Blah blah doubletalk blah blah blah blah
+blah profit blah blah growth blah blah blah blah blah profit.Blah blah blah blah venture capital blah blah blah
+blah blah forward-thinking blah. 
+	</para>
+</story>
+
+</document>



More information about the checkins mailing list