[Checkins] SVN: z3c.rml/trunk/ - Renamed ``bookmark`` to ``bookmarkPage``.

Stephen Richter cvs-admin at zope.org
Thu Dec 20 06:23:50 UTC 2012


Log message for revision 128801:
  - Renamed ``bookmark`` to ``bookmarkPage``.
  
  - Created a new Canvas directive called ``bookmark``
  
  

Changed:
  U   z3c.rml/trunk/CHANGES.txt
  U   z3c.rml/trunk/RML-DIFFERENCES.txt
  U   z3c.rml/trunk/src/z3c/rml/canvas.py
  U   z3c.rml/trunk/src/z3c/rml/flowable.py
  U   z3c.rml/trunk/src/z3c/rml/reference.pt
  U   z3c.rml/trunk/src/z3c/rml/tests/input/tag-bookmark.rml

-=-
Modified: z3c.rml/trunk/CHANGES.txt
===================================================================
--- z3c.rml/trunk/CHANGES.txt	2012-12-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/CHANGES.txt	2012-12-20 06:23:50 UTC (rev 128801)
@@ -44,6 +44,10 @@
 
 - Added ``encName`` attribute to ``registerCidFont`` directive.
 
+- Renamed ``bookmark`` to ``bookmarkPage``.
+
+- Created a new Canvas directive called ``bookmark``.
+
 - 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-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/RML-DIFFERENCES.txt	2012-12-20 06:23:50 UTC (rev 128801)
@@ -93,26 +93,14 @@
 
 - frame: -*Padding, -showBoundary
 
-- getName
-
-- color: value -> RGB
-
-- outlineAdd: -key
-
 - cropMarks
 
-- bookmark: -fitType, -left, -top, -right, -zoom, x, y
-
-- bookmarkPage
-
 - join
 
 - length
 
 - param: -value
 
-- registerCidFont: +encName
-
 - setFontSize (plain canvas op)
 
 - log

Modified: z3c.rml/trunk/src/z3c/rml/canvas.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/canvas.py	2012-12-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/src/z3c/rml/canvas.py	2012-12-20 06:23:50 UTC (rev 128801)
@@ -773,6 +773,48 @@
             canvas.setDash(kw['dash'])
 
 
+class IBookmark(interfaces.IRMLDirectiveSignature):
+    """
+    This creates a bookmark to the current page which can be referred to with
+    the given key elsewhere.
+    """
+
+    name = attr.Text(
+        title=u'Name',
+        description=u'The name of the bookmark.',
+        required=True)
+
+    fit = attr.Choice(
+        title=u'Fit',
+        description=u'The Fit Type.',
+        choices=('XYZ', 'Fit', 'FitH', 'FitV', 'FitR'),
+        required=False)
+
+    zoom = attr.Float(
+        title=u'Zoom',
+        description=u'The zoom level when clicking on the bookmark.',
+        required=False)
+
+    x = attr.Measurement(
+        title=u'X-Position',
+        description=u'The x-position.',
+        required=False)
+
+    y = attr.Measurement(
+        title=u'Y-Position',
+        description=u'The y-position.',
+        required=False)
+
+class Bookmark(CanvasRMLDirective):
+    signature = IBookmark
+
+    def process(self):
+        args = dict(self.getAttributeValues())
+        canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
+        args['left'], args['top'] = canvas.absolutePosition(args['x'], args['y'])
+        canvas.bookmarkPage(**args)
+
+
 class IDrawing(interfaces.IRMLDirectiveSignature):
     """A container directive for all directives that draw directly on the
     cnavas."""
@@ -820,6 +862,8 @@
         occurence.ZeroOrMore('pieChart', chart.IPieChart),
         occurence.ZeroOrMore('pieChart3D', chart.IPieChart3D),
         occurence.ZeroOrMore('spiderChart', chart.ISpiderChart),
+        # Misc
+        occurence.ZeroOrMore('bookmark', IBookmark),
         )
 
 class Drawing(directive.RMLDirective):
@@ -868,7 +912,9 @@
         'linePlot3D': chart.LinePlot3D,
         'pieChart': chart.PieChart,
         'pieChart3D': chart.PieChart3D,
-        'spiderChart': chart.SpiderChart
+        'spiderChart': chart.SpiderChart,
+        # Misc
+        'bookmark': Bookmark,
         }
 
 

