eric6/UI/BrowserModel.py

changeset 7635
0cdead130a81
parent 7581
692838bf5d11
child 7677
d4d33990b355
equal deleted inserted replaced
7634:8c3d033e5044 7635:0cdead130a81
628 moduleName = parentItem.moduleName() 628 moduleName = parentItem.moduleName()
629 fileName = parentItem.fileName() 629 fileName = parentItem.fileName()
630 try: 630 try:
631 dictionary = Utilities.ClassBrowsers.readmodule( 631 dictionary = Utilities.ClassBrowsers.readmodule(
632 moduleName, [parentItem.dirName()], 632 moduleName, [parentItem.dirName()],
633 parentItem.isPython2File() or parentItem.isPython3File()) 633 parentItem.isPython3File())
634 except ImportError: 634 except ImportError:
635 return 635 return
636 636
637 keys = list(dictionary.keys()) 637 keys = list(dictionary.keys())
638 if len(keys) > 0: 638 if len(keys) > 0:
1110 self.sourceLanguage = sourceLanguage 1110 self.sourceLanguage = sourceLanguage
1111 1111
1112 self._moduleName = '' 1112 self._moduleName = ''
1113 1113
1114 pixName = "" 1114 pixName = ""
1115 if self.isPython2File(): 1115 if self.isPython3File():
1116 if self.fileext == '.py':
1117 pixName = "filePython"
1118 else:
1119 pixName = "filePython2"
1120 self._populated = False
1121 self._lazyPopulation = True
1122 self._moduleName = os.path.basename(finfo)
1123 elif self.isPython3File():
1124 pixName = "filePython" 1116 pixName = "filePython"
1125 self._populated = False 1117 self._populated = False
1126 self._lazyPopulation = True 1118 self._lazyPopulation = True
1127 self._moduleName = os.path.basename(finfo) 1119 self._moduleName = os.path.basename(finfo)
1128 elif self.isRubyFile(): 1120 elif self.isRubyFile():
1181 @param full flag indicating full pathname should be displayed (boolean) 1173 @param full flag indicating full pathname should be displayed (boolean)
1182 """ 1174 """
1183 self._filename = os.path.abspath(finfo) 1175 self._filename = os.path.abspath(finfo)
1184 self.itemData[0] = os.path.basename(finfo) 1176 self.itemData[0] = os.path.basename(finfo)
1185 if ( 1177 if (
1186 self.isPython2File() or
1187 self.isPython3File() or 1178 self.isPython3File() or
1188 self.isRubyFile() or 1179 self.isRubyFile() or
1189 self.isIdlFile() or 1180 self.isIdlFile() or
1190 self.isProtobufFile() 1181 self.isProtobufFile()
1191 ): 1182 ):
1229 Public method returning the module name. 1220 Public method returning the module name.
1230 1221
1231 @return module name (string) 1222 @return module name (string)
1232 """ 1223 """
1233 return self._moduleName 1224 return self._moduleName
1234
1235 def isPython2File(self):
1236 """
1237 Public method to check, if this file is a Python script.
1238
1239 @return flag indicating a Python file (boolean)
1240 """
1241 return (
1242 self.fileext in Preferences.getPython("PythonExtensions") or
1243 (self.fileext == "" and
1244 self.sourceLanguage in ["Python", "Python2"])
1245 )
1246 1225
1247 def isPython3File(self): 1226 def isPython3File(self):
1248 """ 1227 """
1249 Public method to check, if this file is a Python3 script. 1228 Public method to check, if this file is a Python3 script.
1250 1229

eric ide

mercurial