src/eric7/Project/ProjectBrowserModel.py

branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
12 import contextlib 12 import contextlib
13 13
14 from PyQt6.QtCore import QDir, QModelIndex, pyqtSignal, QFileSystemWatcher, Qt 14 from PyQt6.QtCore import QDir, QModelIndex, pyqtSignal, QFileSystemWatcher, Qt
15 from PyQt6.QtGui import QColor 15 from PyQt6.QtGui import QColor
16 16
17 from UI.BrowserModel import ( 17 from eric7.UI.BrowserModel import (
18 BrowserModel, 18 BrowserModel,
19 BrowserItem, 19 BrowserItem,
20 BrowserDirectoryItem, 20 BrowserDirectoryItem,
21 BrowserFileItem, 21 BrowserFileItem,
22 ) 22 )
23 23
24 import UI.PixmapCache 24 from eric7.EricGui import EricPixmapCache
25 import Preferences 25 from eric7 import Preferences, Utilities
26 import Utilities 26
27 27 from eric7.Utilities import ModuleParser
28 import Utilities.ModuleParser
29 28
30 ProjectBrowserItemSimpleDirectory = 100 29 ProjectBrowserItemSimpleDirectory = 100
31 ProjectBrowserItemDirectory = 101 30 ProjectBrowserItemDirectory = 101
32 ProjectBrowserItemFile = 102 31 ProjectBrowserItemFile = 102
33 32
134 self._dirName = os.path.dirname(self._dirName) 133 self._dirName = os.path.dirname(self._dirName)
135 134
136 self.type_ = ProjectBrowserItemSimpleDirectory 135 self.type_ = ProjectBrowserItemSimpleDirectory
137 if os.path.lexists(self._dirName) and os.path.islink(self._dirName): 136 if os.path.lexists(self._dirName) and os.path.islink(self._dirName):
138 self.symlink = True 137 self.symlink = True
139 self.icon = UI.PixmapCache.getSymlinkIcon("dirClosed") 138 self.icon = EricPixmapCache.getSymlinkIcon("dirClosed")
140 else: 139 else:
141 self.icon = UI.PixmapCache.getIcon("dirClosed") 140 self.icon = EricPixmapCache.getIcon("dirClosed")
142 141
143 def setName(self, dinfo, full=True): 142 def setName(self, dinfo, full=True):
144 """ 143 """
145 Public method to set the directory name. 144 Public method to set the directory name.
146 145
418 self.rootItem.removeChildren() 417 self.rootItem.removeChildren()
419 self.beginResetModel() 418 self.beginResetModel()
420 self.endResetModel() 419 self.endResetModel()
421 420
422 # reset the module parser cache 421 # reset the module parser cache
423 Utilities.ModuleParser.resetParsedModules() 422 ModuleParser.resetParsedModules()
424 423
425 def projectOpened(self): 424 def projectOpened(self):
426 """ 425 """
427 Public method used to populate the model after a project has been 426 Public method used to populate the model after a project has been
428 opened. 427 opened.
858 if itm.childCount(): 857 if itm.childCount():
859 index = self.createIndex(itm.row(), 0, itm) 858 index = self.createIndex(itm.row(), 0, itm)
860 self.beginRemoveRows(index, 0, itm.childCount() - 1) 859 self.beginRemoveRows(index, 0, itm.childCount() - 1)
861 itm.removeChildren() 860 itm.removeChildren()
862 self.endRemoveRows() 861 self.endRemoveRows()
863 Utilities.ModuleParser.resetParsedModule( 862 ModuleParser.resetParsedModule(os.path.join(self.project.ppath, name))
864 os.path.join(self.project.ppath, name)
865 )
866 863
867 self.populateItem(itm, True) 864 self.populateItem(itm, True)
868 865
869 def projectPropertiesChanged(self): 866 def projectPropertiesChanged(self):
870 """ 867 """

eric ide

mercurial