/
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
svgwrite
/
/opt/alt/python27/lib/python2.7/site-packages/svgwrite
mkdir
upload
Name
Size
Mode
Actions
data/
-
0755
rm
animate.py
6630
0644
edit
dl
rm
animate.pyc
7791
0644
edit
dl
rm
animate.pyo
7791
0644
edit
dl
rm
base.py
8064
0644
edit
dl
rm
base.pyc
10016
0644
edit
dl
rm
base.pyo
10016
0644
edit
dl
rm
container.py
9022
0644
edit
dl
rm
container.pyc
10945
0644
edit
dl
rm
container.pyo
10945
0644
edit
dl
rm
drawing.py
4344
0644
edit
dl
rm
drawing.pyc
4940
0644
edit
dl
rm
drawing.pyo
4940
0644
edit
dl
rm
elementfactory.py
2199
0644
edit
dl
rm
elementfactory.pyc
2964
0644
edit
dl
rm
elementfactory.pyo
2964
0644
edit
dl
rm
etree.py
1361
0644
edit
dl
rm
etree.pyc
1300
0644
edit
dl
rm
etree.pyo
1300
0644
edit
dl
rm
filters.py
7899
0644
edit
dl
rm
filters.pyc
13655
0644
edit
dl
rm
filters.pyo
13655
0644
edit
dl
rm
gradients.py
4719
0644
edit
dl
rm
gradients.pyc
6030
0644
edit
dl
rm
gradients.pyo
6030
0644
edit
dl
rm
image.py
2445
0644
edit
dl
rm
image.pyc
3021
0644
edit
dl
rm
image.pyo
3021
0644
edit
dl
rm
masking.py
1827
0644
edit
dl
rm
masking.pyc
2293
0644
edit
dl
rm
masking.pyo
2293
0644
edit
dl
rm
mixins.py
10446
0644
edit
dl
rm
mixins.pyc
13041
0644
edit
dl
rm
mixins.pyo
13041
0644
edit
dl
rm
params.py
1880
0644
edit
dl
rm
params.pyc
2791
0644
edit
dl
rm
params.pyo
2791
0644
edit
dl
rm
path.py
3591
0644
edit
dl
rm
path.pyc
3743
0644
edit
dl
rm
path.pyo
3743
0644
edit
dl
rm
pattern.py
1950
0644
edit
dl
rm
pattern.pyc
2347
0644
edit
dl
rm
pattern.pyo
2347
0644
edit
dl
rm
shapes.py
5858
0644
edit
dl
rm
shapes.pyc
6756
0644
edit
dl
rm
shapes.pyo
6756
0644
edit
dl
rm
text.py
8129
0644
edit
dl
rm
text.pyc
9729
0644
edit
dl
rm
text.pyo
9729
0644
edit
dl
rm
utils.py
6218
0644
edit
dl
rm
utils.pyc
7544
0644
edit
dl
rm
utils.pyo
7544
0644
edit
dl
rm
validator2.py
6073
0644
edit
dl
rm
validator2.pyc
7112
0644
edit
dl
rm
validator2.pyo
7112
0644
edit
dl
rm
__init__.py
2449
0644
edit
dl
rm
__init__.pyc
3226
0644
edit
dl
rm
__init__.pyo
3226
0644
edit
dl
rm
Edit:
/opt/alt/python27/lib/python2.7/site-packages/svgwrite/shapes.py
(5858B)
#coding:utf-8 # Author: mozman # Purpose: svg shapes # Created: 08.09.2010 # # Copyright (C) 2010 Manfred Moitzi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from svgwrite.base import BaseElement from svgwrite.mixins import Presentation, Markers, Transform class Line(BaseElement, Transform, Presentation, Markers): """ The **line** element defines a line segment that starts at one point and ends at another. """ elementname = 'line' def __init__(self, start=(0, 0), end=(0, 0), **extra): """ :param 2-tuple start: start point (**x1**, **y1**) :param 2-tuple end: end point (**x2**, **y2**) :param extra: additional SVG attributs as keyword-arguments """ super(Line, self).__init__(**extra) x1, y1 = start x2, y2 = end self['x1'] = x1 self['y1'] = y1 self['x2'] = x2 self['y2'] = y2 class Rect(BaseElement, Transform, Presentation): """ The **rect** element defines a rectangle which is axis-aligned with the current user coordinate system. Rounded rectangles can be achieved by setting appropriate values for attributes **rx** and **ry**. """ elementname = 'rect' def __init__(self, insert=(0, 0), size=(1, 1), rx=None, ry=None, **extra): """ :param 2-tuple insert: insert point (**x**, **y**), left-upper point :param 2-tuple size: (**width**, **height**) :param <length> rx: corner x-radius :param <length> ry: corner y-radius :param extra: additional SVG attributs as keyword-arguments """ super(Rect, self).__init__(**extra) x, y = insert width, height = size self['x'] = x self['y'] = y self['width'] = width self['height'] = height if rx: self['rx'] = rx if ry: self['ry'] = ry class Circle(BaseElement, Transform, Presentation): """ The **circle** element defines a circle based on a center point and a radius. """ elementname = 'circle' def __init__(self, center=(0, 0), r=1, **extra): """ :param 2-tuple center: circle center point (**cx**, **cy**) :param length r: circle-radius **r** :param extra: additional SVG attributs as keyword-arguments """ super(Circle, self).__init__(**extra) cx, cy = center self['cx'] = cx self['cy'] = cy self['r'] = r class Ellipse(BaseElement, Transform, Presentation): """ The **ellipse** element defines an ellipse which is axis-aligned with the current user coordinate system based on a center point and two radii. """ elementname = 'ellipse' def __init__(self, center=(0, 0), r=(1, 1), **extra): """ :param 2-tuple center: ellipse center point (**cx**, **cy**) :param 2-tuple r: ellipse radii (**rx**, **ry**) :param extra: additional SVG attributs as keyword-arguments """ super(Ellipse, self).__init__(**extra) cx, cy = center rx, ry = r self['cx'] = cx self['cy'] = cy self['rx'] = rx self['ry'] = ry class Polyline(BaseElement, Transform, Presentation, Markers): """ The **polyline** element defines a set of connected straight line segments. Typically, **polyline** elements define open shapes. """ elementname = 'polyline' def __init__(self, points=[], **extra): """ :param `iterable` points: `iterable` of points (points are `2-tuples`) :param extra: additional SVG attributs as keyword-arguments """ super(Polyline, self).__init__(**extra) self.points = list(points) if self.debug: for point in self.points: x, y = point self.validator.check_svg_type(x, 'number') self.validator.check_svg_type(y, 'number') def get_xml(self): self.attribs['points'] = self.points_to_string(self.points) return super(Polyline, self).get_xml() def points_to_string(self, points): """ Convert a `list` of points `2-tuples` to a `string` ``'p1x,p1y p2x,p2y ...'``. """ strings = [] for point in points: if len(point) != 2: raise TypeError('got %s values, but expected 2 values.' % len(point)) x, y = point if self.debug: self.validator.check_svg_type(x, 'coordinate') self.validator.check_svg_type(y, 'coordinate') if self.profile == 'tiny': if isinstance(x, float): x = round(x, 4) if isinstance(y, float): y = round(y, 4) point = "%s,%s" % (x, y) strings.append(point) return ' '.join(strings) class Polygon(Polyline): """ The **polygon** element defines a closed shape consisting of a set of connected straight line segments. Same as :class:`~svgwrite.shapes.Polyline` but closed. """ elementname = 'polygon'
Save
cmd:
run