Modified: z3c.rml/trunk/src/z3c/rml/flowable.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/flowable.py	2012-12-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/src/z3c/rml/flowable.py	2012-12-20 06:23:50 UTC (rev 128801)
@@ -984,7 +984,7 @@
         self.parent.flow.append(frame)
 
 
-class IBookmark(interfaces.IRMLDirectiveSignature):
+class IBookmarkPage(interfaces.IRMLDirectiveSignature):
     """
     This creates a bookmark to the current page which can be referred to with
     the given key elsewhere.
@@ -1000,25 +1000,25 @@
         description=u'The name of the bookmark.',
         required=True)
 
-    fitType = attr.Choice(
-        title=u'Fit Type',
+    fit = attr.Choice(
+        title=u'Fit',
         description=u'The Fit Type.',
-        choices=('Fit', 'FitH', 'FitV', 'FitR'),
+        choices=('XYZ', 'Fit', 'FitH', 'FitV', 'FitR'),
         required=False)
 
-    left = attr.Measurement(
-        title=u'Left',
-        description=u'The left position.',
+    top = attr.Measurement(
+        title=u'Top',
+        description=u'The top position.',
         required=False)
 
-    right = attr.Measurement(
-        title=u'Right',
-        description=u'The right position.',
+    bottom = attr.Measurement(
+        title=u'Bottom',
+        description=u'The bottom position.',
         required=False)
 
-    top = attr.Measurement(
-        title=u'Top',
-        description=u'The top position.',
+    left = attr.Measurement(
+        title=u'Left',
+        description=u'The left position.',
         required=False)
 
     right = attr.Measurement(
@@ -1031,8 +1031,8 @@
         description=u'The zoom level when clicking on the bookmark.',
         required=False)
 
-class Bookmark(Flowable):
-    signature = IBookmark
+class BookmarkPage(Flowable):
+    signature = IBookmarkPage
     klass = platypus.BookmarkPage
     attrMapping = {'name': 'key', 'fitType': 'fit'}
 
@@ -1277,7 +1277,7 @@
         occurence.ZeroOrMore('pto', IPTO),
         occurence.ZeroOrMore('indent', IIndent),
         occurence.ZeroOrMore('fixedSize', IFixedSize),
-        occurence.ZeroOrMore('bookmark', IBookmark),
+        occurence.ZeroOrMore('bookmarkPage', IBookmarkPage),
         occurence.ZeroOrMore('link', ILink),
         occurence.ZeroOrMore('hr', IHorizontalRow),
         occurence.ZeroOrMore('showIndex', IShowIndex),
@@ -1320,7 +1320,7 @@
         'pto': PTO,
         'indent': Indent,
         'fixedSize': FixedSize,
-        'bookmark': Bookmark,
+        'bookmarkPage': BookmarkPage,
         'link': Link,
         'hr': HorizontalRow,
         'showIndex': ShowIndex,

Modified: z3c.rml/trunk/src/z3c/rml/reference.pt
===================================================================
--- z3c.rml/trunk/src/z3c/rml/reference.pt	2012-12-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/src/z3c/rml/reference.pt	2012-12-20 06:23:50 UTC (rev 128801)
@@ -181,7 +181,7 @@
       <outlineAdd level="1" tal:content="directive/name">
         Element Name
       </outlineAdd>
-      <bookmark tal:attributes="name directive/id"/>
+      <bookmarkPage tal:attributes="name directive/id"/>
       <para style="deprecation"
             tal:condition="directive/deprecated">
         <b>Deprecated:</b>

Modified: z3c.rml/trunk/src/z3c/rml/tests/input/tag-bookmark.rml
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/input/tag-bookmark.rml	2012-12-20 05:47:50 UTC (rev 128800)
+++ z3c.rml/trunk/src/z3c/rml/tests/input/tag-bookmark.rml	2012-12-20 06:23:50 UTC (rev 128801)
@@ -17,14 +17,14 @@
       <font face="Courier">&lt;link&gt;</font>
       Tag Demo
     </title>
-    <bookmark name="TITLE" doc:example="" />
+    <bookmarkPage name="TITLE" doc:example="" />
     <link destination="PAGE_1"
           boxStrokeColor="red" boxStrokeWidth="1" boxStrokeDashArray="1 2"
           doc:example="">
       <para>Go to page 1 now!</para>
     </link>
     <nextPage/>
-    <bookmark
+    <bookmarkPage
         name="PAGE_1" fitType="fitv" zoom="2"
         left="2cm" right="10cm" top="20cm"
         doc:example=""



More information about the checkins mailing list