Example #1
0
class IRectangle(IShape):
    """Draws an ellipse on the canvas."""

    width = attr.Measurement(title=u'Width',
                             description=u'The width of the rectangle.',
                             required=True)

    height = attr.Measurement(title=u'Height',
                              description=u'The height of the rectangle.',
                              required=True)

    round = attr.Measurement(title=u'Corner Radius',
                             description=u'The radius of the rounded corners.',
                             required=False)

    href = attr.Text(
        title=u'Link URL',
        description=
        u'When specified, the rectangle becomes a link to that URL.',
        required=False)

    destination = attr.Text(
        title=u'Link Destination',
        description=(u'When specified, the rectangle becomes a link to that '
                     u'destination.'),
        required=False)
Example #2
0
class ILink(interfaces.IRMLDirectiveSignature):
    """Place an internal link around a set of flowables."""

    destination = attr.Text(
        title=u'Destination',
        description=u'The name of the destination to link to.',
        required=False)

    url = attr.Text(title=u'URL',
                    description=u'The URL to link to.',
                    required=False)

    boxStrokeWidth = attr.Measurement(
        title=u'Box Stroke Width',
        description=u'The width of the box border line.',
        required=False)

    boxStrokeDashArray = attr.Sequence(
        title=u'Box Stroke Dash Array',
        description=u'The dash array of the box border line.',
        value_type=attr.Float(),
        required=False)

    boxStrokeColor = attr.Color(
        title=u'Box Stroke Color',
        description=(u'The color in which the box border is drawn.'),
        required=False)
Example #3
0
class ILogConfig(interfaces.IRMLDirectiveSignature):
    """Configure the render logger."""

    level = attr.Choice(title='Level',
                        description='The default log level.',
                        choices=interfaces.LOG_LEVELS,
                        doLower=False,
                        required=False)

    format = attr.Text(title='Format',
                       description='The format of the log messages.',
                       required=False)

    filename = attr.File(
        title='File Name',
        description='The path to the file that is being logged.',
        doNotOpen=True,
        required=True)

    filemode = attr.Choice(title='File Mode',
                           description='The mode to open the file in.',
                           choices={
                               'WRITE': 'w',
                               'APPEND': 'a'
                           },
                           default='a',
                           required=False)

    datefmt = attr.Text(title='Date Format',
                        description='The format of the log message date.',
                        required=False)
Example #4
0
class IDocAssert(interfaces.IRMLDirectiveSignature):
    """Assert a certain condition."""

    cond = attr.Text(title='Condition',
                     description='The condition to be asserted.',
                     required=True)

    format = attr.Text(title='Format',
                       description='The text displayed if assertion fails.',
                       required=False)
Example #5
0
class IDocAssign(interfaces.IRMLDirectiveSignature):
    """Assign a value to the namesapce."""

    var = attr.Text(title='Variable Name',
                    description='The name under which the value is stored.',
                    required=True)

    expr = attr.Text(
        title='Expression',
        description='The expression that creates the value when evaluated.',
        required=True)
Example #6
0
class IName(interfaces.IRMLDirectiveSignature):
    """Defines a name for a string."""

    id = attr.Text(title='Id',
                   description='The id under which the value will be known.',
                   required=True)

    value = attr.Text(
        title='Value',
        description='The text that is displayed if the id is called.',
        required=True)
Example #7
0
class IMinimalListStyle(interfaces.IRMLDirectiveSignature):

    leftIndent = attr.Measurement(
        title='Left Indentation',
        description='General indentation on the left side.',
        required=False)

    rightIndent = attr.Measurement(
        title='Right Indentation',
        description='General indentation on the right side.',
        required=False)

    bulletColor = attr.Color(
        title='Bullet Color',
        description='The color in which the bullet will appear.',
        required=False)

    bulletFontName = attr.Text(
        title='Bullet Font Name',
        description='The font in which the bullet character will be rendered.',
        required=False)

    bulletFontSize = attr.Measurement(
        title='Bullet Font Size',
        description='The font size of the bullet character.',
        required=False)

    bulletOffsetY = attr.Measurement(
        title='Bullet Y-Offset',
        description='The vertical offset of the bullet.',
        required=False)

    bulletDedent = attr.StringOrInt(
        title='Bullet Dedent',
        description='Either pixels of dedent or auto (default).',
        required=False)

    bulletDir = attr.Choice(title='Bullet Layout Direction',
                            description='The layout direction of the bullet.',
                            choices=('ltr', 'rtl'),
                            required=False)

    bulletFormat = attr.Text(
        title='Bullet Format',
        description='A formatting expression for the bullet text.',
        required=False)

    bulletType = attr.Choice(
        title='Bullet Type',
        description='The type of number to display.',
        choices=interfaces.ORDERED_LIST_TYPES + \
                interfaces.UNORDERED_BULLET_VALUES,
        doLower=False,
        required=False)
