Giter Site home page Giter Site logo

pysvg's Introduction

#pySVG pySVG is a pure Python library to create/load and manipulate SVG documents.

It's main use is to "code" svg images.

pysvg's People

Watchers

James Cloos avatar

Forkers

ver007

pysvg's Issues

pysvg.animate.set hides Python's set keyword

There's no way to access Python's set (or is there?) if your program begins as 
follows:

from pysvg.filter import *
from pysvg.gradient import *
from pysvg.linking import *
from pysvg.script import *
from pysvg.shape import *
from pysvg.structure import *
from pysvg.style import *
from pysvg.text import *
from pysvg.builders import *

The reason is that pysvg.animate.set hides Python's set keyword. Could PySVG 
rename this object to something else?

Original issue reported on code.google.com by [email protected] on 7 Apr 2011 at 1:42

Turtle graphics not flexible enough about style

Style of the pen is set only once during initialization of the Turtle class. 
this keeps people from using the same instance when drawing different objects 
objects with different styles).

Instead of using several instances depending on the style the issue should be 
solved by storing the style information for each polyline seperately.

Original issue reported on code.google.com by [email protected] on 28 Feb 2010 at 11:52

Add functionality for boundaries

Add methods to calculate (and draw) inner and outer boundaries (boxes) for 
elements.

examples: 
-draw the outer bounds of a circle as a dashed rectangle.
-draw the biggest rectangle that could be included in any ellipse.
-


Original issue reported on code.google.com by [email protected] on 7 Dec 2009 at 5:53

Newlines inserted after XML opening tags alter content

What steps will reproduce the problem?
1. Create a text element with xml:space="preserve" attribute (used for 
preformatted monospace text labels).
2. Examine output XML and/or import SVG in eg Inkscape

Example code snippet:

label = text('Hello', 10, 10)
label.setAttribute('xml:space', 'preserve')
label.getXML()

What is the expected output? What do you see instead?

Expected XML is:

<text xml:space="preserve" y="10" x="10"  >Hello</text>\n

Actual XML is:

<text xml:space="preserve" y="10" x="10"  >
Hello</text>\n

The linebreak inserted after the opening text tag affects the displayed 
content. In Inkscape, for example, the label appears 6 characters long instead 
of the intended 5.

What version of the product are you using? On what operating system?

PySVG 0.2.1; Linux Mint

Please provide any additional information below.

Resolved by removing the \n from line 63 of src/pysvg/core.py. So, now the 
content of that line reads:

            xml+=' >'

rather than:

            xml+=' >\n'


Original issue reported on code.google.com by [email protected] on 3 Feb 2015 at 6:42

problems with parsing and saving a file containing unicode and "&"

The patch below is a little hackish but it fixes problems with files containing 
non-ascii chars inside <text>/<tspan> elements

Index: pySVG/src/pysvg/core.py
===================================================================
--- pySVG/src/pysvg/core.py (revision 30)
+++ pySVG/src/pysvg/core.py (working copy)
@@ -6,6 +6,9 @@
 '''
 from attributes import CoreAttrib, ConditionalAttrib, StyleAttrib, GraphicalEventsAttrib, PaintAttrib, OpacityAttrib, GraphicsAttrib, CursorAttrib, FilterAttrib, MaskAttrib, ClipAttrib

+
+import codecs
+
 class BaseElement:
     """
     This is the base class for all svg elements like title etc. It provides common functionality.
@@ -86,16 +89,19 @@
             if value != None:
                 xml+=key+'="'+self.quote_attrib(str(value))+'" '
         if  len(self._subElements)==0: #self._textContent==None and
-            xml+=' />\n'
+            xml+=' />'
         else:
-            xml+=' >\n'
+            xml+=' >'
             #if self._textContent==None:
             for subelement in self._subElements:
-                xml+=str(subelement.getXML())
+                s = subelement.getXML()
+                if type(s) != unicode:
+                    s = str(s)
+                xml+=s
             #else:
             #if self._textContent!=None:
             #    xml+=self._textContent
-            xml+='</'+self._elementName+'>\n'
+            xml+='</'+self._elementName+'>'
         #print xml
         return xml

@@ -137,8 +143,10 @@
         Stores any element in a svg file (including header). 
         Calling this method only makes sense if the root element is an svg elemnt
         """
-        f = open(filename, 'w')
-        f.write(self.wrap_xml(self.getXML(), encoding, standalone))
+        f = codecs.open(filename, 'w', encoding)
+        s = self.wrap_xml(self.getXML(), encoding, standalone)
+        s = s.replace("&", "&amp;")
+        f.write(s)
         f.close()

     def quote_attrib(self, inStr):





Original issue reported on code.google.com by [email protected] on 1 Feb 2012 at 2:35

What license the pysvg uses

>What steps will reproduce the problem?

I can't understand what license pysvg uses.

* Google codes(http://code.google.com/p/pysvg/)
   * 2-clause BSD License

* codeboje.de: http://codeboje.de/pysvg/
   * 3-clause BSD License

* PyPi: http://pypi.python.org/pypi/pysvg
   * BSD and GPL ?
   * License says BSD, but Categories says GPL ...

* Zip archive: http://pypi.python.org/packages/any/p/pysvg/pysvg-0.2.1.zip
   * No information


>What is the expected output? What do you see instead?

Please unify these license notations

Original issue reported on code.google.com by i.tkomiya on 14 Jun 2011 at 9:50

.attributes[ should be ._attributes[ in attributes.py

What steps will reproduce the problem?
1. image.get_xlink_href() on an image object

What is the expected output? What do you see instead?
AttributeError: image instance has no attribute 'attributes'

What version of the product are you using? On what operating system?
trunk, OS X with Python 2.7.2

Please provide any additional information below.
Several of the attribute classes are still using .attributes rather than 
._attributes. I've attached a patch that should fix the issue on trunk.

Original issue reported on code.google.com by [email protected] on 30 Aug 2012 at 6:02

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.