PyQt4 - widget signal trouble
joacim at net.homelinux.org
Sun Apr 26 19:30:06 CEST 2009
Den Sun, 26 Apr 2009 14:04:47 +0100, skrev Phil Thompson:
> On Sun, 26 Apr 2009 14:46:14 +0200, Marco Bizzarri
> <marco.bizzarri at gmail.com> wrote:
>> On Sun, Apr 26, 2009 at 12:38 PM, Joacim Thomassen
>> <joacim at net.homelinux.org> wrote:
>>> Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri:
>>> Hello Marco,
>>> python's fcntl() call the regular C fcntl() function and as stated in
>>> manual pages for C fcntl:
>>> ----------- Snippet from fcntl man pages ----------------
>>> File and directory change notification (dnotify)
>>> F_NOTIFY (long)
>>> (Linux 2.4 onwards) Provide notification when the
>>> directory referred to by fd or any of
>>> files that it
>>> contains is changed. The events to
>>> be notified are
>>> specified in arg, which is a bit mask specified by
>>> together zero or more of the following
>>> DN_MODIFY A file was modified (write, pwrite,
>>> truncate, ftruncate).
>>> ------------- End snippet of fcntl man pages -------------------
>>> The fact that my program actually trigger a signal as the monitored
>>> directoy's image.jpg file change confirm that this part of the code do
>>> work. I do get "Change happened!" as i manually do a "cp another.jpg
>>> image.jpg", but this action is first seen after I close my application
>>> window. (I do not get "Change happened!" if I don't do my manual cp
>>> command. :-) )
>>> Personaly I believe this has something to do with the GUI/Qt4 part
>>> have not understood. Something about how a widget repaint itself or
>>> something in that direction.
>>> Best regards,
>> You're right: I've found the following answer googling:
>> indeed, addind a startTimer() to your code, makes it works ;).
> Alternatively, use QFileSystemWatcher instead.
I'll have a look at the QFileSystemWatcher later for a more sound code.
More information about the Python-list