Hi all,
first, I’d like to apologize for a kind of delayed cross-posting; after sending this post to the general python-list I realized, that this problem probably is rather gui-related; i.e. wxPython in my case.
I’d like to ask for suggestions regarding the appropriate structure of the code of my app. It is a gui program (wxPython; wx.aui) displaying several texts simultaneously. The user interface consists of multiple text widgets and control panels for selecting the text parts and synchronising.
Basically the program reads several text files, analyses them, displays them in the text controls and keeps track of some aditional indexing information (used for synchronising the text with each other etc).
What would be an usual way of structuring the code? I tried to separate distinct tasks to classes, but I am not sure, if this is the right way:
Currently I have a TextDB class containing the functions to parse the source text, then it stores the resulting fulltext and the indexing data; it also contains lookup methods for the text properties and also a display method (expecting a gui widget to write into). There is one instance of this class associated with each text.
Further there is an instance of a gui class (subclassing the wx.Panel - TextCtrl and some basic controls) for each text; besides this there are also panels with specific settings/selections of the individual texts. All this is managed in a frame using wx.aui.AuiManager (the panes can be moved or hidden, but in general, there might be over a dozen of panels used simultaneously on the screen).
Now, what would be a standard approach to let the single instances comunicate with each other? Is it usual, that the “data” instances are created by the gui instances (or the main program class)? Or would it be better to create an extra “dispatcher” class communicating with the others?
(in this app e.g. the user can select some text-property in the control panel, this value is then checked in the respective TextDB instance; finally the matching text part is shown in the text widget.)
Unfortunately, I couldn’t find many relevant code examples or general informations; actualy many tutorial etc. gui programs often have rather few classes, sometimes the only one.
Any suggestions, or references to some examples, concepts … are much appreciated;
thanks in advance;
Vlasta