Here's the basic premise of my application:
I've established a QFileSystemWatcher to watch a directory.
Path = [r'C:\Users\user\Documents\Images']
DirectoryWatcher = QtCore.QFileSystemWatcher(Path)
DirectoryWatcher.directoryChanged.connect(showImages.UpdateImages)
I've used QFileSystemWatcher in the past, and it's always worked perfectly (for both directory and file changes).
The application will display a slideshow of the images in the \Images folder. When a new image is placed in the \Images folder, the slideshow is reset to include the new image. If an image is removed from the \Images folder, the slideshow is again reset.
The issue I'm having is this: if I drag multiple images into the \Images folder, the directoryChanged signal is fired multiple times. The signal is fired, and the corresponding UpdateImages() routine is run for each image that's been added to the folder, even when they're added at the same time (i.e. select multiple images, drag and drop them into \Images).
This is playing havoc with my routine. Is there any way to fire a directoryChanged signal once for a batch of directory changes? I.e. can I disable the signal until the final image has been added to the directory?
Many thanks!