Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.

Sat, 17 Jan 2015 14:20:09 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 17 Jan 2015 14:20:09 +0100
changeset 4050
c8594f4f1b71
parent 4049
a6b755f2b60f
child 4052
17d8069de085

Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.

Project/Project.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Sat Jan 17 13:20:21 2015 +0100
+++ b/Project/Project.py	Sat Jan 17 14:20:09 2015 +0100
@@ -223,15 +223,26 @@
         @return source extensions (list of string)
         """
         if language == "Python2":
-            return Preferences.getPython("PythonExtensions")
+            extensions = Preferences.getPython("PythonExtensions")
+            # *.py and *.pyw should always be associated with source files
+            for ext in [".py", ".pyw"]:
+                if ext not in extensions:
+                    extensions.append(ext)
+            return extensions
         elif language == "Python3":
-            return Preferences.getPython("Python3Extensions")
+            extensions = Preferences.getPython("Python3Extensions")
+            # *.py and *.pyw should always be associated with source files
+            for ext in [".py", ".pyw"]:
+                if ext not in extensions:
+                    extensions.append(ext)
+            return extensions
         elif language == "Ruby":
             return ['.rb']
         elif language == "JavaScript":
             return ['.js']
         elif language == "Mixed":
             return (Preferences.getPython("Python3Extensions") +
+                    Preferences.getPython("PythonExtensions") +
                     ['.rb', '.js'])
         else:
             return [""]

eric ide

mercurial