eric6/Project/ProjectBrowserModel.py

changeset 7518
6dea4abd3097
parent 7360
9190402e4505
child 7533
88261c96484b
diff -r d6910340b538 -r 6dea4abd3097 eric6/Project/ProjectBrowserModel.py
--- a/eric6/Project/ProjectBrowserModel.py	Fri Apr 10 14:39:13 2020 +0200
+++ b/eric6/Project/ProjectBrowserModel.py	Fri Apr 10 14:48:05 2020 +0200
@@ -244,6 +244,7 @@
         self.project = parent
         
         self.watchedItems = {}
+        self.__watcherActive = True
         self.watcher = QFileSystemWatcher(self)
         self.watcher.directoryChanged.connect(self.directoryChanged)
         
@@ -589,7 +590,7 @@
             return
         
         index = self.createIndex(itm.row(), 0, itm)
-        itm.setName(newFilename)
+        itm.setName(newFilename, full=False)
         self.dataChanged.emit(index, index)
         self.repopulateItem(newFilename)
     
@@ -668,12 +669,27 @@
         
         return index
     
+    def startFileSystemMonitoring(self):
+        """
+        Public method to (re)start monitoring the project file system.
+        """
+        self.__watcherActive = True
+    
+    def stopFileSystemMonitoring(self):
+        """
+        Public method to stop monitoring the project file system.
+        """
+        self.__watcherActive = False
+        
     def directoryChanged(self, path):
         """
         Public slot to handle the directoryChanged signal of the watcher.
         
         @param path path of the directory (string)
         """
+        if not self.__watcherActive:
+            return
+        
         if path not in self.watchedItems:
             # just ignore the situation we don't have a reference to the item
             return

eric ide

mercurial