On Sun, 20 Dec 2015 10:33:53 +0000 Rob Wortham <r.h.wort...@gmail.com> wrote:
> I am trying to use Python scripting in Dia to export a hierarchical > diagram in a specific format. I'm new to Python. IMHO the questions you ask here are Dia interface questions more than Python questions. Although my answers aren't responsive to your exact questions, you might find them helpful. > I see that > codegen.py is almost what I need, so I plan to take that as a > starting point. Because I'm new to Python I'll need to iterate and > learn to get this coded. My Dia has no Python scripting, and I don't know what codegen.py is, but... > > Just a couple of hopefully straightforward questions ... > > 1. Where does print send its data (for debugging)? It does not seem > to send it to the Dia Python console. Where is stdout? If you just zless yourdiagram.dia | yourpgm.py , then stdout will be the terminal unless you redirect the output. > 2. How can I > get Dia to reload the script as I edit it. At the moment changes only > seem to take effect if Dia is stopped and restarted. This becomes a moot question if you run your python program against the Dia diagram file on the command prompt. One more thing. If you put the following line: from lxml import etree near the top of your program, then you have an XML parser with which you can disect any ungzipped XML and have your way with it. You could also use: import xml.etree.ElementTree as ET but in my opinion the former XML parser is more useful than the latter for most work. I know this wasn't responsive to your question, but I hope it helps. SteveT Steve Litt November 2015 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques _______________________________________________ dia-list mailing list dia-list@gnome.org https://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia