Monitoring updating directory for image for GUI
rosuav at gmail.com
Thu Feb 7 07:25:31 CET 2013
On Thu, Feb 7, 2013 at 9:02 AM, <ciscorucinski at gmail.com> wrote:
> Basically I am creating a program that will stream musical notes into a program called Lilypond one-by-one and it will create the sheet music for that stream of music via OS command. Your understanding of Lilypond is not needed, but you need to know that for each new note that is streamed in "real-time", a PNG image file will be created for that stream of music up to that point...via Lilypond.
I'm surprised nobody has yet responded to this. The list's usually a
lot quicker, heh...
Side point: How real-time can you actually run Lilypond? It usually
takes a bit of time to render a sheet of music. But leaving that
> What I am looking at doing is to monitor the directory where the image files are being created in real-time, and update the GUI (build with gtk.Builder and Glade) with the most recent image file. I have the program multithreaded and it appears that all of the images are being created sequentially; however, I need to make sure that an older image (an image with less notes displayed) is NOT going to be displayed over a newer image.
> The question I have is what do you see as the best way of going about this?
Not sure I fully understand the problem here. Tell me if this workflow
* Note comes in
* Lilypond is spawned asynchronously to render the new state
* A new file is created, with a unique name
* Your program shows the latest of these files, no more and no less
Or do you need to sometimes show multiple files?
Can you make use of sequential file naming to ensure that you can
always find the latest file? That way, you just make sure you never
overwrite a displayed image whose name is > than the one you now have.
More information about the Python-list