a4-dev team mailing list archive
-
a4-dev team
-
Mailing list archive
-
Message #00152
Big News!! Ma è definitiivoooooo!!
ok, scusate il subject un po' stupido,
ma ho trovato questo:
http://code.google.com/p/svgfig/
ed è veramente la soluzione definitiva per A4, se funziona ci risolve già da
solo la metà dei nostri problemi.
In particolare, tratto da questa pagina:
http://code.google.com/p/svgfig/wiki/Version2Announcement
dice:
SVG elements now know how to transform themselves and calculate their bounding
boxes; this functionality is also defined in defaults.py:
e io dico:
uuuoooooooooohhhh!!!!!
nel frattempo ho preparato un pacchettino (brutto e fatto male, ma
sfunzionicchia) qui:
http://debomatic.debian.net/unstable/pool/svgfig_2.0.0alpha2-1/
potete installarlo e poi provare il tutorial che trovare sul sito (con qualche
namespace da cambiare):
In [11]: from svgfig import *
In [12]: s = SVG("rect", x=10, y=10, width=60, height=60)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/gaspa/<ipython console> in <module>()
NameError: name 'SVG' is not defined
In [13]: s = svg.SVG("rect", x=10, y=10, width=60, height=60)
In [14]: print s.xml()
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400" height="400" viewBox="0, 0, 100, 100" font-family="Helvetica,
Arial, FreeSans, Sans, sans, sans-serif" style="font-size:4px; stroke-
width:0.5pt; text-anchor:middle" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
>
<rect x="10" y="10" width="60" height="60" stroke="black" fill="none" />
</svg>
Yeah.
Invece purtroppo non gli piacciono i nostri svg (e non ho ancora capito
perchè):
In [16]:
svg.load('/home/gaspa/Projects/a4/trunk/tests/images/A4_nested_transforms.svg')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/gaspa/<ipython console> in <module>()
/usr/lib/pymodules/python2.6/svgfig/svg.pyc in load(fileName)
642 else:
643 f = file(fileName)
--> 644 return load_stream(f)
645
646 def template(fileName, svg, replaceme="REPLACEME"):
/usr/lib/pymodules/python2.6/svgfig/svg.pyc in load_stream(stream)
731 parser.setFeature(feature_namespaces, 0)
732 parser.setFeature(feature_external_ges, 0)
--> 733 parser.parse(stream)
734 return ch.output
735
/usr/lib/python2.6/xml/sax/expatreader.pyc in parse(self, source)
105 self.reset()
106 self._cont_handler.setDocumentLocator(ExpatLocator(self))
--> 107 xmlreader.IncrementalParser.parse(self, source)
108
109 def prepareParser(self, source):
/usr/lib/python2.6/xml/sax/xmlreader.pyc in parse(self, source)
121 buffer = file.read(self._bufsize)
122 while buffer != "":
--> 123 self.feed(buffer)
124 buffer = file.read(self._bufsize)
125 self.close()
/usr/lib/python2.6/xml/sax/expatreader.pyc in feed(self, data, isFinal)
205 # document. When feeding chunks, they are not normally
final -
206 # except when invoked from close.
--> 207 self._parser.Parse(data, isFinal)
208 except expat.error, e:
209 exc = SAXParseException(expat.ErrorString(e.code), e,
self)
/usr/lib/python2.6/xml/sax/expatreader.pyc in start_element(self, name, attrs)
299 # event handlers
300 def start_element(self, name, attrs):
--> 301 self._cont_handler.startElement(name, AttributesImpl(attrs))
302
303 def end_element(self, name):
/usr/lib/pymodules/python2.6/svgfig/svg.pyc in startElement(self, tag, attrib)
665
666 def startElement(self, tag, attrib):
--> 667 s = SVG(tag)
668 s.attrib = dict(attrib.items())
669 if len(self.stack) > 0:
/usr/lib/pymodules/python2.6/svgfig/svg.pyc in __init__(self, tag,
*signature_attrib, **more_attrib)
59 for name in require:
60 if name not in self.attrib:
---> 61 raise TypeError, "Tag '%s' requires a '%s' attribute" %
(tag, name)
62
63 ### construct trees inline
TypeError: Tag 'rect' requires a 'x' attribute
ma la 'x' c'è... bohhh...
ok, basta, mi ritraggo nei miei meandri (e preparo l'ITP per farlo inserire il
prima possibile in debian/ubuntu) \o/
byebye!
--
-gaspa-
-----------------------------------------------
--------- http://launchpad.net/~gaspa ---------
------- HomePage: gaspa.yattaweb.it --------
Follow ups