eric6/UI/BrowserModel.py

branch
maintenance
changeset 8142
43248bafe9b2
parent 8043
0acf98cd089a
parent 8131
f2129bb79269
child 8176
31965986ecd1
equal deleted inserted replaced
8044:874fdd14d3a2 8142:43248bafe9b2
315 """ 315 """
316 if path not in self.watchedItems: 316 if path not in self.watchedItems:
317 # just ignore the situation we don't have a reference to the item 317 # just ignore the situation we don't have a reference to the item
318 return 318 return
319 319
320 if Preferences.getUI("BrowsersListHiddenFiles"): 320 dirFilter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot)
321 dirFilter = QDir.Filters(
322 QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot)
323 else:
324 dirFilter = QDir.Filters(
325 QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
326 321
327 for itm in self.watchedItems[path]: 322 for itm in self.watchedItems[path]:
328 oldCnt = itm.childCount() 323 oldCnt = itm.childCount()
329 324
330 qdir = QDir(itm.dirName()) 325 qdir = QDir(itm.dirName())
550 """ 545 """
551 self._addWatchedItem(parentItem) 546 self._addWatchedItem(parentItem)
552 547
553 qdir = QDir(parentItem.dirName()) 548 qdir = QDir(parentItem.dirName())
554 549
555 if Preferences.getUI("BrowsersListHiddenFiles"): 550 dirFilter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot)
556 dirFilter = QDir.Filters(
557 QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot)
558 else:
559 dirFilter = QDir.Filters(
560 QDir.AllEntries | QDir.NoDot | QDir.NoDotDot)
561 entryInfoList = qdir.entryInfoList(dirFilter) 551 entryInfoList = qdir.entryInfoList(dirFilter)
562 if len(entryInfoList) > 0: 552 if len(entryInfoList) > 0:
563 if repopulate: 553 if repopulate:
564 self.beginInsertRows( 554 self.beginInsertRows(
565 self.createIndex(parentItem.row(), 0, parentItem), 555 self.createIndex(parentItem.row(), 0, parentItem),
629 moduleName = parentItem.moduleName() 619 moduleName = parentItem.moduleName()
630 fileName = parentItem.fileName() 620 fileName = parentItem.fileName()
631 try: 621 try:
632 dictionary = Utilities.ClassBrowsers.readmodule( 622 dictionary = Utilities.ClassBrowsers.readmodule(
633 moduleName, [parentItem.dirName()], 623 moduleName, [parentItem.dirName()],
634 parentItem.isPython3File()) 624 parentItem.isPython3File() or parentItem.isCythonFile())
635 except ImportError: 625 except ImportError:
636 return 626 return
637 627
638 keys = list(dictionary.keys()) 628 keys = list(dictionary.keys())
639 if len(keys) > 0: 629 if len(keys) > 0:
1168 if self.isPython3File(): 1158 if self.isPython3File():
1169 pixName = "filePython" 1159 pixName = "filePython"
1170 self._populated = False 1160 self._populated = False
1171 self._lazyPopulation = True 1161 self._lazyPopulation = True
1172 self._moduleName = os.path.basename(finfo) 1162 self._moduleName = os.path.basename(finfo)
1163 elif self.isCythonFile():
1164 pixName = "lexerCython"
1165 self._populated = False
1166 self._lazyPopulation = True
1167 self._moduleName = os.path.basename(finfo)
1173 elif self.isRubyFile(): 1168 elif self.isRubyFile():
1174 pixName = "fileRuby" 1169 pixName = "fileRuby"
1175 self._populated = False 1170 self._populated = False
1176 self._lazyPopulation = True 1171 self._lazyPopulation = True
1177 self._moduleName = os.path.basename(finfo) 1172 self._moduleName = os.path.basename(finfo)
1278 1273
1279 def isPython3File(self): 1274 def isPython3File(self):
1280 """ 1275 """
1281 Public method to check, if this file is a Python3 script. 1276 Public method to check, if this file is a Python3 script.
1282 1277
1283 @return flag indicating a Python file (boolean) 1278 @return flag indicating a Python3 file
1279 @rtype bool
1284 """ 1280 """
1285 return ( 1281 return (
1286 self.fileext in Preferences.getPython("Python3Extensions") or 1282 self.fileext in Preferences.getPython("Python3Extensions") or
1287 (self.fileext == "" and self.sourceLanguage == "Python3") 1283 (self.fileext == "" and self.sourceLanguage == "Python3")
1288 ) 1284 )
1289 1285
1286 def isCythonFile(self):
1287 """
1288 Public method to check, if this file is a Cython file.
1289
1290 @return flag indicating a Cython file
1291 @rtype bool
1292 """
1293 return (
1294 self.fileext in (".pyx", ".pxd", ".pxi") or
1295 (self.fileext == "" and self.sourceLanguage == "Cython")
1296 )
1297
1290 def isRubyFile(self): 1298 def isRubyFile(self):
1291 """ 1299 """
1292 Public method to check, if this file is a Ruby script. 1300 Public method to check, if this file is a Ruby script.
1293 1301
1294 @return flag indicating a Ruby file (boolean) 1302 @return flag indicating a Ruby file (boolean)
1326 """ 1334 """
1327 Public method to check, if this file is an eric project file. 1335 Public method to check, if this file is an eric project file.
1328 1336
1329 @return flag indicating an eric project file (boolean) 1337 @return flag indicating an eric project file (boolean)
1330 """ 1338 """
1331 return self.fileext in ['.e4p'] 1339 return self.fileext in ('.epj', '.e4p')
1332 1340
1333 def isMultiProjectFile(self): 1341 def isMultiProjectFile(self):
1334 """ 1342 """
1335 Public method to check, if this file is an eric multi project file. 1343 Public method to check, if this file is an eric multi project file.
1336 1344
1337 @return flag indicating an eric project file (boolean) 1345 @return flag indicating an eric project file (boolean)
1338 """ 1346 """
1339 return self.fileext in ['.e4m', '.e5m'] 1347 return self.fileext in ('.emj', '.e4m', '.e5m')
1340 1348
1341 def isIdlFile(self): 1349 def isIdlFile(self):
1342 """ 1350 """
1343 Public method to check, if this file is a CORBA IDL file. 1351 Public method to check, if this file is a CORBA IDL file.
1344 1352

eric ide

mercurial