Looking for general advice on complex program

Josh English Joshua.R.English at gmail.com
Fri Jul 15 15:47:55 EDT 2011


Maybe not to the gurus here, but for me, this is a complex problem and I want to make sure I understand the real problem.

All of this is in Python 2.7 and wxPython

I have several XML files on a shared drive.
I have applications on other machines that need to access this XML file.
These applications need to read and write to this file.
These applications need to a) be alerted to a file change, or b) monitor the file for changes and regular intervals.

In my code, I have XManager classes (using a Singleton pattern) that reads each XML file into a tree (using ElementTree). The XManager class can read the file, make changes to the tree, and write the file as needed.

Now I'm expanding to the multiple application level, and I think I understand what I need to do, and I'm unsure about the exact processes.

I've been trying to have the XManagers check periodically if the XML file they monitor has changed. Since I don't want to mess up the GUI with constant hanging, I think I can use the thread or threading modules to create a recurring timed check, and then I need a separate check to see if the file is in use before reading or writing. 

I also need, I think, to have a way to check if the GUI is editing a node before the XManager reads the file, so the thread needs to be interrupted, or paused, because I don't know if threads would stop if a wxDialog is being show modally or not.

So, am I on the right track here? 

josh



More information about the Python-list mailing list