eric6/Project/ProjectBrowserModel.py

changeset 7518
6dea4abd3097
parent 7360
9190402e4505
child 7533
88261c96484b
equal deleted inserted replaced
7517:d6910340b538 7518:6dea4abd3097
242 242
243 self.progDir = None 243 self.progDir = None
244 self.project = parent 244 self.project = parent
245 245
246 self.watchedItems = {} 246 self.watchedItems = {}
247 self.__watcherActive = True
247 self.watcher = QFileSystemWatcher(self) 248 self.watcher = QFileSystemWatcher(self)
248 self.watcher.directoryChanged.connect(self.directoryChanged) 249 self.watcher.directoryChanged.connect(self.directoryChanged)
249 250
250 self.inRefresh = False 251 self.inRefresh = False
251 252
587 itm = self.findItem(name) 588 itm = self.findItem(name)
588 if itm is None: 589 if itm is None:
589 return 590 return
590 591
591 index = self.createIndex(itm.row(), 0, itm) 592 index = self.createIndex(itm.row(), 0, itm)
592 itm.setName(newFilename) 593 itm.setName(newFilename, full=False)
593 self.dataChanged.emit(index, index) 594 self.dataChanged.emit(index, index)
594 self.repopulateItem(newFilename) 595 self.repopulateItem(newFilename)
595 596
596 def findItem(self, name): 597 def findItem(self, name):
597 """ 598 """
666 olditem = itm 667 olditem = itm
667 index = self.createIndex(olditem.row(), 0, olditem) 668 index = self.createIndex(olditem.row(), 0, olditem)
668 669
669 return index 670 return index
670 671
672 def startFileSystemMonitoring(self):
673 """
674 Public method to (re)start monitoring the project file system.
675 """
676 self.__watcherActive = True
677
678 def stopFileSystemMonitoring(self):
679 """
680 Public method to stop monitoring the project file system.
681 """
682 self.__watcherActive = False
683
671 def directoryChanged(self, path): 684 def directoryChanged(self, path):
672 """ 685 """
673 Public slot to handle the directoryChanged signal of the watcher. 686 Public slot to handle the directoryChanged signal of the watcher.
674 687
675 @param path path of the directory (string) 688 @param path path of the directory (string)
676 """ 689 """
690 if not self.__watcherActive:
691 return
692
677 if path not in self.watchedItems: 693 if path not in self.watchedItems:
678 # just ignore the situation we don't have a reference to the item 694 # just ignore the situation we don't have a reference to the item
679 return 695 return
680 696
681 if Preferences.getUI("BrowsersListHiddenFiles"): 697 if Preferences.getUI("BrowsersListHiddenFiles"):

eric ide

mercurial