Re: DIA export to svg without my extended attributes
- From: Hans Breuer <hans breuer org>
- To: dia-list gnome org
- Subject: Re: DIA export to svg without my extended attributes
- Date: Sat, 10 Jan 2015 15:01:18 +0100
Am 08.01.2015 um 06:58 schrieb Doru Motas:
Of coarse, I tried both. Attached Cairo svg.
With PyDia there are _three_ SVG exporters available with Dia:
1) Cairo SVG: optimized for best visual appearance
2) (Standard) SVG: optimized for diagram exchange
3) "Plain SVG" (diasvg.py): the most hackable SVG exporter with Dia
No results.
Given that your extended attributes have no specified meaning with SVG I
wonder what results you were expecting. The following code snippet pasted
into diasvg.py [1] method draw_object should dump the custom attributes to
an SVG comment (after fixing the indentation):
# dump custom attributes from shapes
ext_attrs_keys = filter (lambda k : string.find (k, "custom:") == 0,
object.properties.keys())
if len(ext_attrs_keys) :
self.f.write('<!-- Custom attributes:\n')
for k in ext_attrs_keys :
self.f.write ("\t%s=%s\n" % (k[7:], str(object.properties[k].value)))
self.f.write('-->\n')
Please note what I want solve:
* to create a diagram using my custom shapes with extended attributes
in Properties
* to export the diagram in whatever format. Using this export file I
need to able to reconstruct the shapes and to exploit their
attributes in my application.
If you are just interested in the text representation export-object.py [2]
might help.
Previously I used svg export from Visio to do this, but I am ready to try
what you propose to me in order to solve my problem.
In DIA Q&A I found a question similar to mine but I didn't understood the
solution:
https://mail.gnome.org/archives/dia-list/2009-February/msg00032.html
In https://mail.gnome.org/archives/dia-list/2009-February/msg00034.html
Steffen gave a brief example to access custom ("extended") properties from
Python. The same thing is used above.
HTH,
Hans
[1] https://git.gnome.org/browse/dia/tree/plug-ins/python/diasvg.py
[2] https://git.gnome.org/browse/dia/tree/plug-ins/python/export-object.py
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it. -- Dilbert
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]