The easiest way in the long run is to look at using unittest and mock object to set up some unit tests - you don't have to go the full TDD route, but take it from me, a few well designed tests now will save a lot of pain later. By using unittest and mock objects, you can control how your code interacts with Dia in a deterministic fashion and not have to mess around with manually testing each possible case.
With mock object, you can mock all or just part of an existing Python
object. This blog explains Mock object in detail. To really speed things up, I created a Mock Dia python class which lets you write and test your code without having to start Dia at all. You can find it here if it's something you think might help: https://github.com/chebizarro/dia-test. With unittest and the mock Dia object you should be able to design and code *most* of your project without leaving your preferred IDE. One caveat is that the Dia Mock object is not complete, as I only implemented the functionality that I needed for my project, which seems like it had fairly similar requirements to your own. You can find that project here if you think it might be useful - https://github.com/chebizarro/postdia.
I am trying to use Python scripting in Dia to export a hierarchical diagram in a specific format. I'm new to Python. 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.
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?
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.
Rob
--
Rob Wortham
PhD Student, Department of Computer Science
E: r h wortham bath ac uk
W: www.robwortham.com T:@RobWortham
_______________________________________________
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