PDA

View Full Version : QFileSystemWatcher and getting updated timestamps



eradicatore
4th July 2017, 23:51
Hi,
So I started contributing to uPyLoader on github, and I have been fighting with a silly problem for days now. The application has a "compile" button to compile .py files to bytecode .mpy, and a QTreeView using a standard file system model (I think?).

Well, long story short, I've tried lots of different things like repaint, QApplication.processEvents(), and os.remove or os.unlink to remove the file.mpy before the new one is created. I have had certain configurations work, to get the timestamp updated in the QTreeView, but when it works, other things don't work such as selecting the rows in the QTreeView of the .mpy files.

Any ideas on how to get QFileSystemWatcher to just recognize that a file's timestamp has updated and so update the QTreeView.

Justin

high_flyer
10th July 2017, 12:08
and I have been fighting with a silly problem for days now
I could not find in your text what is the actual problem you are having??
To "compile" only the changed files?


Any ideas on how to get QFileSystemWatcher to just recognize that a file's timestamp has updated and so update the QTreeView.
The previous text has nothing to do with this concrete question as far as I can see.
When a file changes ( when a file has been modified, renamed or removed from disk) its time stamp change as well and QFileSystemWatcher does notify you about any of these changes so implicitly, even though it is not notifying you about the change of the timestamp it notifies you about the events that trigger a timestamp change.