Example #8
0
class ITemplate(interfaces.IRMLDirectiveSignature):
    """Define a page template."""
    occurence.containing(occurence.OneOrMore('pageTemplate', IPageTemplate), )

    pagesize = attr.PageSize(title=u'Page Size',
                             description=u'The Page Size.',
                             required=False)

    rotation = attr.Integer(
        title=u'Rotation',
        description=u'The rotation of the page in multiples of 90 degrees.',
        required=False)

    leftMargin = attr.Measurement(
        title=u'Left Margin',
        description=u'The left margin of the template.',
        default=0,
        required=False)

    rightMargin = attr.Measurement(
        title=u'Right Margin',
        description=u'The right margin of the template.',
        default=0,
        required=False)

    topMargin = attr.Measurement(
        title=u'Top Margin',
        description=u'The top margin of the template.',
        default=0,
        required=False)

    bottomMargin = attr.Measurement(
        title=u'Bottom Margin',
        description=u'The bottom margin of the template.',
        default=0,
        required=False)

    showBoundary = attr.Boolean(
        title=u'Show Boundary',
        description=u'A flag to show the boundary of the template.',
        required=False)

    allowSplitting = attr.Boolean(
        title=u'Allow Splitting',
        description=u'A flag to allow splitting over multiple templates.',
        required=False)

    title = attr.Text(title=u'Title',
                      description=u'The title of the PDF document.',
                      required=False)

    author = attr.Text(title=u'Author',
                       description=u'The author of the PDF document.',
                       required=False)
Example #9
0
class IDocument(interfaces.IRMLDirectiveSignature):
    occurence.containing(
        occurence.ZeroOrOne('docinit', IDocInit),
        occurence.ZeroOrOne('stylesheet', stylesheet.IStylesheet),
        occurence.ZeroOrOne('template', template.ITemplate),
        occurence.ZeroOrOne('story', template.IStory),
        occurence.ZeroOrOne('pageInfo', canvas.IPageInfo),
        occurence.ZeroOrMore('pageDrawing', canvas.IPageDrawing),
    )

    filename = attr.Text(
        title='File Name',
        description=('The default name of the output file, if no output '
                     'file was provided.'),
        required=True)

    title = attr.Text(
        title='Title',
        description=('The "Title" annotation for the PDF document.'),
        required=False)

    subject = attr.Text(
        title='Subject',
        description=('The "Subject" annotation for the PDF document.'),
        required=False)

    author = attr.Text(
        title='Author',
        description=('The "Author" annotation for the PDF document.'),
        required=False)

    creator = attr.Text(
        title='Creator',
        description=('The "Creator" annotation for the PDF document.'),
        required=False)

    debug = attr.Boolean(title='Debug',
                         description='A flag to activate the debug output.',
                         default=False,
                         required=False)

    compression = attr.BooleanWithDefault(
        title='Compression',
        description=('A flag determining whether page compression should '
                     'be used.'),
        required=False)

    invariant = attr.BooleanWithDefault(
        title='Invariant',
        description=('A flag that determines whether the produced PDF '
                     'should be invariant with respect to the date and '
                     'the exact contents.'),
        required=False)
Example #10
0
class IRegisterCidFont(interfaces.IRMLDirectiveSignature):
    """Register a new CID font given the face name."""

    faceName = attr.Text(
        title='Face Name',
        description=('The name of the face the font uses. The face has to '
                     'be previously registered.'),
        required=True)

    encName = attr.Text(
        title='Encoding Name',
        description=('The name of the encoding to use for the font.'),
        required=False)
Example #11
0
class ITextField(IField):
    """A text field within the PDF"""

    width = attr.Measurement(
        title=u'Width',
        description=u'The width of the text field.',
        required=True)

    height = attr.Measurement(
        title=u'Height',
        description=u'The height of the text field.',
        required=True)

    value = attr.Text(
        title=u'Value',
        description=u'The default text value of the field.',
        required=False)

    maxLength = attr.Integer(
        title=u'Maximum Length',
        description=u'The maximum amount of characters allowed in the field.',
        required=False)

    multiline = attr.Boolean(
        title=u'Multiline',
        description=u'A flag when set allows multiple lines within the field.',
        required=False)
