Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'needed,': 0.05; 'command.': 0.09; 'created,': 0.09; 'overwrite': 0.09; 'gui': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'naming': 0.16; 'png': 0.16; 'sequential': 0.16; 'subject:GUI': 0.16; 'subject:image': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'thu,': 0.17; 'appears': 0.18; 'feb': 0.19; 'file.': 0.20; 'bit': 0.21; 'displayed': 0.22; 'header:In-Reply-To:1': 0.25; 'creating': 0.26; 'am,': 0.27; 'older': 0.27; 'question': 0.27; 'newer': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this?': 0.28; 'run': 0.28; 'music.': 0.29; 'surprised': 0.29; 'this.': 0.29; "i'm": 0.29; 'usually': 0.30; 'notes': 0.30; 'file': 0.32; 'real-time': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'monitor': 0.33; 'received:google.com': 0.34; 'doing': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'created': 0.36; 'but': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'sure': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'called': 0.39; 'where': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'side': 0.61; 'latest': 0.61; 'leaving': 0.62; 'more': 0.63; 'show': 0.63; 'music': 0.79; '2013': 0.84; '9:02': 0.84; 'musical': 0.84; 'spawned': 0.84; 'sheet': 0.93; 'have.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=WGHzIn8LhwSWYfGQ7S5ZG4XIrj3K//sAZh87w3ASK1o=; b=hyjBUwk93TH4h2zVnqcfBQdreU4mht76eYjufBgj8kBIisXfi3L1vdryxhr/rpEdYd uD9PjLWSW4Vnm73MT5KbPFnv4gEGhX6yNYXVIHvUihLdKBRDvxFRwXD726//5y9NGrvr XRkR72DzXObk5RHBXTOX+B+pLblAAcf54RB2pbpFGEJl4EHaDf79nNJF+tyjETH3IpGz IU5WKdgYoDmBTdeZApwMVsf37HzNjy2fqCMhfXuCtaMSdxHRyuEb7gwrhGe1AMQLtAnR eADSuyfKtAM51GQkbBtzGKNjOEFrxJg/HT2WTngSXXzutmkDjTaZA0zCBzfll3tZxZ5h E53w== MIME-Version: 1.0 X-Received: by 10.220.156.10 with SMTP id u10mr207590vcw.28.1360218331319; Wed, 06 Feb 2013 22:25:31 -0800 (PST) In-Reply-To: <8a572770-9cc1-4b65-9053-10fd6c2f543b@googlegroups.com> References: <8a572770-9cc1-4b65-9053-10fd6c2f543b@googlegroups.com> Date: Thu, 7 Feb 2013 17:25:31 +1100 Subject: Re: Monitoring updating directory for image for GUI From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360218333 news.xs4all.nl 6882 [2001:888:2000:d::a6]:59397 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38333 On Thu, Feb 7, 2013 at 9:02 AM, wrote: > Basically I am creating a program that will stream musical notes into a p= rogram called Lilypond one-by-one and it will create the sheet music for th= at stream of music via OS command. Your understanding of Lilypond is not ne= eded, 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 tha= t 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 aside. > What I am looking at doing is to monitor the directory where the image fi= les are being created in real-time, and update the GUI (build with gtk.Buil= der and Glade) with the most recent image file. I have the program multithr= eaded 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 thi= s? Not sure I fully understand the problem here. Tell me if this workflow is correct: * 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. ChrisA