rabryan / pysvg Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/pysvg
Automatically exported from code.google.com/p/pysvg
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
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("&", "&")
+ 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
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
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:
Add methods to elements to retrieve the size of each element as a dimension.
Original issue reported on code.google.com by [email protected]
on 7 Dec 2009 at 5:51
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
API should provide for the degree system to be variable 360 degree, 400
degree and pi based)
Original issue reported on code.google.com by [email protected]
on 28 Feb 2010 at 11:55
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
>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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.