src/eric7/Utilities/ClassBrowsers/__init__.py

branch
eric7
changeset 10060
b946699e9e79
parent 9955
aa02420279fe
child 10180
3a595df36c9a
equal deleted inserted replaced
10059:9e3452188615 10060:b946699e9e79
32 ClassBrowserRegistry = {} 32 ClassBrowserRegistry = {}
33 33
34 PY_SOURCE = 1 34 PY_SOURCE = 1
35 PTL_SOURCE = 128 35 PTL_SOURCE = 128
36 RB_SOURCE = 129 36 RB_SOURCE = 129
37 JS_SOURCE = 130
38 UNKNOWN_SOURCE = 255 37 UNKNOWN_SOURCE = 255
39
40 SUPPORTED_TYPES = [
41 PY_SOURCE,
42 PTL_SOURCE,
43 RB_SOURCE,
44 JS_SOURCE,
45 ]
46 38
47 __extensions = { 39 __extensions = {
48 "Python": [".py", ".pyw", ".ptl"], # currently not used 40 "Python": [".py", ".pyw", ".ptl"], # currently not used
49 "Ruby": [".rb"], 41 "Ruby": [".rb"],
50 "JavaScript": [".js"],
51 } 42 }
52 43
53 44
54 def registerClassBrowser(name, readModuleFunc, scanFunc, iconFunc, extensions): 45 def registerClassBrowser(name, readModuleFunc, scanFunc, iconFunc, extensions):
55 """ 46 """
143 module, path 134 module, path
144 ) 135 )
145 136
146 if ext in __extensions["Ruby"]: 137 if ext in __extensions["Ruby"]:
147 moduleType = "ruby" 138 moduleType = "ruby"
148 elif ext in __extensions["JavaScript"]:
149 moduleType = "javascript"
150 elif ext in Preferences.getPython("Python3Extensions") or isPyFile: 139 elif ext in Preferences.getPython("Python3Extensions") or isPyFile:
151 moduleType = "python" 140 moduleType = "python"
152 else: 141 else:
153 # try Python if it is without extension 142 # try Python if it is without extension
154 moduleType = "python" 143 moduleType = "python"
183 if ext in ClassBrowserRegistry[classBrowserName]["Extensions"]: 172 if ext in ClassBrowserRegistry[classBrowserName]["Extensions"]:
184 return ClassBrowserRegistry[classBrowserName]["Scan"](src, filename, module) 173 return ClassBrowserRegistry[classBrowserName]["Scan"](src, filename, module)
185 174
186 if ext in __extensions["Ruby"]: 175 if ext in __extensions["Ruby"]:
187 moduleType = "ruby" 176 moduleType = "ruby"
188 elif ext in __extensions["JavaScript"]:
189 moduleType = "javascript"
190 elif ext in Preferences.getPython("Python3Extensions") or isPyFile: 177 elif ext in Preferences.getPython("Python3Extensions") or isPyFile:
191 moduleType = "python" 178 moduleType = "python"
192 else: 179 else:
193 # try Python if it is without extension 180 # try Python if it is without extension
194 moduleType = "python" 181 moduleType = "python"
223 """ 210 """
224 ext = os.path.splitext(name)[1].lower() 211 ext = os.path.splitext(name)[1].lower()
225 212
226 if ext in __extensions["Ruby"]: 213 if ext in __extensions["Ruby"]:
227 sourceType = RB_SOURCE 214 sourceType = RB_SOURCE
228 elif ext in __extensions["JavaScript"]:
229 sourceType = JS_SOURCE
230 elif ext == ".ptl": 215 elif ext == ".ptl":
231 sourceType = PTL_SOURCE 216 sourceType = PTL_SOURCE
232 elif ( 217 elif (
233 name.lower().endswith(tuple(Preferences.getPython("Python3Extensions"))) 218 name.lower().endswith(tuple(Preferences.getPython("Python3Extensions")))
234 or isPyFile 219 or isPyFile

eric ide

mercurial