Loading...
Searching...
No Matches
draw.py
Go to the documentation of this file.
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Contributor(s):
#
import sys, os.path
sys.path.append(os.path.dirname(__file__))
from odf.namespaces import DRAWNS, STYLENS, PRESENTATIONNS
from odf.element import Element
def StyleRefElement(stylename=None, classnames=None, **args):
qattrs = {}
if stylename is not None:
f = stylename.getAttrNS(STYLENS, 'family')
if f == 'graphic':
qattrs[(DRAWNS,u'style-name')]= stylename
elif f == 'presentation':
qattrs[(PRESENTATIONNS,u'style-name')]= stylename
else:
raise ValueError( "Style's family must be either 'graphic' or 'presentation'")
if classnames is not None:
f = classnames[0].getAttrNS(STYLENS, 'family')
if f == 'graphic':
qattrs[(DRAWNS,u'class-names')]= classnames
elif f == 'presentation':
qattrs[(PRESENTATIONNS,u'class-names')]= classnames
else:
raise ValueError( "Style's family must be either 'graphic' or 'presentation'")
return Element(qattributes=qattrs, **args)
def DrawElement(name=None, **args):
e = Element(name=name, **args)
if 'displayname' not in args:
e.setAttrNS(DRAWNS,'display-name', name)
return e
# Autogenerated
def A(**args):
args.setdefault('type', 'simple')
return Element(qname = (DRAWNS,'a'), **args)
def Applet(**args):
return Element(qname = (DRAWNS,'applet'), **args)
def AreaCircle(**args):
return Element(qname = (DRAWNS,'area-circle'), **args)
def AreaPolygon(**args):
return Element(qname = (DRAWNS,'area-polygon'), **args)
def AreaRectangle(**args):
return Element(qname = (DRAWNS,'area-rectangle'), **args)
def Caption(**args):
return StyleRefElement(qname = (DRAWNS,'caption'), **args)
def Circle(**args):
return StyleRefElement(qname = (DRAWNS,'circle'), **args)
def Connector(**args):
return StyleRefElement(qname = (DRAWNS,'connector'), **args)
def ContourPath(**args):
return Element(qname = (DRAWNS,'contour-path'), **args)
def ContourPolygon(**args):
return Element(qname = (DRAWNS,'contour-polygon'), **args)
def Control(**args):
return StyleRefElement(qname = (DRAWNS,'control'), **args)
def CustomShape(**args):
return StyleRefElement(qname = (DRAWNS,'custom-shape'), **args)
def Ellipse(**args):
return StyleRefElement(qname = (DRAWNS,'ellipse'), **args)
def EnhancedGeometry(**args):
return Element(qname = (DRAWNS,'enhanced-geometry'), **args)
def Equation(**args):
return Element(qname = (DRAWNS,'equation'), **args)
def FillImage(**args):
args.setdefault('type', 'simple')
return DrawElement(qname = (DRAWNS,'fill-image'), **args)
def FloatingFrame(**args):
args.setdefault('type', 'simple')
return Element(qname = (DRAWNS,'floating-frame'), **args)
def Frame(**args):
return StyleRefElement(qname = (DRAWNS,'frame'), **args)
def G(**args):
return StyleRefElement(qname = (DRAWNS,'g'), **args)
def GluePoint(**args):
return Element(qname = (DRAWNS,'glue-point'), **args)
def Gradient(**args):
return DrawElement(qname = (DRAWNS,'gradient'), **args)
def Handle(**args):
return Element(qname = (DRAWNS,'handle'), **args)
def Hatch(**args):
return DrawElement(qname = (DRAWNS,'hatch'), **args)
def Image(**args):
return Element(qname = (DRAWNS,'image'), **args)
def ImageMap(**args):
return Element(qname = (DRAWNS,'image-map'), **args)
def Layer(**args):
return Element(qname = (DRAWNS,'layer'), **args)
def LayerSet(**args):
return Element(qname = (DRAWNS,'layer-set'), **args)
def Line(**args):
return StyleRefElement(qname = (DRAWNS,'line'), **args)
def Marker(**args):
return DrawElement(qname = (DRAWNS,'marker'), **args)
def Measure(**args):
return StyleRefElement(qname = (DRAWNS,'measure'), **args)
def Object(**args):
return Element(qname = (DRAWNS,'object'), **args)
def ObjectOle(**args):
return Element(qname = (DRAWNS,'object-ole'), **args)
def Opacity(**args):
return DrawElement(qname = (DRAWNS,'opacity'), **args)
def Page(**args):
return Element(qname = (DRAWNS,'page'), **args)
def PageThumbnail(**args):
return StyleRefElement(qname = (DRAWNS,'page-thumbnail'), **args)
def Param(**args):
return Element(qname = (DRAWNS,'param'), **args)
def Path(**args):
return StyleRefElement(qname = (DRAWNS,'path'), **args)
def Plugin(**args):
args.setdefault('type', 'simple')
return Element(qname = (DRAWNS,'plugin'), **args)
def Polygon(**args):
return StyleRefElement(qname = (DRAWNS,'polygon'), **args)
def Polyline(**args):
return StyleRefElement(qname = (DRAWNS,'polyline'), **args)
def Rect(**args):
return StyleRefElement(qname = (DRAWNS,'rect'), **args)
def RegularPolygon(**args):
return StyleRefElement(qname = (DRAWNS,'regular-polygon'), **args)
def StrokeDash(**args):
return DrawElement(qname = (DRAWNS,'stroke-dash'), **args)
def TextBox(**args):
return Element(qname = (DRAWNS,'text-box'), **args)
odf.element.Element
Creates a arbitrary element and is intended to be subclassed not used on its own.
Definition element.py:361
odf.draw.Hatch
Hatch(**args)
Definition draw.py:122
odf.draw.Plugin
Plugin(**args)
Definition draw.py:167
odf.draw.Param
Param(**args)
Definition draw.py:161
odf.draw.Ellipse
Ellipse(**args)
Definition draw.py:90
odf.draw.Equation
Equation(**args)
Definition draw.py:96
odf.draw.Control
Control(**args)
Definition draw.py:84
odf.draw.Measure
Measure(**args)
Definition draw.py:143
odf.draw.FillImage
FillImage(**args)
Definition draw.py:99
odf.draw.ObjectOle
ObjectOle(**args)
Definition draw.py:149
odf.draw.ImageMap
ImageMap(**args)
Definition draw.py:128
odf.draw.Gradient
Gradient(**args)
Definition draw.py:116
odf.draw.Frame
Frame(**args)
Definition draw.py:107
odf.draw.Connector
Connector(**args)
Definition draw.py:75
odf.draw.EnhancedGeometry
EnhancedGeometry(**args)
Definition draw.py:93
odf.draw.ContourPolygon
ContourPolygon(**args)
Definition draw.py:81
odf.draw.AreaCircle
AreaCircle(**args)
Definition draw.py:60
odf.draw.Object
Object(**args)
Definition draw.py:146
odf.draw.StrokeDash
StrokeDash(**args)
Definition draw.py:183
odf.draw.Path
Path(**args)
Definition draw.py:164
odf.draw.RegularPolygon
RegularPolygon(**args)
Definition draw.py:180
odf.draw.Rect
Rect(**args)
Definition draw.py:177
odf.draw.AreaPolygon
AreaPolygon(**args)
Definition draw.py:63
odf.draw.TextBox
TextBox(**args)
Definition draw.py:186
odf.draw.Opacity
Opacity(**args)
Definition draw.py:152
odf.draw.CustomShape
CustomShape(**args)
Definition draw.py:87
odf.draw.ContourPath
ContourPath(**args)
Definition draw.py:78
odf.draw.Image
Image(**args)
Definition draw.py:125
odf.draw.PageThumbnail
PageThumbnail(**args)
Definition draw.py:158
odf.draw.G
G(**args)
Definition draw.py:110
odf.draw.Applet
Applet(**args)
Definition draw.py:57
odf.draw.Circle
Circle(**args)
Definition draw.py:72
odf.draw.Polygon
Polygon(**args)
Definition draw.py:171
odf.draw.Layer
Layer(**args)
Definition draw.py:131
odf.draw.Handle
Handle(**args)
Definition draw.py:119
odf.draw.Marker
Marker(**args)
Definition draw.py:140
odf.draw.A
A(**args)
Definition draw.py:53
odf.draw.Page
Page(**args)
Definition draw.py:155
odf.draw.Line
Line(**args)
Definition draw.py:137
odf.draw.Caption
Caption(**args)
Definition draw.py:69
odf.draw.GluePoint
GluePoint(**args)
Definition draw.py:113
odf.draw.LayerSet
LayerSet(**args)
Definition draw.py:134
odf.draw.AreaRectangle
AreaRectangle(**args)
Definition draw.py:66
odf.draw.FloatingFrame
FloatingFrame(**args)
Definition draw.py:103
odf.draw.Polyline
Polyline(**args)
Definition draw.py:174
odf.element
Definition element.py:1
odf.namespaces
Definition namespaces.py:1