PyQt4 - widget signal trouble

Joacim Thomassen joacim at net.homelinux.org
Sun Apr 26 13:30:06 EDT 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
> the
>>> 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
> the
>>> files that it
>>>                      contains is changed.  The  events  to
>>>  be  notified  are
>>>              specified in arg, which is a bit mask specified by
>>> ORing
>>>                      together zero or more of the following
>>> bits:
>>>
>>>              DN_MODIFY   A file was modified (write, pwrite,
>>> writev,
>>>                                                
>>>       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
>>> that
> I
>>> have not understood. Something about how a widget repaint itself or
>>> something in that direction.
>>>
>>> Best regards,
>>> Joacim
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>>>
>> 
>> You're right: I've found the following answer googling:
>> 
>> http://mail.python.org/pipermail/python-list/2007-February/597617.html
>> 
>> 
>> indeed, addind a startTimer() to your code, makes it works ;).
> 
> Alternatively, use QFileSystemWatcher instead.
> 
> Phil

Thanks Phil,

I'll have a look at the QFileSystemWatcher later for a more sound code.

Joacim



More information about the Python-list mailing list