/usr/share/pyshared/z3c/rml/interfaces.py is in python-z3c.rml 2.0.0-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | ##############################################################################
#
# 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 to PDF Converter Interfaces
"""
__docformat__ = "reStructuredText"
import logging
import reportlab.lib.enums
import zope.interface
import zope.schema
from z3c.rml.occurence import ZeroOrMore, ZeroOrOne, OneOrMore
JOIN_CHOICES = {'round': 1, 'mitered': 0, 'bevelled': 2}
CAP_CHOICES = {'default': 0, 'butt': 0, 'round': 1, 'square': 2}
ALIGN_CHOICES = {
'left': reportlab.lib.enums.TA_LEFT,
'right': reportlab.lib.enums.TA_RIGHT,
'center': reportlab.lib.enums.TA_CENTER,
'centre': reportlab.lib.enums.TA_CENTER,
'justify': reportlab.lib.enums.TA_JUSTIFY}
ALIGN_TEXT_CHOICES = {
'left': 'LEFT', 'right': 'RIGHT', 'center': 'CENTER', 'centre': 'CENTER',
'decimal': 'DECIMAL'}
VALIGN_TEXT_CHOICES = {
'top': 'TOP', 'middle': 'MIDDLE', 'bottom': 'BOTTOM'}
SPLIT_CHOICES = ('splitfirst', 'splitlast')
TEXT_TRANSFORM_CHOICES = ('uppercase', 'lowercase')
LIST_FORMATS = ('I', 'i', '123', 'ABC', 'abc')
ORDERED_LIST_TYPES = ('I', 'i', '1', 'A', 'a')
UNORDERED_BULLET_VALUES = ('circle', 'square', 'disc', 'diamond', 'rarrowhead')
LOG_LEVELS = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL}
class IRML2PDF(zope.interface.Interface):
"""This is the main public API of z3c.rml"""
def parseString(xml):
"""Parse an XML string and convert it to PDF.
The output is a ``StringIO`` object.
"""
def go(xmlInputName, outputFileName=None, outDir=None, dtdDir=None):
"""Convert RML 2 PDF.
The generated file will be located in the ``outDir`` under the name
``outputFileName``.
"""
class IManager(zope.interface.Interface):
"""A manager of all document-global variables."""
names = zope.interface.Attribute("Names dict")
styles = zope.interface.Attribute("Styles dict")
colors = zope.interface.Attribute("Colors dict")
class IPostProcessorManager(zope.interface.Interface):
"""Manages all post processors"""
postProcessors = zope.interface.Attribute(
"List of tuples of the form: (name, processor)")
class ICanvasManager(zope.interface.Interface):
"""A manager for the canvas."""
canvas = zope.interface.Attribute("Canvas")
class IRMLDirectiveSignature(zope.interface.Interface):
"""The attribute and sub-directives signature of the current
RML directive."""
class IRMLDirective(zope.interface.Interface):
"""A directive in RML extracted from an Element Tree element."""
signature = zope.schema.Field(
title=u'Signature',
description=(u'The signature of the RML directive.'),
required=True)
parent = zope.schema.Field(
title=u'Parent RML Element',
description=u'The parent in the RML element hierarchy',
required=True,)
element = zope.schema.Field(
title=u'Element',
description=(u'The Element Tree element from which the data '
u'is retrieved.'),
required=True)
def getAttributeValues(ignore=None, select=None, includeMissing=False):
"""Return a list of name-value-tuples based on the signature.
If ``ignore`` is specified, all attributes are returned except the
ones listed in the argument. The values of the sequence are the
attribute names.
If ``select`` is specified, only attributes listed in the argument are
returned. The values of the sequence are the attribute names.
If ``includeMissing`` is set to true, then even missing attributes are
included in the value list.
"""
def processSubDirectives(self):
"""Process all sub-directives."""
def process(self):
"""Process the directive.
The main task for this method is to interpret the available data and
to make the corresponding calls in the Reportlab document.
This call should also process all sub-directives and process them.
"""
class IDeprecated(zope.interface.Interface):
"""Mark an attribute as being compatible."""
deprecatedName = zope.schema.TextLine(
title=u'Name',
description=u'The name of the original attribute.',
required=True)
deprecatedReason = zope.schema.Text(
title=u'Reason',
description=u'The reason the attribute has been deprecated.',
required=False)
class IDeprecatedDirective(zope.interface.interfaces.IInterface):
"""A directive that is deprecated."""
|