PyQt4 - widget signal trouble

Joacim Thomassen joacim at net.homelinux.org
Sun Apr 26 06:38:39 EDT 2009


Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri:

> Ciao, Joacim.
> 
> Too much since I 'played' with low level calls, so I may be wrong. But
> it seems to me you're opening the image and monitoring for changes the
> directory. Hence the problem. If you read/write a file, I think the
> directory does not result as modified (but you should experiment by
> yourself).
> 
> Regards
> Marco


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



More information about the Python-list mailing list