Example #12
0
class IBlockTableStyle(interfaces.IRMLDirectiveSignature):
    """A style defining the look of a table."""
    occurence.containing(
        occurence.ZeroOrMore('blockFont', IBlockFont),
        occurence.ZeroOrMore('blockLeading', IBlockLeading),
        occurence.ZeroOrMore('blockTextColor', IBlockTextColor),
        occurence.ZeroOrMore('blockAlignment', IBlockAlignment),
        occurence.ZeroOrMore('blockLeftPadding', IBlockLeftPadding),
        occurence.ZeroOrMore('blockRightPadding', IBlockRightPadding),
        occurence.ZeroOrMore('blockBottomPadding', IBlockBottomPadding),
        occurence.ZeroOrMore('blockTopPadding', IBlockTopPadding),
        occurence.ZeroOrMore('blockBackground', IBlockBackground),
        occurence.ZeroOrMore('blockRowBackground', IBlockRowBackground),
        occurence.ZeroOrMore('blockColBackground', IBlockColBackground),
        occurence.ZeroOrMore('blockValign', IBlockValign),
        occurence.ZeroOrMore('blockSpan', IBlockSpan),
        occurence.ZeroOrMore('blockNosplit', IBlockNosplit),
        occurence.ZeroOrMore('lineStyle', ILineStyle))

    id = attr.Text(title='Id',
                   description='The name/id of the style.',
                   required=True)

    keepWithNext = attr.Boolean(
        title='Keep with Next',
        description=('When set, this paragraph will always be in the same '
                     'frame as the following flowable.'),
        required=False)
Example #13
0
class IBookmark(interfaces.IRMLDirectiveSignature):
    """
    This creates a bookmark to the current page which can be referred to with
    the given key elsewhere. (Used inside a page drawing.)
    """

    name = attr.Text(title=u'Name',
                     description=u'The name of the bookmark.',
                     required=True)

    fit = attr.Choice(title=u'Fit',
                      description=u'The Fit Type.',
                      choices=('XYZ', 'Fit', 'FitH', 'FitV', 'FitR'),
                      required=False)

    zoom = attr.Float(
        title=u'Zoom',
        description=u'The zoom level when clicking on the bookmark.',
        required=False)

    x = attr.Measurement(title=u'X-Position',
                         description=u'The x-position.',
                         required=False)

    y = attr.Measurement(title=u'Y-Position',
                         description=u'The y-position.',
                         required=False)
Example #14
0
class ILinePlot(IChart):
    """A line plot."""
    occurence.containing(occurence.One('data', IData2D),
                         occurence.ZeroOrOne('lines', ILines),
                         occurence.ZeroOrOne('xValueAxis', IXValueAxis),
                         occurence.ZeroOrOne('yValueAxis', IYValueAxis),
                         occurence.ZeroOrOne('lineLabels', ILineLabels),
                         *IChart.queryTaggedValue('directives', ()))

    reversePlotOrder = attr.Boolean(
        title='Reverse Plot Order',
        description='When true, the coordinate system is reversed.',
        required=False)

    lineLabelNudge = attr.Measurement(
        title='Line Label Nudge',
        description='The distance between the data point and its label.',
        required=False)

    lineLabelFormat = attr.Text(
        title='Line Label Format',
        description='Formatting string for data point labels.',
        required=False)

    joinedLines = attr.Boolean(
        title='Joined Lines',
        description='When true, connect all data points with lines.',
        required=False)

    inFill = attr.Boolean(
        title='Name',
        description=('Flag indicating whether the line plot should be filled, '
                     'in other words converted to an area chart.'),
        required=False)
Example #15
0
class IPreformatted(IMinimalParagraphBase):
    """A preformatted text, similar to the <pre> tag in HTML."""

    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 '
                     u'style.'),
        default=SampleStyleSheet['Code'],
        required=False)

    text = attr.RawXMLContent(
        title=u'Text',
        description=(u'The text that will be layed out.'),
        required=True)

    maxLineLength = attr.Integer(
        title=u'Max Line Length',
        description=(u'The maximum number of characters on one line.'),
        required=False)

    newLineChars = attr.Text(
        title=u'New Line Characters',
        description=u'The characters placed at the beginning of a wrapped line',
        required=False)
