Okay, here we are, sooner than I expected =)I attached two files to this post and hopefully, I did not edit any other that I forgot to attach.
In pydia-render.c, I added draw_rounded_rect and fill_rounded_rect and declared them at the bottom of the file. I needed that to get pretty clean SVG code that's rendered correctly in Firefox. Before that, other functions like ellipse or arc were used to achieve this and that ended up in strange results.
The other file I added is my diasvgcss.py file. It's based on Hans' diasvg.py with the following modifications:
- scale all coordinates and line widths with 20 (as in the C renderer)- corrected SVG viewBox (width must be width-x, height must be height-x, that thing made me nearly crazy *g*)
- put all objects in group tags - added meta id as group class - added object name as group name- if an item has a meta id, the fill or stroke value is saved in a separate CSS file (<svgname>.css), if not it's saved in the tag itself
I hope that my modifications are useful to someone else than me so that they find their way to the default Dia version. Please be kind if there are any C or Python mistakes, I did not have much contact to either before that ;-)
As I mentioned in an earlier post, I'm using this to extend Concordion tests with diagrams. I'm about to write a blog entry for our company's blog and I'll post the link to it once it's finished.
If anyone's interested in, I could also merge my modifications to the original diasvg.py, except the export of the CSS attributes. I'm always interested in feedback, so if you've got any questions or suggestions, feel free to drop me a line. Let me know what you think about it!
Regards Max Am 25.01.11 21:27, schrieb Max Wahler:
Hi CGodefroy, as Steffen already mentioned, I'm currently also working on customizing the Python SVG exporter. Actually there _is_ a draw_object method! It's in line 50 of the current GIT version. I hope that I'm ready to commit my code for review to this mailing list this week. A few words about what I'm doing: It groups the tags for objects and sets the object's id as class argument. I use this to style the objects afterwards via CSS. Regards Max Am 25.01.2011 15:06, schrieb Cgodefroy:Hello, I would like to customize the Dia SVG export. I need to insert into my SVG document, informations about the objets (like their id). I have found the diasvg.py file which seems to be the simplest way to customize my export. Unfortunately, in this file there is no "draw_object" function. Do you know if there is a simple way to do my export? Has some people insert the draw_object function in the diasvg.py file ? Thanks for your help. Regards CGodefroy_______________________________________________ dia-list mailing list dia-list gnome org http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia
-- All those, who believe in telekinesis, raise my hand.
Attachment:
pydia-render.c
Description: Text document
Attachment:
diasvgcss.py
Description: Text Data