Utilities/ClassBrowsers/__init__.py

changeset 2779
4d433896b6d6
parent 2302
f29e9405c851
child 2847
1843ef6e2656
child 2965
d133c7edd88a
--- a/Utilities/ClassBrowsers/__init__.py	Sat Jul 06 18:31:44 2013 +0200
+++ b/Utilities/ClassBrowsers/__init__.py	Tue Jul 09 19:30:56 2013 +0200
@@ -25,13 +25,15 @@
 PTL_SOURCE = 128
 RB_SOURCE = 129
 IDL_SOURCE = 130
+JS_SOURCE = 131
 
-SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE, IDL_SOURCE]
+SUPPORTED_TYPES = [PY_SOURCE, PTL_SOURCE, RB_SOURCE, IDL_SOURCE, JS_SOURCE]
 
 __extensions = {
     "IDL": [".idl"],
     "Python": [".py", ".pyw", ".ptl"],  # currently not used
     "Ruby": [".rb"],
+    "JavaScript": [".js"],
 }
 
 
@@ -56,6 +58,10 @@
         from . import rbclbr
         dict = rbclbr.readmodule_ex(module, path)
         rbclbr._modules.clear()
+    elif ext in __extensions["JavaScript"]:
+        from . import jsclbr
+        dict = jsclbr.readmodule_ex(module, path)
+        jsclbr._modules.clear()
     elif ext in Preferences.getPython("PythonExtensions") or \
          ext in Preferences.getPython("Python3Extensions") or \
          isPyFile:
@@ -102,6 +108,13 @@
                 return (open(pathname), pathname, (ext, 'r', IDL_SOURCE))
         raise ImportError
     
+    elif ext in __extensions["JavaScript"]:
+        for p in path:      # only search in path
+            pathname = os.path.join(p, name)
+            if os.path.exists(pathname):
+                return (open(pathname), pathname, (ext, 'r', JS_SOURCE))
+        raise ImportError
+    
     elif ext == '.ptl':
         for p in path:      # only search in path
             pathname = os.path.join(p, name)

eric ide

mercurial