Example #16
0
class IKeepInFrame(interfaces.IRMLDirectiveSignature):
    """Ask a flowable to stay within the frame."""

    maxWidth = attr.Measurement(
        title=u'Maximum Width',
        description=u'The maximum width the flowables are allotted.',
        default=None,
        required=False)

    maxHeight = attr.Measurement(
        title=u'Maximum Height',
        description=u'The maximum height the flowables are allotted.',
        default=None,
        required=False)

    mergeSpace = attr.Boolean(
        title=u'Merge Space',
        description=u'A flag to set whether the space should be merged.',
        required=False)

    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 = attr.Text(title=u'Name/Id',
                   description=u'The name/id of the flowable.',
                   required=False)

    frame = attr.StringOrInt(
        title=u'Frame',
        description=u'The frame to which the flowable should be fitted.',
        required=False)
Example #17
0
class ICropMarks(interfaces.IRMLDirectiveSignature):
    """Crop Marks specification"""

    name = attr.Text(title='Name',
                     description='The name of the index.',
                     default='index',
                     required=True)

    borderWidth = attr.Measurement(
        title='Border Width',
        description='The width of the crop mark border.',
        required=False)

    markColor = attr.Color(title='Mark Color',
                           description='The color of the crop marks.',
                           required=False)

    markWidth = attr.Measurement(
        title='Mark Width',
        description='The line width of the actual crop marks.',
        required=False)

    markLength = attr.Measurement(
        title='Mark Length',
        description='The length of the actual crop marks.',
        required=False)

    markLast = attr.Boolean(
        title='Mark Last',
        description='If set, marks are drawn after the content is rendered.',
        required=False)

    bleedWidth = attr.Measurement(title='Bleed Width',
                                  description=('The width of the page bleed.'),
                                  required=False)
Example #18
0
class IValueAxis(IAxis):

    forceZero = attr.Boolean(
        title=u'Force Zero',
        description=u'When set, the range will contain the origin.',
        required=False)

    minimumTickSpacing = attr.Measurement(
        title=u'Minimum Tick Spacing',
        description=u'The minimum distance between ticks.',
        required=False)

    maximumTicks = attr.Integer(
        title=u'Maximum Ticks',
        description=u'The maximum number of ticks to be shown.',
        required=False)

    labelTextFormat = attr.String(
        title=u'Label Text Format',
        description=u'Formatting string for axis labels.',
        required=False)

    labelTextPostFormat = attr.Text(
        title=u'Label Text Post Format',
        description=u'An additional formatting string.',
        required=False)

    labelTextScale = attr.Float(
        title=u'Label Text Scale',
        description=u'The sclaing factor for the label tick values.',
        required=False)

    valueMin = attr.Float(title=u'Minimum Value',
                          description=u'The smallest value on the axis.',
                          required=False)

    valueMax = attr.Float(title=u'Maximum Value',
                          description=u'The largest value on the axis.',
                          required=False)

    valueStep = attr.Float(title=u'Value Step',
                           description=u'The step size between ticks',
                           required=False)

    valueSteps = attr.Sequence(
        title=u'Step Sizes',
        description=u'List of step sizes between ticks.',
        value_type=attr.Float(),
        required=False)

    rangeRound = attr.Choice(
        title=u'Range Round',
        description=u'Method to be used to round the range values.',
        choices=('none', 'both', 'ceiling', 'floor'),
        required=False)

    zrangePref = attr.Float(title=u'Zero Range Preference',
                            description=u'Zero range axis limit preference.',
                            required=False)
Example #19
0
class IAddMapping(interfaces.IRMLDirectiveSignature):
    """Map various styles(bold, italic) of a font name to the actual ps fonts
    used."""

    faceName = attr.Text(title='Name',
                         description=('The name of the font to be mapped'),
                         required=True)

    bold = attr.Integer(title='Bold', description=('Bold'), required=True)

    italic = attr.Integer(title='Italic',
                          description=('Italic'),
                          required=True)

    psName = attr.Text(title='psName',
                       description=('Actual font name mapped'),
                       required=True)
Example #20
0
class IParagraphStyle(IBaseParagraphStyle):
    """Defines a paragraph style and gives it a name."""

    name = attr.Text(title='Name',
                     description='The name of the style.',
                     required=True)

    alias = attr.Text(
        title='Alias',
        description='An alias under which the style will also be known as.',
        required=False)

    parent = attr.Style(
        title='Parent',
        description=('The apragraph style that will be used as a base for '
                     'this one.'),
        required=False)
Example #21
0
class IRegisterFont(interfaces.IRMLDirectiveSignature):
    """Register a new font based on a face and encoding."""

    name = attr.Text(
        title='Name',
        description=('The name under which the font can be used in style '
                     'declarations or other parameters that lookup a font.'),
        required=True)

    faceName = attr.Text(
        title='Face Name',
        description=('The name of the face the font uses. The face has to '
                     'be previously registered.'),
        required=True)

    encName = attr.Text(title='Encoding Name',
                        description=('The name of the encdoing to be used.'),
                        required=True)
