src/eric7/Project/ProjectBrowserModel.py

branch
eric7
changeset 10470
cd7bfd539ac9
parent 10439
21c28b0f9e41
child 10491
acabc60b19a2
equal deleted inserted replaced
10469:3b0ba2aba1fb 10470:cd7bfd539ac9
18 from eric7.SystemUtilities import FileSystemUtilities 18 from eric7.SystemUtilities import FileSystemUtilities
19 from eric7.UI.BrowserModel import ( 19 from eric7.UI.BrowserModel import (
20 BrowserDirectoryItem, 20 BrowserDirectoryItem,
21 BrowserFileItem, 21 BrowserFileItem,
22 BrowserItem, 22 BrowserItem,
23 BrowserItemType,
23 BrowserModel, 24 BrowserModel,
24 BrowserSimpleDirectoryItem, 25 BrowserSimpleDirectoryItem,
25 ) 26 )
26 from eric7.Utilities import ModuleParser 27 from eric7.Utilities import ModuleParser
27
28 ProjectBrowserItemSimpleDirectory = 100
29 ProjectBrowserItemDirectory = 101
30 ProjectBrowserItemFile = 102
31 28
32 29
33 class ProjectBrowserItemMixin: 30 class ProjectBrowserItemMixin:
34 """ 31 """
35 Class implementing common methods of project browser items. 32 Class implementing common methods of project browser items.
130 @type str 127 @type str
131 """ 128 """
132 BrowserSimpleDirectoryItem.__init__(self, parent, text, path=path) 129 BrowserSimpleDirectoryItem.__init__(self, parent, text, path=path)
133 ProjectBrowserItemMixin.__init__(self, projectType) 130 ProjectBrowserItemMixin.__init__(self, projectType)
134 131
135 self.type_ = ProjectBrowserItemSimpleDirectory 132 self.type_ = BrowserItemType.PbSimpleDirectory
136 133
137 134
138 class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin): 135 class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin):
139 """ 136 """
140 Class implementing the data structure for project browser directory items. 137 Class implementing the data structure for project browser directory items.
156 @type bool 153 @type bool
157 """ 154 """
158 BrowserDirectoryItem.__init__(self, parent, dinfo, full) 155 BrowserDirectoryItem.__init__(self, parent, dinfo, full)
159 ProjectBrowserItemMixin.__init__(self, projectType, bold) 156 ProjectBrowserItemMixin.__init__(self, projectType, bold)
160 157
161 self.type_ = ProjectBrowserItemDirectory 158 self.type_ = BrowserItemType.PbDirectory
162 159
163 160
164 class ProjectBrowserFileItem(BrowserFileItem, ProjectBrowserItemMixin): 161 class ProjectBrowserFileItem(BrowserFileItem, ProjectBrowserItemMixin):
165 """ 162 """
166 Class implementing the data structure for project browser file items. 163 Class implementing the data structure for project browser file items.
186 @type str 183 @type str
187 """ 184 """
188 BrowserFileItem.__init__(self, parent, finfo, full, sourceLanguage) 185 BrowserFileItem.__init__(self, parent, finfo, full, sourceLanguage)
189 ProjectBrowserItemMixin.__init__(self, projectType, bold) 186 ProjectBrowserItemMixin.__init__(self, projectType, bold)
190 187
191 self.type_ = ProjectBrowserItemFile 188 self.type_ = BrowserItemType.PbFile
192 189
193 190
194 class ProjectBrowserModel(BrowserModel): 191 class ProjectBrowserModel(BrowserModel):
195 """ 192 """
196 Class implementing the project browser model. 193 Class implementing the project browser model.
297 @param parentItem reference to the item to be populated 294 @param parentItem reference to the item to be populated
298 @type BrowserItem 295 @type BrowserItem
299 @param repopulate flag indicating a repopulation 296 @param repopulate flag indicating a repopulation
300 @type bool 297 @type bool
301 """ 298 """
302 if parentItem.type() == ProjectBrowserItemSimpleDirectory: 299 if parentItem.type() == BrowserItemType.PbSimpleDirectory:
303 return # nothing to do 300 return # nothing to do
304 elif parentItem.type() == ProjectBrowserItemDirectory: 301 elif parentItem.type() == BrowserItemType.PbDirectory:
305 self.populateProjectDirectoryItem(parentItem, repopulate) 302 self.populateProjectDirectoryItem(parentItem, repopulate)
306 elif parentItem.type() == ProjectBrowserItemFile: 303 elif parentItem.type() == BrowserItemType.PbFile:
307 self.populateFileItem(parentItem, repopulate) 304 self.populateFileItem(parentItem, repopulate)
308 else: 305 else:
309 BrowserModel.populateItem(self, parentItem, repopulate) 306 BrowserModel.populateItem(self, parentItem, repopulate)
310 307
311 def populateProjectDirectoryItem(self, parentItem, repopulate=False): 308 def populateProjectDirectoryItem(self, parentItem, repopulate=False):

eric ide

mercurial