5 |
5 |
6 """ |
6 """ |
7 Module implementing a file system watcher with a delay. |
7 Module implementing a file system watcher with a delay. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import QFileSystemWatcher, QTimer, pyqtSignal, pyqtSlot |
10 from PyQt6.QtCore import QTimer, pyqtSignal, pyqtSlot |
|
11 |
|
12 from eric7.EricCore.EricFileSystemWatcher import EricFileSystemWatcher |
11 |
13 |
12 |
14 |
13 class DelayedFileWatcher(QFileSystemWatcher): |
15 class DelayedFileWatcher(EricFileSystemWatcher): |
14 """ |
16 """ |
15 Class implementing a file system watcher with a delay. |
17 Class implementing a file system watcher with a delay. |
16 |
18 |
17 @signal delayedDirectoryChanged(path) emitted to indicate a changed |
19 @signal delayedDirectoryChanged(path) emitted to indicate a changed |
18 directory |
20 directory |
29 @param paths list of paths to be watched |
31 @param paths list of paths to be watched |
30 @type list of str |
32 @type list of str |
31 @param parent reference to the parent object |
33 @param parent reference to the parent object |
32 @type QObject |
34 @type QObject |
33 """ |
35 """ |
|
36 super().__init__(parent) |
34 if paths: |
37 if paths: |
35 super().__init__(paths, parent) |
38 self.addPaths(paths) |
36 else: |
|
37 super().__init__(parent) |
|
38 |
39 |
39 self.__dirQueue = [] |
40 self.__dirQueue = [] |
40 self.__fileQueue = [] |
41 self.__fileQueue = [] |
41 |
42 |
42 self.directoryChanged.connect(self.__directoryChanged) |
43 self.directoryChanged.connect(self.__directoryChanged) |