Example #22
0
class IStory(flowable.IFlow):
    """The story of the PDF file."""
    occurence.containing(*flowable.IFlow.getTaggedValue('directives'))

    firstPageTemplate = attr.Text(
        title=u'First Page Template',
        description=u'The first page template to be used.',
        default=None,
        required=False)
Example #23
0
class ITableBulkData(interfaces.IRMLDirectiveSignature):
    """Bulk Data allows one to quickly create a table."""

    content = attr.TextNodeSequence(title=u'Content',
                                    description=u'The bulk data.',
                                    splitre=re.compile('\n'),
                                    value_type=attr.Sequence(
                                        splitre=re.compile(','),
                                        value_type=attr.Text()))
Example #24
0
class IPlugInGraphic(interfaces.IRMLDirectiveSignature):
    """Inserts a custom graphic developed in Python."""

    module = attr.Text(
        title='Module',
        description='The Python module in which the flowable is located.',
        required=True)

    function = attr.Text(
        title='Function',
        description=('The name of the factory function within the module '
                     'that returns the custom flowable.'),
        required=True)

    params = attr.TextNode(
        title='Parameters',
        description=('A list of parameters encoded as a long string.'),
        required=False)
Example #25
0
class IFrame(interfaces.IRMLDirectiveSignature):
    """A frame on a page."""

    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 = attr.Measurement(
        title=u'Y-Position',
        description=u'The Y-Position of the lower-left corner of the frame.',
        allowPercentage=True,
        required=True)

    width = attr.Measurement(title=u'Width',
                             description=u'The width of the frame.',
                             allowPercentage=True,
                             required=True)

    height = attr.Measurement(title=u'Height',
                              description=u'The height of the frame.',
                              allowPercentage=True,
                              required=True)

    id = attr.Text(title=u'Id',
                   description=u'The id of the frame.',
                   required=False)

    leftPadding = attr.Measurement(
        title=u'Left Padding',
        description=u'The left padding of the frame.',
        default=0,
        required=False)

    rightPadding = attr.Measurement(
        title=u'Right Padding',
        description=u'The right padding of the frame.',
        default=0,
        required=False)

    topPadding = attr.Measurement(title=u'Top Padding',
                                  description=u'The top padding of the frame.',
                                  default=0,
                                  required=False)

    bottomPadding = attr.Measurement(
        title=u'Bottom Padding',
        description=u'The bottom padding of the frame.',
        default=0,
        required=False)

    showBoundary = attr.Boolean(
        title=u'Show Boundary',
        description=u'A flag to show the boundary of the frame.',
        required=False)
Example #26
0
class IParam(interfaces.IRMLDirectiveSignature):
    """Sets one paramter for the text annotation."""

    name = attr.Text(title='Name',
                     description='The name of the paramter.',
                     required=True)

    value = attr.TextNode(title='Value',
                          description=('The parameter value.'),
                          required=True)
Example #27
0
class IAlias(interfaces.IRMLDirectiveSignature):
    """Defines an alias for a given style."""

    id = attr.Text(title='Id',
                   description='The id as which the style will be known.',
                   required=True)

    value = attr.Style(title='Value',
                       description='The style that is represented.',
                       required=True)
Example #28
0
class IDocPara(interfaces.IRMLDirectiveSignature):
    """Create a paragraph with the value returned from the expression."""

    expr = attr.Text(title='Expression',
                     description='The expression to be executed.',
                     required=True)

    format = attr.Text(
        title='Format',
        description='The format used to render the expression value.',
        required=False)

    style = attr.Style(title='Style',
                       description='The style of the paragraph.',
                       required=False)

    escape = attr.Boolean(
        title='Escape Text',
        description='When set (default) the expression value is escaped.',
        required=False)
Example #29
0
class IDrawAlignedString(IDrawString):
    """Draws a simple string (aligned to the pivot character) onto the canvas
    at the specified location."""

    pivotChar = attr.Text(
        title=u'Text',
        description=(u'The string/text that is put onto the canvas.'),
        min_length=1,
        max_length=1,
        default=u'.',
        required=True)
Example #30
0
class IListStyle(IBaseListStyle):
    """Defines a list style and gives it a name."""

    name = attr.Text(title='Name',
                     description='The name of the style.',
                     required=True)

    parent = attr.Style(
        title='Parent',
        description=('The list style that will be used as a base for '
                     'this one.'),
        required=False)