I'm currently writing a PyGTK application and I'd like some advice as to the best way to structure my application. Basically the application will read a specific file specification and present it in a GUI for editing.
Currently I have a parser.py which handles all the low level file IO and parsing of the file. I'm displaying the contents of the file in a treeview, which means that I need to use a treestore as my data type.
The problem I've ran into is that I've only thought of two solutions to this problem. The first is that my parser could build a treestore and pass it to my ui class. That requires my parser depending on pygtk, and minimizes the potential reuse for the class. The second would be storing a reference to my ui class in parser, which would also potentially limit the reuse of my parser class as a standalone library.
To condense my question into a short one liner: Is there a way to accomplish my goals in a more pythonic or OO-friendly way?
If looking at my code would help anyone trying to answer my question: https://code.launchpad.net/~blainepace/nbtparser/trunk
Other pythonic suggestions welcome, this is my first python program and I may be stuck in a more C++ style of thinking. I plan on refactoring a lot of it.