[Checkins] SVN: z3c.rml/trunk/src/z3c/rml/ Rename module attrng to
attr.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 27 23:11:04 EDT 2007
Log message for revision 73806:
Rename module attrng to attr.
Changed:
A z3c.rml/trunk/src/z3c/rml/attr.py
D z3c.rml/trunk/src/z3c/rml/attrng.py
U z3c.rml/trunk/src/z3c/rml/canvas.py
U z3c.rml/trunk/src/z3c/rml/chart.py
U z3c.rml/trunk/src/z3c/rml/document.py
U z3c.rml/trunk/src/z3c/rml/flowable.py
U z3c.rml/trunk/src/z3c/rml/form.py
U z3c.rml/trunk/src/z3c/rml/interfaces.py
U z3c.rml/trunk/src/z3c/rml/page.py
U z3c.rml/trunk/src/z3c/rml/special.py
U z3c.rml/trunk/src/z3c/rml/stylesheet.py
U z3c.rml/trunk/src/z3c/rml/template.py
U z3c.rml/trunk/src/z3c/rml/tests/test_rml.py
-=-
Copied: z3c.rml/trunk/src/z3c/rml/attr.py (from rev 73805, z3c.rml/trunk/src/z3c/rml/attrng.py)
Deleted: z3c.rml/trunk/src/z3c/rml/attrng.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/attrng.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/attrng.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -1,383 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""RML Attribute Implementation
-
-$Id$
-"""
-__docformat__ = "reStructuredText"
-import cStringIO
-import os
-import re
-import reportlab.graphics.widgets.markers
-import reportlab.lib.colors
-import reportlab.lib.pagesizes
-import reportlab.lib.styles
-import reportlab.lib.units
-import reportlab.lib.utils
-import urllib
-import zope.schema
-from lxml import etree
-from xml.sax import saxutils
-
-MISSING = object()
-
-def getManager(context, interface=None):
- if interface is None:
- # Avoid circular imports
- from z3c.rml import interfaces
- interface = interfaces.IManager
- # Walk up the path until the manager is found
- while (not interface.providedBy(context) and context is not None):
- context = context.parent
- # If no manager was found, raise an error
- if context is None:
- raise ValueError('The manager could not be found.')
- return context
-
-
-class RMLAttribute(zope.schema.Field):
- """An attribute of the RML directive."""
-
- missing_value = MISSING
- default = MISSING
-
- def fromUnicode(self, ustr):
- """See zope.schema.interfaces.IField"""
- if self.context is None:
- raise ValueError('Attribute not bound to a context.')
- return super(RMLAttribute, self).fromUnicode(unicode(ustr))
-
- def get(self):
- """See zope.schema.interfaces.IField"""
- value = self.context.element.get(self.__name__, self.missing_value)
- if value is self.missing_value:
- if self.default is not None:
- return self.default
- return self.missing_value
- return self.fromUnicode(value)
-
-
-class BaseChoice(RMLAttribute):
- choices = {}
-
- def fromUnicode(self, value):
- value = value.lower()
- if value in self.choices:
- return self.choices[value]
- raise ValueError(
- '%r not a valid value for attribute "%s"' % (value, self.__name__))
-
-
-class Combination(RMLAttribute):
-
- def __init__(self, value_types=(), *args, **kw):
- super(Combination, self).__init__(*args, **kw)
- self.value_types = value_types
-
- def fromUnicode(self, value):
- for value_type in self.value_types:
- bound = value_type.bind(self)
- try:
- return bound.fromUnicode(value)
- except ValueError:
- pass
- raise ValueError(value)
-
-
-class String(RMLAttribute, zope.schema.Bytes):
- """A simple Bytes string."""
-
-
-class Text(RMLAttribute, zope.schema.Text):
- """A simple unicode string."""
-
-
-class Integer(RMLAttribute, zope.schema.Int):
- # By making min and max simple attributes, we avoid some validation
- # problems.
- min = None
- max = None
-
-
-class Float(RMLAttribute, zope.schema.Float):
- # By making min and max simple attributes, we avoid some validation
- # problems.
- min = None
- max = None
-
-
-class StringOrInt(RMLAttribute):
-
- def fromUnicode(self, value):
- try:
- return int(value)
- except ValueError:
- return str(value)
-
-
-class Sequence(RMLAttribute, zope.schema._field.AbstractCollection):
-
- splitre = re.compile('[ \t\n,;]*')
-
- def __init__(self, splitre=None, *args, **kw):
- super(Sequence, self).__init__(*args, **kw)
- if splitre is not None:
- self.splitre = splitre
-
- def fromUnicode(self, ustr):
- if ustr.startswith('(') and ustr.endswith(')'):
- ustr = ustr[1:-1]
- ustr = ustr.strip()
- raw_values = self.splitre.split(ustr)
- result = [self.value_type.bind(self.context).fromUnicode(raw.strip())
- for raw in raw_values]
- if ((self.min_length is not None and len(result) < self.min_length) and
- (self.max_length is not None and len(result) > self.max_length)):
- raise ValueError(
- 'Length of sequence must be at least %s and at most %i' % (
- self.min_length, self.max_length))
- return result
-
-
-class Choice(BaseChoice):
-
- def __init__(self, choices=None, *args, **kw):
- super(Choice, self).__init__(*args, **kw)
- if isinstance(choices, (tuple, list)):
- choices = dict([(val.lower(), val) for val in choices])
- self.choices = choices
-
-
-class Boolean(BaseChoice):
- choices = {'true': True, 'false': False,
- 'yes': True, 'no': False,
- '1': True, '0': False,
- }
-
-
-class BooleanWithDefault(Boolean):
- choices = Boolean.choices.copy()
- choices.update({'default': None})
-
-
-class Measurement(RMLAttribute):
-
- def __init__(self, allowPercentage=False, allowStar=False, *args, **kw):
- super(Measurement, self).__init__(*args, **kw)
- self.allowPercentage = allowPercentage
- self.allowStar = allowStar
-
- units = [
- (re.compile('^(-?[0-9\.]+)\s*in$'), reportlab.lib.units.inch),
- (re.compile('^(-?[0-9\.]+)\s*cm$'), reportlab.lib.units.cm),
- (re.compile('^(-?[0-9\.]+)\s*mm$'), reportlab.lib.units.mm),
- (re.compile('^(-?[0-9\.]+)\s*$'), 1)
- ]
-
- allowPercentage = False
- allowStar = False
-
- def fromUnicode(self, value):
- if value == 'None':
- return None
- if value == '*' and self.allowStar:
- return value
- if value.endswith('%') and self.allowPercentage:
- return value
- for unit in self.units:
- res = unit[0].search(value, 0)
- if res:
- return unit[1]*float(res.group(1))
- raise ValueError('The value %r is not a valid measurement.' %value)
-
-
-class File(Text):
-
- open = staticmethod(urllib.urlopen)
- packageExtract = re.compile('^\[([0-9A-z_.]*)\]/(.*)$')
-
- doNotOpen = False
-
- def __init__(self, doNotOpen=False, *args, **kw):
- super(File, self).__init__(*args, **kw)
- self.doNotOpen = doNotOpen
-
- def fromUnicode(self, value):
- # Check whether the value is of the form:
- # [<module.path>]/rel/path/image.gif"
- if value.startswith('['):
- result = self.packageExtract.match(value)
- if result is None:
- raise ValueError(
- 'The package-path-pair you specified was incorrect')
- modulepath, path = result.groups()
- module = __import__(modulepath, {}, {}, (modulepath))
- value = os.path.join(os.path.dirname(module.__file__), path)
- if self.doNotOpen:
- return value
- # Open/Download the file
- fileObj = self.open(value)
- sio = cStringIO.StringIO(fileObj.read())
- fileObj.close()
- sio.seek(0)
- return sio
-
-
-class Image(File):
-
- def __init__(self, onlyOpen=False, *args, **kw):
- super(Image, self).__init__(*args, **kw)
- self.onlyOpen = onlyOpen
-
- def fromUnicode(self, value):
- fileObj = super(Image, self).fromUnicode(value)
- if self.onlyOpen:
- return fileObj
- return reportlab.lib.utils.ImageReader(fileObj)
-
-
-class Color(RMLAttribute):
-
- def __init__(self, acceptNone=False, *args, **kw):
- super(Color, self).__init__(*args, **kw)
- self.acceptNone = acceptNone
-
- def fromUnicode(self, value):
- if self.acceptNone and value == 'None':
- return None
- manager = getManager(self.context)
- if value in manager.colors:
- return manager.colors[value]
- return reportlab.lib.colors.toColor(value)
-
-
-class Style(String):
-
- default = reportlab.lib.styles.getSampleStyleSheet().byName['Normal']
-
- def fromUnicode(self, value):
- manager = getManager(self.context)
- for styles in (manager.styles,
- reportlab.lib.styles.getSampleStyleSheet().byName):
- if value in styles:
- return styles[value]
- elif 'style.' + value in styles:
- return styles['style.' + value]
- elif value.startswith('style.') and value[6:] in styles:
- return styles[value[6:]]
- raise ValueError('Style %r could not be found.' %value)
-
-
-class Symbol(Text):
-
- def fromUnicode(self, value):
- return reportlab.graphics.widgets.markers.makeMarker(value)
-
-
-class PageSize(RMLAttribute):
-
- sizePair = Sequence(value_type=Measurement())
- words = Sequence(value_type=String())
-
- def fromUnicode(self, value):
- # First try to get a pair
- try:
- return self.sizePair.fromUnicode(value)
- except ValueError:
- pass
- # Now we try to lookup a name. The following type of combinations must
- # work: "Letter" "LETTER" "A4 landscape" "letter portrait"
- words = self.words.fromUnicode(value)
- words = [word.lower() for word in words]
- # First look for the orientation
- orienter = None
- for orientation in ('landscape', 'portrait'):
- if orientation in words:
- orienter = getattr(reportlab.lib.pagesizes, orientation)
- words.remove(orientation)
- # We must have exactely one value left that matches a paper size
- pagesize = getattr(reportlab.lib.pagesizes, words[0].upper())
- # Now do the final touches
- if orienter:
- pagesize = orienter(pagesize)
- return pagesize
-
-
-class TextNode(RMLAttribute):
- """Text nodes are not really attributes, but behave mostly like it."""
-
- def get(self):
- if self.context.element.text is None:
- return u''
- return unicode(self.context.element.text).strip()
-
-
-class FirstLevelTextNode(TextNode):
- """Text ndoes are not really attributes, but behave mostly like it."""
-
- def get(self):
- text = self.context.element.text or u''
- for child in self.context.element.getchildren():
- text += child.tail or u''
- return text.strip()
-
-
-class TextNodeSequence(Sequence):
-
- def get(self):
- return self.fromUnicode(self.context.element.text)
-
-
-class TextNodeGrid(TextNodeSequence):
-
- def __init__(self, columns=None, *args, **kw):
- super(TextNodeGrid, self).__init__(*args, **kw)
- self.columns = columns
-
- def fromUnicode(self, ustr):
- result = super(TextNodeGrid, self).fromUnicode(ustr)
- if len(result) % self.columns != 0:
- raise ValueError(
- 'Number of elements must be divisible by %i.' %self.columns)
- return [result[i*self.columns:(i+1)*self.columns]
- for i in range(len(result)/self.columns)]
-
-
-class RawXMLContent(RMLAttribute):
-
- def __init__(self, *args, **kw):
- super(RawXMLContent, self).__init__(*args, **kw)
- # Do it in here, since we hace a recursive problem otherwise
- from z3c.rml import special
- self.handleElements = {'getName': special.GetName}
-
- def get(self):
- # Replace what we can replace
- for subElement in self.context.element.iterdescendants():
- if subElement.tag in self.handleElements:
- substitute = self.handleElements[subElement.tag](
- subElement, self.context)
- substitute.process()
- # Now create the text
- text = saxutils.escape(self.context.element.text or u'')
- for child in self.context.element.getchildren():
- text += etree.tounicode(child)
- return text
-
-
-class XMLContent(RawXMLContent):
-
- def get(self):
- result = super(XMLContent, self).get()
- return result.strip().replace('\t', ' ')
Modified: z3c.rml/trunk/src/z3c/rml/canvas.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/canvas.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/canvas.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -18,31 +18,31 @@
__docformat__ = "reStructuredText"
import zope.interface
import reportlab.pdfgen.canvas
-from z3c.rml import attrng, directive, interfaces, occurence, stylesheet
+from z3c.rml import attr, directive, interfaces, occurence, stylesheet
from z3c.rml import chart, flowable, form, page
class IShape(interfaces.IRMLDirectiveSignature):
"""A shape to be drawn on the canvas."""
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'shape.'),
required=True)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'shape.'),
required=True)
- fill = attrng.Boolean(
+ fill = attr.Boolean(
title=u'Fill',
description=u'A flag to specify whether the shape should be filled.',
required=False)
- stroke = attrng.Boolean(
+ stroke = attr.Boolean(
title=u'Stroke',
description=(u"A flag to specify whether the shape's outline should "
u"be drawn."),
@@ -55,7 +55,7 @@
def process(self):
kwargs = dict(self.getAttributeValues(attrMapping=self.attrMapping))
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
getattr(canvas, self.callable)(**kwargs)
@@ -63,19 +63,19 @@
"""Draws a simple string (left aligned) onto the canvas at the specified
location."""
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'string.'),
required=True)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'string.'),
required=True)
- text = attrng.TextNode(
+ text = attr.TextNode(
title=u'Text',
description=(u'The string/text that is put onto the canvas.'),
required=True)
@@ -106,7 +106,7 @@
"""Draws a simple string (aligned to the pivot character) onto the canvas
at the specified location."""
- pivotChar = attrng.Text(
+ pivotChar = attr.Text(
title=u'Text',
description=(u'The string/text that is put onto the canvas.'),
min_length=1,
@@ -122,12 +122,12 @@
class IEllipse(IShape):
"""Draws an ellipse on the canvas."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the ellipse.',
required=True)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the ellipse.',
required=True)
@@ -139,7 +139,7 @@
def process(self):
kwargs = dict(self.getAttributeValues(attrMapping=self.attrMapping))
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
# Convert width and height to end locations
kwargs['x2'] = kwargs['x1'] + kwargs['width']
del kwargs['width']
@@ -151,7 +151,7 @@
class ICircle(IShape):
"""Draws a circle on the canvas."""
- radius = attrng.Measurement(
+ radius = attr.Measurement(
title=u'Radius',
description=u'The radius of the circle.',
required=True)
@@ -165,17 +165,17 @@
class IRectangle(IShape):
"""Draws an ellipse on the canvas."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the rectangle.',
required=True)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the rectangle.',
required=True)
- round = attrng.Measurement(
+ round = attr.Measurement(
title=u'Corner Radius',
description=u'The radius of the rounded corners.',
required=False)
@@ -194,18 +194,18 @@
class IGrid(interfaces.IRMLDirectiveSignature):
"""A shape to be drawn on the canvas."""
- xs = attrng.Sequence(
+ xs = attr.Sequence(
title=u'X-Coordinates',
description=(u'A sequence x-coordinates that represent the vertical '
u'line positions.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
required=True)
- ys = attrng.Sequence(
+ ys = attr.Sequence(
title=u'Y-Coordinates',
description=(u'A sequence y-coordinates that represent the horizontal '
u'line positions.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
required=True)
@@ -218,10 +218,10 @@
class ILines(interfaces.IRMLDirectiveSignature):
"""A path of connected lines drawn on the canvas."""
- linelist = attrng.TextNodeGrid(
+ linelist = attr.TextNodeGrid(
title=u'Line List',
description=(u'A list of lines coordinates to draw.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
columns=4,
required=True)
@@ -233,10 +233,10 @@
class ICurves(interfaces.IRMLDirectiveSignature):
"""A path of connected bezier curves drawn on the canvas."""
- curvelist = attrng.TextNodeGrid(
+ curvelist = attr.TextNodeGrid(
title=u'Curve List',
description=(u'A list of curve coordinates to draw.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
columns=8,
required=True)
@@ -246,7 +246,7 @@
def process(self):
argset = self.getAttributeValues(valuesOnly=True)[0]
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
for args in argset:
getattr(canvas, self.callable)(*args)
@@ -254,41 +254,41 @@
class IImage(interfaces.IRMLDirectiveSignature):
"""Draws an external image on the canvas."""
- file = attrng.Image(
+ file = attr.Image(
title=u'File',
description=(u'Reference to the external file of the iamge.'),
required=True)
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'shape.'),
required=True)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'shape.'),
required=True)
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the image.',
required=False)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the image.',
required=False)
- showBoundary = attrng.Boolean(
+ showBoundary = attr.Boolean(
title=u'Show Boundary',
description=(u'A flag determining whether a border should be drawn '
u'around the image.'),
default=False,
required=False)
- preserveAspectRatio = attrng.Boolean(
+ preserveAspectRatio = attr.Boolean(
title=u'Preserve Aspect Ratio',
description=(u"A flag determining whether the image's aspect ration "
u"should be conserved under any circumstances."),
@@ -319,7 +319,7 @@
else:
kwargs['height'] = imgY * kwargs['width'] / imgX
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
getattr(canvas, self.callable)(**kwargs)
if show:
@@ -331,24 +331,24 @@
class IPlace(interfaces.IRMLDirectiveSignature):
"""Draws a set of flowables on the canvas within a given region."""
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'place.'),
required=True)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'place.'),
required=True)
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the place.',
required=False)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the place.',
required=False)
@@ -364,7 +364,7 @@
flows = flowable.Flow(self.element, self.parent)
flows.process()
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
for flow in flows.flow:
flowWidth, flowHeight = flow.wrap(width, height)
if flowWidth <= width and flowHeight <= height:
@@ -378,12 +378,12 @@
class IParam(interfaces.IRMLDirectiveSignature):
"""Sets one paramter for the text annotation."""
- name = attrng.String(
+ name = attr.String(
title=u'Name',
description=u'The name of the paramter.',
required=True)
- value = attrng.TextNode(
+ value = attr.TextNode(
title=u'Value',
description=(u'The parameter value.'),
required=True)
@@ -401,7 +401,7 @@
occurence.containing(
occurence.ZeroOrMore('param', IParam))
- contents = attrng.FirstLevelTextNode(
+ contents = attr.FirstLevelTextNode(
title=u'Contents',
description=u'The PDF commands that are inserted as annotation.',
required=True)
@@ -410,7 +410,7 @@
signature = ITextAnnotation
factories = {'param': Param}
- paramTypes = {'escape': attrng.Integer()}
+ paramTypes = {'escape': attr.Integer()}
def process(self):
contents = self.getAttributeValues(valuesOnly=True)[0]
@@ -420,17 +420,17 @@
if name in self.params:
bound = type.bind(self)
self.params[name] = bound.fromUnicode(self.params[name])
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
canvas.textAnnotation(contents, **self.params)
class IMoveTo(interfaces.IRMLDirectiveSignature):
"""Move the path cursor to the specified location."""
- position = attrng.TextNodeSequence(
+ position = attr.TextNodeSequence(
title=u'Position',
description=u'Position to which the path pointer is moved to.',
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
min_length=2,
max_length=2,
required=True)
@@ -446,10 +446,10 @@
class ICurvesTo(interfaces.IRMLDirectiveSignature):
"""Create a bezier curve from the current location to the specified one."""
- curvelist = attrng.TextNodeGrid(
+ curvelist = attr.TextNodeGrid(
title=u'Curve Specification',
description=u'Describes the end position and the curve properties.',
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
columns=6,
required=True)
@@ -468,14 +468,14 @@
occurence.ZeroOrMore('curvesTo', ICurvesTo),
)
- points = attrng.TextNodeGrid(
+ points = attr.TextNodeGrid(
title=u'Points',
description=(u'A list of coordinate points that define th path.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
columns=2,
required=True)
- close = attrng.Boolean(
+ close = attr.Boolean(
title=u'Close Path',
description=(u"A flag specifying whether the path should be closed."),
default=False,
@@ -499,7 +499,7 @@
kwargs = dict(self.getAttributeValues(ignore=('points',)))
# Start the path and set the cursor to the start location.
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
self.path = canvas.beginPath()
self.path.moveTo(kwargs.pop('x'), kwargs.pop('y'))
@@ -523,7 +523,7 @@
class IFill(interfaces.IRMLDirectiveSignature):
"""Set the fill color."""
- color = attrng.Color(
+ color = attr.Color(
title=u'Color',
description=(u'The color value to be set.'),
required=True)
@@ -537,7 +537,7 @@
class IStroke(interfaces.IRMLDirectiveSignature):
"""Set the fill color."""
- color = attrng.Color(
+ color = attr.Color(
title=u'Color',
description=(u'The color value to be set.'),
required=True)
@@ -551,17 +551,17 @@
class ISetFont(interfaces.IRMLDirectiveSignature):
"""Set the font name and/or size."""
- name = attrng.String(
+ name = attr.String(
title=u'Font Name',
description=(u'The name of the font as it was registered.'),
required=True)
- size = attrng.Measurement(
+ size = attr.Measurement(
title=u'Size',
description=(u'The font size.'),
required=True)
- leading = attrng.Measurement(
+ leading = attr.Measurement(
title=u'Leading',
description=(u'The font leading.'),
required=False)
@@ -575,12 +575,12 @@
class IScale(interfaces.IRMLDirectiveSignature):
"""Scale the drawing using x and y sclaing factors."""
- sx = attrng.Float(
+ sx = attr.Float(
title=u'X-Scaling-Factor',
description=(u'The scaling factor applied on x-coordinates.'),
required=True)
- sy = attrng.Float(
+ sy = attr.Float(
title=u'Y-Scaling-Factor',
description=(u'The scaling factor applied on y-coordinates.'),
required=True)
@@ -594,12 +594,12 @@
class ITranslate(interfaces.IRMLDirectiveSignature):
"""Translate the drawing coordinates by the specified x and y offset."""
- dx = attrng.Measurement(
+ dx = attr.Measurement(
title=u'X-Offset',
description=(u'The amount to move the drawing to the right.'),
required=True)
- dy = attrng.Measurement(
+ dy = attr.Measurement(
title=u'Y-Offset',
description=(u'The amount to move the drawing upward.'),
required=True)
@@ -612,7 +612,7 @@
class IRotate(interfaces.IRMLDirectiveSignature):
"""Rotate the drawing counterclockwise."""
- degrees = attrng.Measurement(
+ degrees = attr.Measurement(
title=u'Angle',
description=(u'The angle in degrees.'),
required=True)
@@ -626,12 +626,12 @@
class ISkew(interfaces.IRMLDirectiveSignature):
"""Skew the drawing."""
- alpha = attrng.Measurement(
+ alpha = attr.Measurement(
title=u'Alpha',
description=(u'The amount to skew the drawing in the horizontal.'),
required=True)
- beta = attrng.Measurement(
+ beta = attr.Measurement(
title=u'Beta',
description=(u'The amount to skew the drawing in the vertical.'),
required=True)
@@ -644,10 +644,10 @@
class ITransform(interfaces.IRMLDirectiveSignature):
"""A full 2-D matrix transformation"""
- matrix = attrng.TextNodeSequence(
+ matrix = attr.TextNodeSequence(
title=u'Matrix',
description=u'The transformation matrix.',
- value_type=attrng.Float(),
+ value_type=attr.Float(),
min_length=6,
max_length=6,
required=True)
@@ -657,36 +657,36 @@
def process(self):
args = self.getAttributeValues(valuesOnly=True)
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
canvas.transform(*args[0])
class ILineMode(interfaces.IRMLDirectiveSignature):
"""Set the line mode for the following graphics elements."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=(u'The line width.'),
required=False)
- dash = attrng.Sequence(
+ dash = attr.Sequence(
title=u'Dash-Pattern',
description=(u'The dash-pattern of a line.'),
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
required=False)
- miterLimit = attrng.Measurement(
+ miterLimit = attr.Measurement(
title=u'Miter Limit',
description=(u'The ???.'),
required=False)
- join = attrng.Choice(
+ join = attr.Choice(
title=u'Join',
description=u'The way lines are joined together.',
choices=interfaces.JOIN_CHOICES,
required=False)
- cap = attrng.Choice(
+ cap = attr.Choice(
title=u'Cap',
description=u'The cap is the desciption of how the line-endings look.',
choices=interfaces.CAP_CHOICES,
@@ -697,7 +697,7 @@
def process(self):
kw = dict(self.getAttributeValues())
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
if 'width' in kw:
canvas.setLineWidth(kw['width'])
if 'join' in kw:
@@ -811,14 +811,14 @@
def process(self):
super(Drawing, self).process()
- canvas = attrng.getManager(self, interfaces.ICanvasManager).canvas
+ canvas = attr.getManager(self, interfaces.ICanvasManager).canvas
canvas.showPage()
class IPageInfo(interfaces.IRMLDirectiveSignature):
"""Set's up page-global settings."""
- pageSize = attrng.PageSize(
+ pageSize = attr.PageSize(
title=u'Page Size',
description=(u'The page size of all pages within this document.'),
required=True)
Modified: z3c.rml/trunk/src/z3c/rml/chart.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/chart.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/chart.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -20,7 +20,7 @@
from reportlab.graphics import shapes
from reportlab.graphics.charts import barcharts, lineplots, piecharts
from reportlab.graphics.charts import spider, doughnut
-from z3c.rml import attrng, directive, interfaces, occurence
+from z3c.rml import attr, directive, interfaces, occurence
# Patches against Reportlab 2.0
lineplots.Formatter = reportlab.lib.formatters.Formatter
@@ -56,44 +56,44 @@
class IText(interfaces.IRMLDirectiveSignature):
"""Draw a text on the chart."""
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'text.'),
required=True)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'text.'),
required=True)
- angle = attrng.Float(
+ angle = attr.Float(
title=u'Rotation Angle',
description=(u'The angle about which the text will be rotated.'),
required=False)
- text = attrng.TextNode(
+ text = attr.TextNode(
title=u'Text',
description=u'The text to be printed.',
required=True)
- fontName = attrng.String(
+ fontName = attr.String(
title=u'Font Name',
description=u'The name of the font.',
required=False)
- fontSize = attrng.Measurement(
+ fontSize = attr.Measurement(
title=u'Font Size',
description=u'The font size for the text.',
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
title=u'Fill Color',
description=u'The color in which the text will appear.',
required=False)
- textAnchor = attrng.Choice(
+ textAnchor = attr.Choice(
title=u'Text Anchor',
description=u'The position in the text to which the coordinates refer.',
choices=('start', 'middle', 'end', 'boxauto'),
@@ -147,10 +147,10 @@
class ISeries1D(interfaces.IRMLDirectiveSignature):
"""A one-dimensional series."""
- values = attrng.TextNodeSequence(
+ values = attr.TextNodeSequence(
title=u'Values',
description=u"Numerical values representing the series' data.",
- value_type=attrng.Float(),
+ value_type=attr.Float(),
required=True)
class Series1D(Series):
@@ -171,10 +171,10 @@
class ISeries2D(interfaces.IRMLDirectiveSignature):
"""A two-dimensional series."""
- values = attrng.TextNodeGrid(
+ values = attr.TextNodeGrid(
title=u'Values',
description=u"Numerical values representing the series' data.",
- value_type=attrng.Float(),
+ value_type=attr.Float(),
columns=2,
required=True)
@@ -188,17 +188,17 @@
class IBar(interfaces.IRMLDirectiveSignature):
"""Define the look of a bar."""
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color in which the bar border is drawn.',
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the bar border line.',
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
title=u'Fill Color',
description=u'The color with which the bar is filled.',
required=False)
@@ -220,120 +220,120 @@
class ILabelBase(interfaces.IRMLDirectiveSignature):
- dx = attrng.Measurement(
+ dx = attr.Measurement(
title=u'Horizontal Extension',
description=(u'The width of the label.'),
required=False)
- dy = attrng.Measurement(
+ dy = attr.Measurement(
title=u'Vertical Extension',
description=(u'The height of the label.'),
required=False)
- angle = attrng.Float(
+ angle = attr.Float(
title=u'Angle',
description=(u'The angle to rotate the label.'),
required=False)
- boxAnchor = attrng.Choice(
+ boxAnchor = attr.Choice(
title=u'Box Anchor',
description=(u'The position relative to the label.'),
choices=('nw','n','ne','w','c','e','sw','s','se', 'autox', 'autoy'),
required=False)
- boxStrokeColor = attrng.Color(
+ boxStrokeColor = attr.Color(
title=u'Box Stroke Color',
description=(u'The color of the box border line.'),
required=False)
- boxStrokeWidth = attrng.Measurement(
+ boxStrokeWidth = attr.Measurement(
title=u'Box Stroke Width',
description=u'The width of the box border line.',
required=False)
- boxFillColor = attrng.Color(
+ boxFillColor = attr.Color(
title=u'Box Fill Color',
description=(u'The color in which the box is filled.'),
required=False)
- boxTarget = attrng.Text(
+ boxTarget = attr.Text(
title=u'Box Target',
description=u'The box target.',
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
title=u'Fill Color',
description=(u'The color in which the label is filled.'),
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
title=u'Stroke Color',
description=(u'The color of the label.'),
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the label line.',
required=False)
- frontName = attrng.String(
+ frontName = attr.String(
title=u'Font Name',
description=u'The font used to print the value.',
required=False)
- frontSize = attrng.Measurement(
+ frontSize = attr.Measurement(
title=u'Font Size',
description=u'The size of the value text.',
required=False)
- leading = attrng.Measurement(
+ leading = attr.Measurement(
title=u'Leading',
description=(u'The height of a single text line. It includes '
u'character height.'),
required=False)
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width the label.',
required=False)
- maxWidth = attrng.Measurement(
+ maxWidth = attr.Measurement(
title=u'Maximum Width',
description=u'The maximum width the label.',
required=False)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height the label.',
required=False)
- textAnchor = attrng.Choice(
+ textAnchor = attr.Choice(
title=u'Text Anchor',
description=u'The position in the text to which the coordinates refer.',
choices=('start', 'middle', 'end', 'boxauto'),
required=False)
- visible = attrng.Boolean(
+ visible = attr.Boolean(
title=u'Visible',
description=u'A flag making the label text visible.',
required=False)
- leftPadding = attrng.Measurement(
+ leftPadding = attr.Measurement(
title=u'Left Padding',
description=u'The size of the padding on the left side.',
required=False)
- rightPadding = attrng.Measurement(
+ rightPadding = attr.Measurement(
title=u'Right Padding',
description=u'The size of the padding on the right side.',
required=False)
- topPadding = attrng.Measurement(
+ topPadding = attr.Measurement(
title=u'Top Padding',
description=u'The size of the padding on the top.',
required=False)
- bottomPadding = attrng.Measurement(
+ bottomPadding = attr.Measurement(
title=u'Bottom Padding',
description=u'The size of the padding on the bottom.',
required=False)
@@ -341,13 +341,13 @@
class IPositionLabelBase(ILabelBase):
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'label.'),
required=False)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'label.'),
@@ -357,7 +357,7 @@
class ILabel(IPositionLabelBase):
"""A label for the chart."""
- text = attrng.TextNode(
+ text = attr.TextNode(
title=u'Text',
description=u'The label text to be displayed.',
required=True)
@@ -383,48 +383,48 @@
occurence.ZeroOrMore('labels', ILabels)
)
- visible = attrng.Boolean(
+ visible = attr.Boolean(
required=False)
- visibleAxis = attrng.Boolean(
+ visibleAxis = attr.Boolean(
required=False)
- visibleTicks = attrng.Boolean(
+ visibleTicks = attr.Boolean(
required=False)
- visibleLabels = attrng.Boolean(
+ visibleLabels = attr.Boolean(
required=False)
- visibleGrid = attrng.Boolean(
+ visibleGrid = attr.Boolean(
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
required=False)
- strokeDashArray = attrng.Sequence(
- value_type=attrng.Float(),
+ strokeDashArray = attr.Sequence(
+ value_type=attr.Float(),
required=False)
- gridStrokeWidth = attrng.Measurement(
+ gridStrokeWidth = attr.Measurement(
required=False)
- gridStrokeColor = attrng.Color(
+ gridStrokeColor = attr.Color(
required=False)
- gridStrokeDashArray = attrng.Sequence(
- value_type=attrng.Float(),
+ gridStrokeDashArray = attr.Sequence(
+ value_type=attr.Float(),
required=False)
- gridStart = attrng.Measurement(
+ gridStart = attr.Measurement(
required=False)
- gridEnd = attrng.Measurement(
+ gridEnd = attr.Measurement(
required=False)
- style = attrng.Choice(
+ style = attr.Choice(
choices=('parallel', 'stacked', 'parallel_3d'),
required=False)
@@ -443,7 +443,7 @@
class IName(interfaces.IRMLDirectiveSignature):
- text = attrng.TextNode(
+ text = attr.TextNode(
title=u'Text',
required=True)
@@ -466,24 +466,24 @@
class ICategoryAxis(IAxis):
- categoryNames = attrng.Sequence(
- value_type=attrng.Text(),
+ categoryNames = attr.Sequence(
+ value_type=attr.Text(),
required=False)
- joinAxis = attrng.Boolean(
+ joinAxis = attr.Boolean(
required=False)
- joinAxisPos = attrng.Measurement(
+ joinAxisPos = attr.Measurement(
required=False)
- reverseDirection = attrng.Boolean(
+ reverseDirection = attr.Boolean(
required=False)
- labelAxisMode = attrng.Choice(
+ labelAxisMode = attr.Choice(
choices=('high', 'low', 'axis'),
required=False)
- tickShift = attrng.Boolean(
+ tickShift = attr.Boolean(
required=False)
class CategoryAxis(Axis):
@@ -497,13 +497,13 @@
class IXCategoryAxis(ICategoryAxis):
- tickUp = attrng.Measurement(
+ tickUp = attr.Measurement(
required=False)
- tickDown = attrng.Measurement(
+ tickDown = attr.Measurement(
required=False)
- joinAxisMode = attrng.Choice(
+ joinAxisMode = attr.Choice(
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
@@ -513,13 +513,13 @@
class IYCategoryAxis(ICategoryAxis):
- tickLeft = attrng.Measurement(
+ tickLeft = attr.Measurement(
required=False)
- tickRight = attrng.Measurement(
+ tickRight = attr.Measurement(
required=False)
- joinAxisMode = attrng.Choice(
+ joinAxisMode = attr.Choice(
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
@@ -529,40 +529,40 @@
class IValueAxis(IAxis):
- forceZero = attrng.Boolean(
+ forceZero = attr.Boolean(
required=False)
- minimumTickSpacing = attrng.Measurement(
+ minimumTickSpacing = attr.Measurement(
required=False)
- maximumTicks = attrng.Integer(
+ maximumTicks = attr.Integer(
required=False)
- labelTextFormat = attrng.String(
+ labelTextFormat = attr.String(
required=False)
- labelTextPostFormat = attrng.Text(
+ labelTextPostFormat = attr.Text(
required=False)
- labelTextScale = attrng.Float(
+ labelTextScale = attr.Float(
required=False)
- valueMin = attrng.Float(
+ valueMin = attr.Float(
required=False)
- valueMax = attrng.Float(
+ valueMax = attr.Float(
required=False)
- valueStep = attrng.Float(
+ valueStep = attr.Float(
required=False)
- valueSteps = attrng.Measurement(
+ valueSteps = attr.Measurement(
required=False)
- rangeRound = attrng.Text(
+ rangeRound = attr.Text(
required=False)
- zrangePref = attrng.Float(
+ zrangePref = attr.Float(
required=False)
class ValueAxis(Axis):
@@ -572,20 +572,20 @@
class IXValueAxis(IValueAxis):
- tickUp = attrng.Measurement(
+ tickUp = attr.Measurement(
required=False)
- tickDown = attrng.Measurement(
+ tickDown = attr.Measurement(
required=False)
- joinAxis = attrng.Boolean(
+ joinAxis = attr.Boolean(
required=False)
- joinAxisMode = attrng.Choice(
+ joinAxisMode = attr.Choice(
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
- joinAxisPos = attrng.Measurement(
+ joinAxisPos = attr.Measurement(
required=False)
class XValueAxis(ValueAxis):
@@ -596,20 +596,20 @@
class IYValueAxis(IValueAxis):
- tickLeft = attrng.Measurement(
+ tickLeft = attr.Measurement(
required=False)
- tickRight = attrng.Measurement(
+ tickRight = attr.Measurement(
required=False)
- joinAxis = attrng.Boolean(
+ joinAxis = attr.Boolean(
required=False)
- joinAxisMode = attrng.Choice(
+ joinAxisMode = attr.Choice(
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
- joinAxisPos = attrng.Measurement(
+ joinAxisPos = attr.Measurement(
required=False)
class YValueAxis(ValueAxis):
@@ -621,22 +621,22 @@
class ILineBase(interfaces.IRMLDirectiveSignature):
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
required=False)
- strokeDashArray = attrng.Sequence(
- value_type = attrng.Float(),
+ strokeDashArray = attr.Sequence(
+ value_type = attr.Float(),
required=False)
- symbol = attrng.Symbol(
+ symbol = attr.Symbol(
required=False)
class ILine(ILineBase):
- name = attrng.Text(
+ name = attr.Text(
required=False)
class Line(PropertyItem):
@@ -653,7 +653,7 @@
class ISliceLabel(ILabelBase):
- text = attrng.TextNode(
+ text = attr.TextNode(
title=u'Text',
description=u'The label text to be displayed.',
required=True)
@@ -670,19 +670,19 @@
class ISlicePointer(interfaces.IRMLDirectiveSignature):
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- elbowLength = attrng.Measurement(
+ elbowLength = attr.Measurement(
required=False)
- edgePad = attrng.Measurement(
+ edgePad = attr.Measurement(
required=False)
- piePad = attrng.Measurement(
+ piePad = attr.Measurement(
required=False)
class SlicePointer(directive.RMLDirective):
@@ -695,34 +695,34 @@
class ISliceBase(interfaces.IRMLDirectiveSignature):
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
required=False)
- strokeDashArray = attrng.Sequence(
- value_type=attrng.Float(),
+ strokeDashArray = attr.Sequence(
+ value_type=attr.Float(),
required=False)
- popout = attrng.Measurement(
+ popout = attr.Measurement(
required=False)
- fontName = attrng.String(
+ fontName = attr.String(
required=False)
- fontSize = attrng.Measurement(
+ fontSize = attr.Measurement(
required=False)
- labelRadius = attrng.Measurement(
+ labelRadius = attr.Measurement(
required=False)
class ISlice(ISliceBase):
- swatchMarker = attrng.Symbol(
+ swatchMarker = attr.Symbol(
required=False)
@@ -740,7 +740,7 @@
class ISlice3D(ISlice):
- fillColorShaded = attrng.Color(
+ fillColorShaded = attr.Color(
required=False)
class Slice3D(Slice):
@@ -771,7 +771,7 @@
class ISlices3D(ISliceBase):
- fillColorShaded = attrng.Color(
+ fillColorShaded = attr.Color(
required=False)
class Slices3D(Slices):
@@ -790,28 +790,28 @@
class IStrandBase(interfaces.IRMLDirectiveSignature):
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
required=False)
- strokeColor= attrng.Color(
+ strokeColor= attr.Color(
required=False)
- strokeDashArray = attrng.Sequence(
- value_type=attrng.Float(),
+ strokeDashArray = attr.Sequence(
+ value_type=attr.Float(),
required=False)
- symbol = attrng.Symbol(
+ symbol = attr.Symbol(
required=False)
- symbolSize = attrng.Measurement(
+ symbolSize = attr.Measurement(
required=False)
class IStrand(IStrandBase):
- name = attrng.Text(
+ name = attr.Text(
required=False)
class Strand(PropertyItem):
@@ -826,21 +826,21 @@
class IStrandLabelBase(ILabelBase):
- _text = attrng.TextNode(
+ _text = attr.TextNode(
required=False)
- row = attrng.Integer(
+ row = attr.Integer(
required=False)
- col = attrng.Integer(
+ col = attr.Integer(
required=False)
- format = attrng.String(
+ format = attr.String(
required=False)
class IStrandLabel(IStrandLabelBase):
- dR = attrng.Float(
+ dR = attr.Float(
required=False)
class StrandLabel(Label):
@@ -866,23 +866,23 @@
class ISpoke(interfaces.IRMLDirectiveSignature):
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
required=False)
- strokeColor= attrng.Color(
+ strokeColor= attr.Color(
required=False)
- strokeDashArray = attrng.Sequence(
- value_type=attrng.Float(),
+ strokeDashArray = attr.Sequence(
+ value_type=attr.Float(),
required=False)
- labelRadius = attrng.Measurement(
+ labelRadius = attr.Measurement(
required=False)
- visible = attrng.Measurement(
+ visible = attr.Measurement(
required=False)
class Spoke(PropertyItem):
@@ -899,7 +899,7 @@
class ISpokeLabel(ISpokeLabelBase):
- _text = attrng.TextNode(
+ _text = attr.TextNode(
required=False)
class SpokeLabel(Label):
@@ -915,45 +915,45 @@
# Drawing Options
- dx = attrng.Measurement(
+ dx = attr.Measurement(
required=False)
- dy = attrng.Measurement(
+ dy = attr.Measurement(
required=False)
- dwidth = attrng.Measurement(
+ dwidth = attr.Measurement(
required=False)
- dheight = attrng.Measurement(
+ dheight = attr.Measurement(
required=False)
- angle = attrng.Float(
+ angle = attr.Float(
required=False)
# Plot Area Options
- x = attrng.Measurement(
+ x = attr.Measurement(
required=False)
- y = attrng.Measurement(
+ y = attr.Measurement(
required=False)
- width = attrng.Measurement(
+ width = attr.Measurement(
required=False)
- height = attrng.Measurement(
+ height = attr.Measurement(
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
required=False)
- debug = attrng.Boolean(
+ debug = attr.Boolean(
required=False)
class Chart(directive.RMLDirective):
@@ -976,30 +976,30 @@
group.translate(0,0)
group.rotate(angle)
self.drawing.add(group)
- manager = attrng.getManager(self, interfaces.ICanvasManager)
+ manager = attr.getManager(self, interfaces.ICanvasManager)
self.drawing.drawOn(manager.canvas, x, y)
class IBarChart(IChart):
- direction = attrng.Choice(
+ direction = attr.Choice(
choices=('horizontal', 'vertical'),
default='horizontal',
required=False)
- useAbsolute = attrng.Boolean(
+ useAbsolute = attr.Boolean(
default=False,
required=False)
- barWidth = attrng.Measurement(
+ barWidth = attr.Measurement(
default=10,
required=False)
- groupSpacing = attrng.Measurement(
+ groupSpacing = attr.Measurement(
default=5,
required=False)
- barSpacing = attrng.Measurement(
+ barSpacing = attr.Measurement(
default=0,
required=False)
@@ -1031,16 +1031,16 @@
class IBarChart3D(IBarChart):
- theta_x = attrng.Float(
+ theta_x = attr.Float(
required=False)
- theta_y = attrng.Float(
+ theta_y = attr.Float(
required=False)
- zDepth = attrng.Measurement(
+ zDepth = attr.Measurement(
required=False)
- zSpace = attrng.Measurement(
+ zSpace = attr.Measurement(
required=False)
class BarChart3D(BarChart):
@@ -1050,16 +1050,16 @@
class ILinePlot(IChart):
- reversePlotOrder = attrng.Boolean(
+ reversePlotOrder = attr.Boolean(
required=False)
- lineLabelNudge = attrng.Measurement(
+ lineLabelNudge = attr.Measurement(
required=False)
- lineLabelFormat = attrng.String(
+ lineLabelFormat = attr.String(
required=False)
- joinedLines = attrng.Boolean(
+ joinedLines = attr.Boolean(
required=False)
class LinePlot(Chart):
@@ -1084,33 +1084,33 @@
class IPieChart(IChart):
- startAngle = attrng.Integer(
+ startAngle = attr.Integer(
required=False)
- direction = attrng.Choice(
+ direction = attr.Choice(
choices=('clockwise', 'anticlockwise'),
required=False)
- checkLabelOverlap = attrng.Boolean(
+ checkLabelOverlap = attr.Boolean(
required=False)
- pointerLabelMode = attrng.Choice(
+ pointerLabelMode = attr.Choice(
choices={'none': None,
'leftright': 'LeftRight',
'leftandright': 'LeftAndRight'},
required=False)
- sameRadii = attrng.Boolean(
+ sameRadii = attr.Boolean(
required=False)
- orderMode = attrng.Choice(
+ orderMode = attr.Choice(
choices=('fixed', 'alternate'),
required=False)
- xradius = attrng.Measurement(
+ xradius = attr.Measurement(
required=False)
- yradius = attrng.Measurement(
+ yradius = attr.Measurement(
required=False)
@@ -1135,13 +1135,13 @@
class IPieChart3D(IPieChart):
- perspective = attrng.Float(
+ perspective = attr.Float(
required=False)
- depth_3d = attrng.Measurement(
+ depth_3d = attr.Measurement(
required=False)
- angle_3d = attrng.Float(
+ angle_3d = attr.Float(
required=False)
class PieChart3D(PieChart):
@@ -1156,10 +1156,10 @@
class ISpiderChart(IChart):
- startAngle = attrng.Integer(
+ startAngle = attr.Integer(
required=False)
- direction = attrng.Choice(
+ direction = attr.Choice(
choices=('clockwise', 'anticlockwise'),
required=False)
Modified: z3c.rml/trunk/src/z3c/rml/document.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/document.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/document.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -21,19 +21,19 @@
import zope.interface
import reportlab.pdfgen.canvas
from reportlab.pdfbase import pdfmetrics, ttfonts, cidfonts
-from z3c.rml import attrng, directive, interfaces, occurence
+from z3c.rml import attr, directive, interfaces, occurence
from z3c.rml import canvas, stylesheet, template
class IRegisterType1Face(interfaces.IRMLDirectiveSignature):
"""Register a new Type 1 font face."""
- afmFile = attrng.String(
+ afmFile = attr.String(
title=u'AFM File',
description=u'Path to AFM file used to register the Type 1 face.',
required=True)
- pfbFile = attrng.String(
+ pfbFile = attr.String(
title=u'PFB File',
description=u'Path to PFB file used to register the Type 1 face.',
required=True)
@@ -50,19 +50,19 @@
class IRegisterFont(interfaces.IRMLDirectiveSignature):
"""Register a new font based on a face and encoding."""
- name = attrng.String(
+ name = attr.String(
title=u'Name',
description=(u'The name under which the font can be used in style '
u'declarations or other parameters that lookup a font.'),
required=True)
- faceName = attrng.String(
+ faceName = attr.String(
title=u'Face Name',
description=(u'The name of the face the font uses. The face has to '
u'be previously registered.'),
required=True)
- encName = attrng.String(
+ encName = attr.String(
title=u'Encoding Name',
description=(u'The name of the encdoing to be used.'),
required=True)
@@ -79,13 +79,13 @@
class IRegisterTTFont(interfaces.IRMLDirectiveSignature):
"""Register a new TrueType font given the TT file and face name."""
- faceName = attrng.String(
+ faceName = attr.String(
title=u'Face Name',
description=(u'The name of the face the font uses. The face has to '
u'be previously registered.'),
required=True)
- fileName = attrng.String(
+ fileName = attr.String(
title=u'File Name',
description=u'File path of the of the TrueType font.',
required=True)
@@ -102,7 +102,7 @@
class IRegisterCidFont(interfaces.IRMLDirectiveSignature):
"""Register a new CID font given the face name."""
- faceName = attrng.String(
+ faceName = attr.String(
title=u'Face Name',
description=(u'The name of the face the font uses. The face has to '
u'be previously registered.'),
@@ -120,14 +120,14 @@
class IColorDefinition(interfaces.IRMLDirectiveSignature):
"""Define a new color and give it a name to be known under."""
- id = attrng.String(
+ id = attr.String(
title=u'Id',
description=(u'The id/name the color will be available under.'),
required=True)
# XXX: This is really disgusting; need to rename to "color"!
# This is only here for compatibility with the original RML.
- RGB = attrng.Color(
+ RGB = attr.Color(
title=u'Color',
description=(u'The color value that is represented.'),
required=True)
@@ -137,7 +137,7 @@
def process(self):
id, value = self.getAttributeValues(valuesOnly=True)
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
manager.colors[id] = value
@@ -166,24 +166,24 @@
occurence.ZeroOrOne('docinit', IDocInit),
)
- filename = attrng.String(
+ filename = attr.String(
title=u'File Name',
description=(u'The default name of the output file, if no output '
u'file was provided.'),
required=True)
- debug = attrng.Boolean(
+ debug = attr.Boolean(
title=u'Debug',
description=u'A flag to activate the debug output.',
required=False)
- compression = attrng.BooleanWithDefault(
+ compression = attr.BooleanWithDefault(
title=u'Compression',
description=(u'A flag determining whether page compression should '
u'be used.'),
required=False)
- invariant = attrng.BooleanWithDefault(
+ invariant = attr.BooleanWithDefault(
title=u'Invariant',
description=(u'A flag that determines whether the produced PDF '
u'should be invariant with respect to the date and '
Modified: z3c.rml/trunk/src/z3c/rml/flowable.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/flowable.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/flowable.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -25,7 +25,7 @@
import reportlab.platypus.tables
import zope.schema
from reportlab.lib import styles
-from z3c.rml import attrng, directive, interfaces, occurence
+from z3c.rml import attr, directive, interfaces, occurence
from z3c.rml import form, platypus, special, stylesheet
try:
@@ -49,13 +49,13 @@
class ISpacer(interfaces.IRMLDirectiveSignature):
"""Creates a vertical space in the flow."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the spacer. Currently not implemented.',
default=100,
required=False)
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=u'The height of the spacer.',
required=True)
@@ -69,12 +69,12 @@
class IIllustration(interfaces.IRMLDirectiveSignature):
"""Inserts an illustration with graphics elements."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the illustration.',
required=True)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the illustration.',
default=100,
@@ -92,7 +92,7 @@
class IBarCodeFlowable(form.IBarCodeBase):
"""Creates a bar code as a flowable."""
- value = attrng.String(
+ value = attr.String(
title=u'Value',
description=u'The value represented by the code.',
required=True)
@@ -105,18 +105,18 @@
class IPluginFlowable(interfaces.IRMLDirectiveSignature):
"""Inserts a custom flowable developed in Python."""
- module = attrng.String(
+ module = attr.String(
title=u'Module',
description=u'The Python module in which the flowable is located.',
required=True)
- function = attrng.String(
+ function = attr.String(
title=u'Function',
description=(u'The name of the factory function within the module '
u'that returns the custom flowable.'),
required=True)
- params = attrng.TextNode(
+ params = attr.TextNode(
title=u'Parameters',
description=(u'A list of parameters encoded as a long string.'),
required=False)
@@ -137,7 +137,7 @@
class IMinimalParagraphBase(interfaces.IRMLDirectiveSignature):
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The paragraph style that is applied to the paragraph. '
u'See the ``paraStyle`` tag for creating a paragraph '
@@ -145,13 +145,13 @@
default=reportlab.lib.styles.getSampleStyleSheet()['Normal'],
required=True)
- bulletText = attrng.String(
+ bulletText = attr.String(
title=u'Bullet Character',
description=(u'The bullet character is the ASCII representation of '
u'the symbol making up the bullet in a listing.'),
required=False)
- dedent = attrng.Integer(
+ dedent = attr.Integer(
title=u'Dedent',
description=(u'Number of characters to be removed in front of every '
u'line of the text.'),
@@ -186,7 +186,7 @@
class IPreformatted(IMinimalParagraphBase):
"""A preformatted text, similar to the <pre> tag in HTML."""
- text = attrng.RawXMLContent(
+ text = attr.RawXMLContent(
title=u'Text',
description=(u'The text that will be layed out.'),
required=True)
@@ -199,7 +199,7 @@
class IXPreformatted(IParagraphBase):
"""A preformatted text that allows paragraph markup."""
- text = attrng.RawXMLContent(
+ text = attr.RawXMLContent(
title=u'Text',
description=(u'The text that will be layed out.'),
required=True)
@@ -212,7 +212,7 @@
class IParagraph(IParagraphBase, stylesheet.IBaseParagraphStyle):
"""Lays out an entire paragraph."""
- text = attrng.XMLContent(
+ text = attr.XMLContent(
title=u'Text',
description=(u'The text that will be layed out.'),
required=True)
@@ -240,7 +240,7 @@
class ITitle(IParagraph):
"""The title is a simple paragraph with a special title style."""
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The paragraph style that is applied to the paragraph. '
u'See the ``paraStyle`` tag for creating a paragraph '
@@ -255,7 +255,7 @@
class IHeading1(IParagraph):
"""Heading 1 is a simple paragraph with a special heading 1 style."""
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The paragraph style that is applied to the paragraph. '
u'See the ``paraStyle`` tag for creating a paragraph '
@@ -270,7 +270,7 @@
class IHeading2(IParagraph):
"""Heading 2 is a simple paragraph with a special heading 2 style."""
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The paragraph style that is applied to the paragraph. '
u'See the ``paraStyle`` tag for creating a paragraph '
@@ -285,7 +285,7 @@
class IHeading3(IParagraph):
"""Heading 3 is a simple paragraph with a special heading 3 style."""
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The paragraph style that is applied to the paragraph. '
u'See the ``paraStyle`` tag for creating a paragraph '
@@ -300,173 +300,173 @@
class ITableCell(interfaces.IRMLDirectiveSignature):
"""A table cell within a table."""
- content = attrng.RawXMLContent(
+ content = attr.RawXMLContent(
title=u'Content',
description=(u'The content of the cell; can be text or any flowable.'),
required=True)
- fontName = attrng.String(
+ fontName = attr.String(
title=u'Font Name',
description=u'The name of the font for the cell.',
required=False)
- fontSize = attrng.Measurement(
+ fontSize = attr.Measurement(
title=u'Font Size',
description=u'The font size for the text of the cell.',
required=False)
- leading = attrng.Measurement(
+ leading = attr.Measurement(
title=u'Leading',
description=(u'The height of a single text line. It includes '
u'character height.'),
required=False)
- fontColor = attrng.Color(
+ fontColor = attr.Color(
title=u'Font Color',
description=u'The color in which the text will appear.',
required=False)
- leftPadding = attrng.Measurement(
+ leftPadding = attr.Measurement(
title=u'Left Padding',
description=u'The size of the padding on the left side.',
required=False)
- rightPadding = attrng.Measurement(
+ rightPadding = attr.Measurement(
title=u'Right Padding',
description=u'The size of the padding on the right side.',
required=False)
- topPadding = attrng.Measurement(
+ topPadding = attr.Measurement(
title=u'Top Padding',
description=u'The size of the padding on the top.',
required=False)
- bottomPadding = attrng.Measurement(
+ bottomPadding = attr.Measurement(
title=u'Bottom Padding',
description=u'The size of the padding on the bottom.',
required=False)
- background = attrng.Color(
+ background = attr.Color(
title=u'Background Color',
description=u'The color to use as the background for the cell.',
required=False)
- align = attrng.Choice(
+ align = attr.Choice(
title=u'Text Alignment',
description=u'The text alignment within the cell.',
choices=interfaces.ALIGN_TEXT_CHOICES,
required=False)
- vAlign = attrng.Choice(
+ vAlign = attr.Choice(
title=u'Vertical Alignment',
description=u'The vertical alignment of the text within the cell.',
choices=interfaces.VALIGN_TEXT_CHOICES,
required=False)
- lineBelowThickness = attrng.Measurement(
+ lineBelowThickness = attr.Measurement(
title=u'Line Below Thickness',
description=u'The thickness of the line below the cell.',
required=False)
- lineBelowColor = attrng.Color(
+ lineBelowColor = attr.Color(
title=u'Line Below Color',
description=u'The color of the line below the cell.',
required=False)
- lineBelowCap = attrng.Choice(
+ lineBelowCap = attr.Choice(
title=u'Line Below Cap',
description=u'The cap at the end of the line below the cell.',
choices=interfaces.CAP_CHOICES,
required=False)
- lineBelowCount = attrng.Integer(
+ lineBelowCount = attr.Integer(
title=u'Line Below Count',
description=(u'Describes whether the line below is a single (1) or '
u'double (2) line.'),
required=False)
- lineBelowSpace = attrng.Measurement(
+ lineBelowSpace = attr.Measurement(
title=u'Line Below Space',
description=u'The space of the line below the cell.',
required=False)
- lineAboveThickness = attrng.Measurement(
+ lineAboveThickness = attr.Measurement(
title=u'Line Above Thickness',
description=u'The thickness of the line above the cell.',
required=False)
- lineAboveColor = attrng.Color(
+ lineAboveColor = attr.Color(
title=u'Line Above Color',
description=u'The color of the line above the cell.',
required=False)
- lineAboveCap = attrng.Choice(
+ lineAboveCap = attr.Choice(
title=u'Line Above Cap',
description=u'The cap at the end of the line above the cell.',
choices=interfaces.CAP_CHOICES,
required=False)
- lineAboveCount = attrng.Integer(
+ lineAboveCount = attr.Integer(
title=u'Line Above Count',
description=(u'Describes whether the line above is a single (1) or '
u'double (2) line.'),
required=False)
- lineAboveSpace = attrng.Measurement(
+ lineAboveSpace = attr.Measurement(
title=u'Line Above Space',
description=u'The space of the line above the cell.',
required=False)
- lineLeftThickness = attrng.Measurement(
+ lineLeftThickness = attr.Measurement(
title=u'Left Line Thickness',
description=u'The thickness of the line left of the cell.',
required=False)
- lineLeftColor = attrng.Color(
+ lineLeftColor = attr.Color(
title=u'Left Line Color',
description=u'The color of the line left of the cell.',
required=False)
- lineLeftCap = attrng.Choice(
+ lineLeftCap = attr.Choice(
title=u'Line Left Cap',
description=u'The cap at the end of the line left of the cell.',
choices=interfaces.CAP_CHOICES,
required=False)
- lineLeftCount = attrng.Integer(
+ lineLeftCount = attr.Integer(
title=u'Line Left Count',
description=(u'Describes whether the left line is a single (1) or '
u'double (2) line.'),
required=False)
- lineLeftSpace = attrng.Measurement(
+ lineLeftSpace = attr.Measurement(
title=u'Line Left Space',
description=u'The space of the line left of the cell.',
required=False)
- lineRightThickness = attrng.Measurement(
+ lineRightThickness = attr.Measurement(
title=u'Right Line Thickness',
description=u'The thickness of the line right of the cell.',
required=False)
- lineRightColor = attrng.Color(
+ lineRightColor = attr.Color(
title=u'Right Line Color',
description=u'The color of the line right of the cell.',
required=False)
- lineRightCap = attrng.Choice(
+ lineRightCap = attr.Choice(
title=u'Line Right Cap',
description=u'The cap at the end of the line right of the cell.',
choices=interfaces.CAP_CHOICES,
required=False)
- lineRightCount = attrng.Integer(
+ lineRightCount = attr.Integer(
title=u'Line Right Count',
description=(u'Describes whether the right line is a single (1) or '
u'double (2) line.'),
required=False)
- lineRightSpace = attrng.Measurement(
+ lineRightSpace = attr.Measurement(
title=u'Line Right Space',
description=u'The space of the line right of the cell.',
required=False)
@@ -536,12 +536,12 @@
class ITableBulkData(interfaces.IRMLDirectiveSignature):
"""Bulk Data allows one to wuickly create a table."""
- content = attrng.TextNodeSequence(
+ content = attr.TextNodeSequence(
title=u'Content',
description=u'The bulk data.',
splitre=re.compile('\n'),
- value_type=attrng.Sequence(splitre=re.compile(','),
- value_type=attrng.Text())
+ value_type=attr.Sequence(splitre=re.compile(','),
+ value_type=attr.Text())
)
class TableBulkData(directive.RMLDirective):
@@ -570,24 +570,24 @@
occurence.ZeroOrMore('blockTableStyle', stylesheet.IBlockTableStyle),
)
- style = attrng.Style(
+ style = attr.Style(
title=u'Style',
description=(u'The table style that is applied to the table. '),
required=False)
- rowHeights = attrng.Sequence(
+ rowHeights = attr.Sequence(
title=u'Row Heights',
description=u'A list of row heights in the table.',
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
required=False)
- colWidths = attrng.Sequence(
+ colWidths = attr.Sequence(
title=u'Column Widths',
description=u'A list of column widths in the table.',
- value_type=attrng.Measurement(allowPercentage=True, allowStar=True),
+ value_type=attr.Measurement(allowPercentage=True, allowStar=True),
required=False)
- repeatRows = attrng.Integer(
+ repeatRows = attr.Integer(
title=u'Repeat Rows',
description=u'A flag to repeat rows upon table splits.',
required=False)
@@ -623,7 +623,7 @@
class INextFrame(interfaces.IRMLDirectiveSignature):
"""Switch to the next frame."""
- name = attrng.StringOrInt(
+ name = attr.StringOrInt(
title=u'Name',
description=(u'The name or index of the next frame.'),
required=False)
@@ -636,7 +636,7 @@
class ISetNextFrame(interfaces.IRMLDirectiveSignature):
"""Define the next frame to switch to."""
- name = attrng.StringOrInt(
+ name = attr.StringOrInt(
title=u'Name',
description=(u'The name or index of the next frame.'),
required=True)
@@ -657,7 +657,7 @@
class ISetNextTemplate(interfaces.IRMLDirectiveSignature):
"""Define the next page template to use."""
- name = attrng.StringOrInt(
+ name = attr.StringOrInt(
title=u'Name',
description=u'The name or index of the next page template.',
required=True)
@@ -670,7 +670,7 @@
class IConditionalPageBreak(interfaces.IRMLDirectiveSignature):
"""Switch to the next page if not enough vertical space is available."""
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'height',
description=u'The minimal height that must be remaining on the page.',
required=True)
@@ -683,35 +683,35 @@
class IKeepInFrame(interfaces.IRMLDirectiveSignature):
"""Ask a flowable to stay within the frame."""
- maxWidth = attrng.Measurement(
+ maxWidth = attr.Measurement(
title=u'Maximum Width',
description=u'The maximum width the flowables are allotted.',
default=None,
required=False)
- maxHeight = attrng.Measurement(
+ maxHeight = attr.Measurement(
title=u'Maximum Height',
description=u'The maximum height the flowables are allotted.',
default=None,
required=False)
- mergeSpace = attrng.Boolean(
+ mergeSpace = attr.Boolean(
title=u'Merge Space',
description=u'A flag to set whether the space should be merged.',
required=False)
- onOverflow = attrng.Choice(
+ onOverflow = attr.Choice(
title=u'On Overflow',
description=u'Defines what has to be done, if an overflow is detected.',
choices=('error', 'overflow', 'shrink', 'truncate'),
required=False)
- id = attrng.Text(
+ id = attr.Text(
title=u'Name/Id',
description=u'The name/id of the flowable.',
required=False)
- frame = attrng.StringOrInt(
+ frame = attr.StringOrInt(
title=u'Frame',
description=u'The frame to which the flowable should be fitted.',
required=False)
@@ -743,48 +743,48 @@
class IImageAndFlowables(interfaces.IRMLDirectiveSignature):
"""An image with flowables around it."""
- imageName = attrng.Image(
+ imageName = attr.Image(
title=u'Image',
description=u'The file that is used to extract the image data.',
onlyOpen=True,
required=True)
- imageWidth = attrng.Measurement(
+ imageWidth = attr.Measurement(
title=u'Image Width',
description=u'The width of the image.',
required=False)
- imageHeight = attrng.Measurement(
+ imageHeight = attr.Measurement(
title=u'Image Height',
description=u'The height the image.',
required=False)
- imageMask = attrng.Color(
+ imageMask = attr.Color(
title=u'Mask',
description=u'The height the image.',
required=False)
- imageLeftPadding = attrng.Measurement(
+ imageLeftPadding = attr.Measurement(
title=u'Image Left Padding',
description=u'The padding on the left side of the image.',
required=False)
- imageRightPadding = attrng.Measurement(
+ imageRightPadding = attr.Measurement(
title=u'Image Right Padding',
description=u'The padding on the right side of the image.',
required=False)
- imageTopPadding = attrng.Measurement(
+ imageTopPadding = attr.Measurement(
title=u'Image Top Padding',
description=u'The padding on the top of the image.',
required=False)
- imageBottomPadding = attrng.Measurement(
+ imageBottomPadding = attr.Measurement(
title=u'Image Bottom Padding',
description=u'The padding on the bottom of the image.',
required=False)
- iamgeSide = attrng.Choice(
+ iamgeSide = attr.Choice(
title=u'Image Side',
description=u'The side at which the image will be placed.',
choices=('left', 'right'),
@@ -847,12 +847,12 @@
class IIndent(interfaces.IRMLDirectiveSignature):
"""Indent the contained flowables."""
- left = attrng.Measurement(
+ left = attr.Measurement(
title=u'Left',
description=u'The indentation to the left.',
required=False)
- right = attrng.Measurement(
+ right = attr.Measurement(
title=u'Right',
description=u'The indentation to the right.',
required=False)
@@ -877,12 +877,12 @@
class IFixedSize(interfaces.IRMLDirectiveSignature):
"""Create a container flowable of a fixed size."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width the flowables are allotted.',
required=True)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height the flowables are allotted.',
required=True)
@@ -911,38 +911,38 @@
choice of 'fitType'.
"""
- name = attrng.Text(
+ name = attr.Text(
title=u'Name',
description=u'The name of the bookmark.',
required=True)
- fitType = attrng.Choice(
+ fitType = attr.Choice(
title=u'Fit Type',
description=u'The Fit Type.',
choices=('Fit', 'FitH', 'FitV', 'FitR'),
required=False)
- left = attrng.Measurement(
+ left = attr.Measurement(
title=u'Left',
description=u'The left position.',
required=False)
- right = attrng.Measurement(
+ right = attr.Measurement(
title=u'Right',
description=u'The right position.',
required=False)
- top = attrng.Measurement(
+ top = attr.Measurement(
title=u'Top',
description=u'The top position.',
required=False)
- right = attrng.Measurement(
+ right = attr.Measurement(
title=u'Right',
description=u'The right position.',
required=False)
- zoom = attrng.Float(
+ zoom = attr.Float(
title=u'Zoom',
description=u'The zoom level when clicking on the bookmark.',
required=False)
@@ -956,54 +956,54 @@
class IHorizontalRow(interfaces.IRMLDirectiveSignature):
"""Create a horizontal line on the page."""
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the line on the page.',
allowPercentage=True,
required=False)
- thickness = attrng.Measurement(
+ thickness = attr.Measurement(
title=u'Thickness',
description=u'Line Thickness',
required=False)
- color = attrng.Color(
+ color = attr.Color(
title=u'Color',
description=u'The color of the line.',
required=False)
- lineCap = attrng.Choice(
+ lineCap = attr.Choice(
title=u'Cap',
description=u'The cap at the end of the line.',
choices=interfaces.CAP_CHOICES.keys(),
required=False)
- spaceBefore = attrng.Measurement(
+ spaceBefore = attr.Measurement(
title=u'Space Before',
description=u'The vertical space before the line.',
required=False)
- spaceAfter = attrng.Measurement(
+ spaceAfter = attr.Measurement(
title=u'Space After',
description=u'The vertical space after the line.',
required=False)
- align = attrng.Choice(
+ align = attr.Choice(
title=u'Alignment',
description=u'The alignment of the line within the frame.',
choices=interfaces.ALIGN_TEXT_CHOICES,
required=False)
- valign = attrng.Choice(
+ valign = attr.Choice(
title=u'Vertical Alignment',
description=u'The vertical alignment of the line.',
choices=interfaces.VALIGN_TEXT_CHOICES,
required=False)
- dash = attrng.Sequence(
+ dash = attr.Sequence(
title=u'Dash-Pattern',
description=u'The dash-pattern of a line.',
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
default=None,
required=False)
@@ -1016,22 +1016,22 @@
class IOutlineAdd(interfaces.IRMLDirectiveSignature):
"""Add a new entry to the outline of the PDF."""
- title = attrng.TextNode(
+ title = attr.TextNode(
title=u'Title',
description=u'The text displayed for this item.',
required=True)
- key = attrng.String(
+ key = attr.String(
title=u'Key',
description=u'The unique key of the item.',
required=False)
- level = attrng.Integer(
+ level = attr.Integer(
title=u'Level',
description=u'The level in the outline tree.',
required=False)
- closed = attrng.Boolean(
+ closed = attr.Boolean(
title=u'Closed',
description=(u'A flag to determine whether the sub-tree is closed '
u'by default.'),
Modified: z3c.rml/trunk/src/z3c/rml/form.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/form.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/form.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -17,7 +17,7 @@
"""
__docformat__ = "reStructuredText"
import types
-from z3c.rml import attrng, directive, interfaces
+from z3c.rml import attr, directive, interfaces
try:
import reportlab.graphics.barcode
@@ -32,77 +32,77 @@
class IBarCodeBase(interfaces.IRMLDirectiveSignature):
"""Create a bar code."""
- code = attrng.Choice(
+ code = attr.Choice(
title=u'Code',
description=u'The name of the type of code to use.',
choices=reportlab.graphics.barcode.getCodeNames(),
required=True)
- value = attrng.TextNode(
+ value = attr.TextNode(
title=u'Value',
description=u'The value represented by the code.',
required=True)
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the barcode.',
required=False)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the barcode.',
required=False)
- strokeColor = attrng.Color(
+ strokeColor = attr.Color(
title=u'Stroke Color',
description=(u'The color of the line strokes in the area.'),
required=False)
- strokeWidth = attrng.Measurement(
+ strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the line strokes in the area.',
required=False)
- fillColor = attrng.Color(
+ fillColor = attr.Color(
title=u'Fill Color',
description=(u'The color of the filled shapes in the area.'),
required=False)
- barStrokeColor = attrng.Color(
+ barStrokeColor = attr.Color(
title=u'Bar Stroke Color',
description=(u'The color of the line strokes in the barcode.'),
required=False)
- barStrokeWidth = attrng.Measurement(
+ barStrokeWidth = attr.Measurement(
title=u'Bar Stroke Width',
description=u'The width of the line strokes in the barcode.',
required=False)
- barFillColor = attrng.Color(
+ barFillColor = attr.Color(
title=u'Bar Fill Color',
description=(u'The color of the filled shapes in the barcode.'),
required=False)
- gap = attrng.Measurement(
+ gap = attr.Measurement(
title=u'Gap',
description=u'The width of the inter-character gaps.',
required=False)
# Bar code dependent attributes
# I2of5, Code128, Standard93, FIM, POSTNET, Ean13B
- barWidth = attrng.Measurement(
+ barWidth = attr.Measurement(
title=u'Bar Width',
description=u'The width of the smallest bar within the barcode',
required=False)
# I2of5, Code128, Standard93, FIM, POSTNET
- barHeight = attrng.Measurement(
+ barHeight = attr.Measurement(
title=u'Bar Height',
description=u'The height of the symbol.',
required=False)
# I2of5
- ratio = attrng.Float(
+ ratio = attr.Float(
title=u'Ratio',
description=(u'The ratio of wide elements to narrow elements. '
u'Must be between 2.0 and 3.0 (or 2.2 and 3.0 if the '
@@ -113,14 +113,14 @@
# I2of5
# Should be boolean, but some code want it as int; will still work
- checksum = attrng.Integer(
+ checksum = attr.Integer(
title=u'Ratio',
description=(u'A flag that enables the computation and inclusion of '
u'the check digit.'),
required=False)
# I2of5
- bearers = attrng.Float(
+ bearers = attr.Float(
title=u'Bearers',
description=(u'Height of bearer bars (horizontal bars along the top '
u'and bottom of the barcode). Default is 3 '
@@ -130,13 +130,13 @@
required=False)
# I2of5, Code128, Standard93, FIM, Ean13
- quiet = attrng.Boolean(
+ quiet = attr.Boolean(
title=u'Quiet Zone',
description=(u'A flag to include quiet zones in the symbol.'),
required=False)
# I2of5, Code128, Standard93, FIM, Ean13
- lquiet = attrng.Measurement(
+ lquiet = attr.Measurement(
title=u'Left Quiet Zone',
description=(u"Quiet zone size to the left of code, if quiet is "
u"true. Default is the greater of .25 inch or .15 times "
@@ -144,7 +144,7 @@
required=False)
# I2of5, Code128, Standard93, FIM, Ean13
- rquiet = attrng.Measurement(
+ rquiet = attr.Measurement(
title=u'Right Quiet Zone',
description=(u"Quiet zone size to the right of code, if quiet is "
u"true. Default is the greater of .25 inch or .15 times "
@@ -152,45 +152,45 @@
required=False)
# I2of5, Code128, Standard93, FIM, POSTNET, Ean13
- frontName = attrng.String(
+ frontName = attr.String(
title=u'Font Name',
description=(u'The font used to print the value.'),
required=False)
# I2of5, Code128, Standard93, FIM, POSTNET, Ean13
- frontSize = attrng.Measurement(
+ frontSize = attr.Measurement(
title=u'Font Size',
description=(u'The size of the value text.'),
required=False)
# I2of5, Code128, Standard93, FIM, POSTNET, Ean13
- humanReadable = attrng.Boolean(
+ humanReadable = attr.Boolean(
title=u'Human Readable',
description=(u'A flag when set causes the value to be printed below '
u'the bar code.'),
required=False)
# I2of5, Standard93
- stop = attrng.Boolean(
+ stop = attr.Boolean(
title=u'Show Start/Stop',
description=(u'A flag to specify whether the start/stop symbols '
u'are to be shown.'),
required=False)
# FIM, POSTNET
- spaceWidth = attrng.Measurement(
+ spaceWidth = attr.Measurement(
title=u'Space Width',
description=u'The space of the inter-character gaps.',
required=False)
# POSTNET
- shortHeight = attrng.Measurement(
+ shortHeight = attr.Measurement(
title=u'Short Height',
description=u'The height of the short bar.',
required=False)
# Ean13
- textColor = attrng.Color(
+ textColor = attr.Color(
title=u'Text Color',
description=(u'The color of human readable text.'),
required=False)
@@ -199,13 +199,13 @@
class IBarCode(IBarCodeBase):
"""A barcode graphic."""
- x = attrng.Measurement(
+ x = attr.Measurement(
title=u'X-Position',
description=u'The x-position of the lower-left corner of the barcode.',
default=0,
required=False)
- y = attrng.Measurement(
+ y = attr.Measurement(
title=u'Y-Position',
description=u'The y-position of the lower-left corner of the barcode.',
default=0,
@@ -223,5 +223,5 @@
x = kw.pop('x', 0)
y = kw.pop('y', 0)
code = reportlab.graphics.barcode.createBarcodeDrawing(name, **kw)
- manager = attrng.getManager(self, interfaces.ICanvasManager)
+ manager = attr.getManager(self, interfaces.ICanvasManager)
code.drawOn(manager.canvas, x, y)
Modified: z3c.rml/trunk/src/z3c/rml/interfaces.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/interfaces.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/interfaces.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -20,7 +20,6 @@
import zope.interface
import zope.schema
-from z3c.rml import attrng
from z3c.rml.occurence import ZeroOrMore, ZeroOrOne, OneOrMore
JOIN_CHOICES = {'round': 1, 'mitered': 0, 'bevelled': 2}
Modified: z3c.rml/trunk/src/z3c/rml/page.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/page.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/page.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -17,7 +17,7 @@
"""
__docformat__ = "reStructuredText"
import cStringIO
-from z3c.rml import attrng, directive, interfaces
+from z3c.rml import attr, directive, interfaces
try:
import pyPdf
@@ -51,12 +51,12 @@
class IMergePage(interfaces.IRMLDirectiveSignature):
"""Merges an existing PDF Page into the one to be generated."""
- filename = attrng.File(
+ filename = attr.File(
title=u'File',
description=(u'Reference to the PDF file to extract the page from.'),
required=True)
- page = attrng.Integer(
+ page = attr.Integer(
title=u'Page Number',
description=u'The page number of the PDF file that is used to merge..',
required=True)
@@ -66,7 +66,7 @@
signature = IMergePage
def getProcessor(self):
- manager = attrng.getManager(self, interfaces.IPostProcessorManager)
+ manager = attr.getManager(self, interfaces.IPostProcessorManager)
procs = dict(manager.postProcessors)
if 'MERGE' not in procs:
proc = MergePostProcessor()
@@ -79,7 +79,7 @@
raise Exception(
'pyPdf is not installed, so this feature is not available.')
inputFile, inPage = self.getAttributeValues(valuesOnly=True)
- manager = attrng.getManager(self, interfaces.ICanvasManager)
+ manager = attr.getManager(self, interfaces.ICanvasManager)
outPage = manager.canvas.getPageNumber()-1
proc = self.getProcessor()
Modified: z3c.rml/trunk/src/z3c/rml/special.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/special.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/special.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -16,18 +16,18 @@
$Id$
"""
__docformat__ = "reStructuredText"
-from z3c.rml import attrng, directive, interfaces
+from z3c.rml import attr, directive, interfaces
class IName(interfaces.IRMLDirectiveSignature):
"""Defines a name for a string."""
- id = attrng.String(
+ id = attr.String(
title=u'Id',
description=u'The id under which the value will be known.',
required=True)
- value = attrng.Text(
+ value = attr.Text(
title=u'Value',
description=u'The text that is displayed if the id is called.',
required=True)
@@ -37,14 +37,14 @@
def process(self):
id, value = self.getAttributeValues(valuesOnly=True)
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
manager.names[id] = value
class IGetName(interfaces.IRMLDirectiveSignature):
"""Get the text for the id."""
- id = attrng.String(
+ id = attr.String(
title=u'Id',
description=u'The id as which the value is known.',
required=True)
@@ -54,7 +54,7 @@
def process(self):
id = dict(self.getAttributeValues()).pop('id')
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
text = manager.names[id] + (self.element.tail or u'')
# Now replace the element with the text
parent = self.element.getparent()
@@ -68,12 +68,12 @@
class IAlias(interfaces.IRMLDirectiveSignature):
"""Defines an alias for a given style."""
- id = attrng.String(
+ id = attr.String(
title=u'Id',
description=u'The id as which the style will be known.',
required=True)
- value = attrng.Style(
+ value = attr.Style(
title=u'Value',
description=u'The style that is represented.',
required=True)
@@ -83,5 +83,5 @@
def process(self):
id, value = self.getAttributeValues(valuesOnly=True)
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
manager.styles[id] = value
Modified: z3c.rml/trunk/src/z3c/rml/stylesheet.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/stylesheet.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/stylesheet.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -20,7 +20,7 @@
import reportlab.lib.styles
import reportlab.lib.enums
import reportlab.platypus
-from z3c.rml import attrng, directive, interfaces, occurence, special
+from z3c.rml import attr, directive, interfaces, occurence, special
class IInitialize(interfaces.IRMLDirectiveSignature):
@@ -40,79 +40,79 @@
class IBaseParagraphStyle(interfaces.IRMLDirectiveSignature):
- fontName = attrng.String(
+ fontName = attr.String(
title=u'Font Name',
description=u'The name of the font for the paragraph.',
required=False)
- fontSize = attrng.Measurement(
+ fontSize = attr.Measurement(
title=u'Font Size',
description=u'The font size for the text of the paragraph.',
required=False)
- leading = attrng.Measurement(
+ leading = attr.Measurement(
title=u'Leading',
description=(u'The height of a single paragraph line. It includes '
u'character height.'),
required=False)
- leftIndent = attrng.Measurement(
+ leftIndent = attr.Measurement(
title=u'Left Indentation',
description=u'General indentation on the left side.',
required=False)
- rightIndent = attrng.Measurement(
+ rightIndent = attr.Measurement(
title=u'Right Indentation',
description=u'General indentation on the right side.',
required=False)
- firstLineIndent = attrng.Measurement(
+ firstLineIndent = attr.Measurement(
title=u'First Line Indentation',
description=u'The indentation of the first line in the paragraph.',
required=False)
- spaceBefore = attrng.Measurement(
+ spaceBefore = attr.Measurement(
title=u'Space Before',
description=u'The vertical space before the paragraph.',
required=False)
- spaceAfter = attrng.Measurement(
+ spaceAfter = attr.Measurement(
title=u'Space After',
description=u'The vertical space after the paragraph.',
required=False)
- alignment = attrng.Choice(
+ alignment = attr.Choice(
title=u'Alignment',
description=u'The text alignment.',
choices=interfaces.ALIGN_CHOICES,
required=False)
- bulletFontName = attrng.String(
+ bulletFontName = attr.String(
title=u'Bullet Font Name',
description=u'The font in which the bullet character will be rendered.',
required=False)
- bulletFontSize = attrng.Measurement(
+ bulletFontSize = attr.Measurement(
title=u'Bullet Font Size',
description=u'The font size of the bullet character.',
required=False)
- bulletIndent = attrng.Measurement(
+ bulletIndent = attr.Measurement(
title=u'Bullet Indentation',
description=u'The indentation that is kept for a bullet point.',
required=False)
- textColor = attrng.Color(
+ textColor = attr.Color(
title=u'Text Color',
description=u'The color in which the text will appear.',
required=False)
- backColor = attrng.Color(
+ backColor = attr.Color(
title=u'Background Color',
description=u'The background color of the paragraph.',
required=False)
- keepWithNext = attrng.Boolean(
+ keepWithNext = attr.Boolean(
title=u'Keep with Next',
description=(u'When set, this paragraph will always be in the same '
u'frame as the following flowable.'),
@@ -122,17 +122,17 @@
class IParagraphStyle(IBaseParagraphStyle):
"""Defines a paragraph style and gives it a name."""
- name = attrng.String(
+ name = attr.String(
title=u'Name',
description=u'The name of the style.',
required=True)
- alias = attrng.String(
+ alias = attr.String(
title=u'Alias',
description=u'An alias under which the style will also be known as.',
required=False)
- parent = attrng.Style(
+ parent = attr.Style(
title=u'Parent',
description=(u'The apragraph style that will be used as a base for '
u'this one.'),
@@ -151,30 +151,30 @@
for name, value in kwargs.items():
setattr(style, name, value)
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
manager.styles[style.name] = style
class ITableStyleCommand(interfaces.IRMLDirectiveSignature):
- start = attrng.Sequence(
+ start = attr.Sequence(
title=u'Start Coordinates',
description=u'The start table coordinates for the style instruction',
- value_type=attrng.Combination(
- value_types=(attrng.Integer(),
- attrng.Choice(choices=interfaces.SPLIT_CHOICES))
+ value_type=attr.Combination(
+ value_types=(attr.Integer(),
+ attr.Choice(choices=interfaces.SPLIT_CHOICES))
),
default=[0, 0],
min_length=2,
max_length=2,
required=True)
- end = attrng.Sequence(
+ end = attr.Sequence(
title=u'End Coordinates',
description=u'The end table coordinates for the style instruction',
- value_type=attrng.Combination(
- value_types=(attrng.Integer(),
- attrng.Choice(choices=interfaces.SPLIT_CHOICES))
+ value_type=attr.Combination(
+ value_types=(attr.Integer(),
+ attr.Choice(choices=interfaces.SPLIT_CHOICES))
),
default=[-1, -1],
min_length=2,
@@ -193,17 +193,17 @@
class IBlockFont(ITableStyleCommand):
"""Set the font properties for the texts."""
- name = attrng.String(
+ name = attr.String(
title=u'Font Name',
description=u'The name of the font for the cell.',
required=False)
- size = attrng.Measurement(
+ size = attr.Measurement(
title=u'Font Size',
description=u'The font size for the text of the cell.',
required=False)
- leading = attrng.Measurement(
+ leading = attr.Measurement(
title=u'Leading',
description=(u'The height of a single text line. It includes '
u'character height.'),
@@ -216,7 +216,7 @@
class IBlockLeading(ITableStyleCommand):
"""Set the text leading."""
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=(u'The height of a single text line. It includes '
u'character height.'),
@@ -229,7 +229,7 @@
class IBlockTextColor(ITableStyleCommand):
"""Set the text color."""
- colorName = attrng.Color(
+ colorName = attr.Color(
title=u'Color Name',
description=u'The color in which the text will appear.',
required=True)
@@ -241,7 +241,7 @@
class IBlockAlignment(ITableStyleCommand):
"""Set the text alignment."""
- value = attrng.Choice(
+ value = attr.Choice(
title=u'Text Alignment',
description=u'The text alignment within the cell.',
choices=interfaces.ALIGN_TEXT_CHOICES,
@@ -254,7 +254,7 @@
class IBlockLeftPadding(ITableStyleCommand):
"""Set the left padding of the cells."""
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=u'The size of the padding.',
required=True)
@@ -266,7 +266,7 @@
class IBlockRightPadding(ITableStyleCommand):
"""Set the right padding of the cells."""
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=u'The size of the padding.',
required=True)
@@ -278,7 +278,7 @@
class IBlockBottomPadding(ITableStyleCommand):
"""Set the bottom padding of the cells."""
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=u'The size of the padding.',
required=True)
@@ -290,7 +290,7 @@
class IBlockTopPadding(ITableStyleCommand):
"""Set the top padding of the cells."""
- length = attrng.Measurement(
+ length = attr.Measurement(
title=u'Length',
description=u'The size of the padding.',
required=True)
@@ -305,21 +305,21 @@
It also supports alternating colors.
"""
- colorName = attrng.Color(
+ colorName = attr.Color(
title=u'Color Name',
description=u'The color to use as the background for every cell.',
required=False)
- colorsByRow = attrng.Sequence(
+ colorsByRow = attr.Sequence(
title=u'Colors By Row',
description=u'A list of colors to be used circularly for rows.',
- value_type=attrng.Color(acceptNone=True),
+ value_type=attr.Color(acceptNone=True),
required=False)
- colorsByCol = attrng.Sequence(
+ colorsByCol = attr.Sequence(
title=u'Colors By Column',
description=u'A list of colors to be used circularly for columns.',
- value_type=attrng.Color(acceptNone=True),
+ value_type=attr.Color(acceptNone=True),
required=False)
class BlockBackground(TableStyleCommand):
@@ -339,10 +339,10 @@
class IBlockRowBackground(ITableStyleCommand):
"""Define the background colors for rows."""
- colorNames = attrng.Sequence(
+ colorNames = attr.Sequence(
title=u'Colors By Row',
description=u'A list of colors to be used circularly for rows.',
- value_type=attrng.Color(),
+ value_type=attr.Color(),
required=True)
class BlockRowBackground(TableStyleCommand):
@@ -352,10 +352,10 @@
class IBlockColBackground(ITableStyleCommand):
"""Define the background colors for columns."""
- colorNames = attrng.Sequence(
+ colorNames = attr.Sequence(
title=u'Colors By Row',
description=u'A list of colors to be used circularly for rows.',
- value_type=attrng.Color(),
+ value_type=attr.Color(),
required=True)
class BlockColBackground(TableStyleCommand):
@@ -365,7 +365,7 @@
class IBlockValign(ITableStyleCommand):
"""Define the vertical alignment of the cells."""
- value = attrng.Choice(
+ value = attr.Choice(
title=u'Vertical Alignment',
description=u'The vertical alignment of the text with the cells.',
choices=interfaces.VALIGN_TEXT_CHOICES,
@@ -385,47 +385,47 @@
class ILineStyle(ITableStyleCommand):
"""Define the border line style of each cell."""
- kind = attrng.Choice(
+ kind = attr.Choice(
title=u'Kind',
description=u'The kind of line actions to be taken.',
choices=('GRID', 'BOX', 'OUTLINE', 'INNERGRID',
'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER'),
required=True)
- thickness = attrng.Measurement(
+ thickness = attr.Measurement(
title=u'Thickness',
description=u'Line Thickness',
default=1,
required=True)
- colorName = attrng.Color(
+ colorName = attr.Color(
title=u'Color',
description=u'The color of the border line.',
default=None,
required=True)
- cap = attrng.Choice(
+ cap = attr.Choice(
title=u'Cap',
description=u'The cap at the end of a border line.',
choices=interfaces.CAP_CHOICES,
default=1,
required=True)
- dash = attrng.Sequence(
+ dash = attr.Sequence(
title=u'Dash-Pattern',
description=u'The dash-pattern of a line.',
- value_type=attrng.Measurement(),
+ value_type=attr.Measurement(),
default=None,
required=False)
- join = attrng.Choice(
+ join = attr.Choice(
title=u'Join',
description=u'The way lines are joined together.',
choices=interfaces.JOIN_CHOICES,
default=1,
required=False)
- count = attrng.Integer(
+ count = attr.Integer(
title=u'Count',
description=(u'Describes whether the line is a single (1) or '
u'double (2) line.'),
@@ -460,12 +460,12 @@
occurence.ZeroOrMore('lineStyle', ILineStyle)
)
- id = attrng.String(
+ id = attr.String(
title=u'Id',
description=u'The name/id of the style.',
required=True)
- keepWithNext = attrng.Boolean(
+ keepWithNext = attr.Boolean(
title=u'Keep with Next',
description=(u'When set, this paragraph will always be in the same '
u'frame as the following flowable.'),
@@ -501,7 +501,7 @@
# Fill style
self.processSubDirectives()
# Add style to the manager
- manager = attrng.getManager(self)
+ manager = attr.getManager(self)
manager.styles[id] = self.style
Modified: z3c.rml/trunk/src/z3c/rml/template.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/template.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/template.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -18,14 +18,14 @@
__docformat__ = "reStructuredText"
import zope.interface
from reportlab import platypus
-from z3c.rml import attrng, directive, interfaces, occurence
+from z3c.rml import attr, directive, interfaces, occurence
from z3c.rml import canvas, flowable, stylesheet
class IStory(flowable.IFlow):
"""The story of the PDF file."""
- firstPageTemplate = attrng.Text(
+ firstPageTemplate = attr.Text(
title=u'First Page Template',
description=u'The first page template to be used.',
default=None,
@@ -52,60 +52,60 @@
class IFrame(interfaces.IRMLDirectiveSignature):
"""A frame on a page."""
- x1 = attrng.Measurement(
+ x1 = attr.Measurement(
title=u'X-Position',
description=u'The X-Position of the lower-left corner of the frame.',
allowPercentage=True,
required=True)
- y1 = attrng.Measurement(
+ y1 = attr.Measurement(
title=u'Y-Position',
description=u'The Y-Position of the lower-left corner of the frame.',
allowPercentage=True,
required=True)
- width = attrng.Measurement(
+ width = attr.Measurement(
title=u'Width',
description=u'The width of the frame.',
allowPercentage=True,
required=True)
- height = attrng.Measurement(
+ height = attr.Measurement(
title=u'Height',
description=u'The height of the frame.',
allowPercentage=True,
required=True)
- id = attrng.Text(
+ id = attr.Text(
title=u'Id',
description=u'The id of the frame.',
required=False)
- leftPadding = attrng.Measurement(
+ leftPadding = attr.Measurement(
title=u'Left Padding',
description=u'The left padding of the frame.',
default=0,
required=False)
- rightPadding = attrng.Measurement(
+ rightPadding = attr.Measurement(
title=u'Right Padding',
description=u'The right padding of the frame.',
default=0,
required=False)
- topPadding = attrng.Measurement(
+ topPadding = attr.Measurement(
title=u'Top Padding',
description=u'The top padding of the frame.',
default=0,
required=False)
- bottomPadding = attrng.Measurement(
+ bottomPadding = attr.Measurement(
title=u'Bottom Padding',
description=u'The bottom padding of the frame.',
default=0,
required=False)
- showBoundary = attrng.Boolean(
+ showBoundary = attr.Boolean(
title=u'Show Boundary',
description=u'A flag to show the boundary of the frame.',
required=False)
@@ -154,17 +154,17 @@
occurence.ZeroOrOne('pageGraphics', IPageGraphics),
)
- id = attrng.Text(
+ id = attr.Text(
title=u'Id',
description=u'The id of the template.',
required=True)
- pagesize = attrng.PageSize(
+ pagesize = attr.PageSize(
title=u'Page Size',
description=u'The Page Size.',
required=False)
- rotation = attrng.Integer(
+ rotation = attr.Integer(
title=u'Rotation',
description=u'The rotation of the page in multiples of 90 degrees.',
required=False)
@@ -200,56 +200,56 @@
occurence.OneOrMore('pagetemplate', IPageTemplate),
)
- pagesize = attrng.PageSize(
+ pagesize = attr.PageSize(
title=u'Page Size',
description=u'The Page Size.',
required=False)
- rotation = attrng.Integer(
+ rotation = attr.Integer(
title=u'Rotation',
description=u'The rotation of the page in multiples of 90 degrees.',
required=False)
- leftMargin = attrng.Measurement(
+ leftMargin = attr.Measurement(
title=u'Left Margin',
description=u'The left margin of the template.',
default=0,
required=False)
- rightMargin = attrng.Measurement(
+ rightMargin = attr.Measurement(
title=u'Right Margin',
description=u'The right margin of the template.',
default=0,
required=False)
- topMargin = attrng.Measurement(
+ topMargin = attr.Measurement(
title=u'Top Margin',
description=u'The top margin of the template.',
default=0,
required=False)
- bottomMargin = attrng.Measurement(
+ bottomMargin = attr.Measurement(
title=u'Bottom Margin',
description=u'The bottom margin of the template.',
default=0,
required=False)
- showBoundary = attrng.Boolean(
+ showBoundary = attr.Boolean(
title=u'Show Boundary',
description=u'A flag to show the boundary of the template.',
required=False)
- allowSplitting = attrng.Boolean(
+ allowSplitting = attr.Boolean(
title=u'Allow Splitting',
description=u'A flag to allow splitting over multiple templates.',
required=False)
- title = attrng.Text(
+ title = attr.Text(
title=u'Title',
description=u'The title of the PDF document.',
required=False)
- author = attrng.Text(
+ author = attr.Text(
title=u'Author',
description=u'The author of the PDF document.',
required=False)
Modified: z3c.rml/trunk/src/z3c/rml/tests/test_rml.py
===================================================================
--- z3c.rml/trunk/src/z3c/rml/tests/test_rml.py 2007-03-28 03:02:22 UTC (rev 73805)
+++ z3c.rml/trunk/src/z3c/rml/tests/test_rml.py 2007-03-28 03:11:03 UTC (rev 73806)
@@ -19,7 +19,7 @@
import unittest
import sys
import z3c.rml.tests
-from z3c.rml import rml2pdf, attrng
+from z3c.rml import rml2pdf, attr
class RMLRenderingTestCase(unittest.TestCase):
@@ -30,17 +30,17 @@
def setUp(self):
# Switch file opener for Image attibute
- self._fileOpen = attrng.File.open
+ self._fileOpen = attr.File.open
def testOpen(img, filename):
path = os.path.join(os.path.dirname(self._inPath), filename)
return open(path)
- attrng.File.open = testOpen
+ attr.File.open = testOpen
import z3c.rml.tests.module
sys.modules['module'] = z3c.rml.tests.module
sys.modules['mymodule'] = z3c.rml.tests.module
def tearDown(self):
- attrng.File.open = self._fileOpen
+ attr.File.open = self._fileOpen
del sys.modules['module']
del sys.modules['mymodule']
More information about the Checkins
mailing list