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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 17 Jan 2015 14:20:09 +0100
branch
6_0_x
changeset 4051
5c071e2b8b6f
parent 4047
2416892cb64b
child 4053
f6c63f2b5a1c

Modified code to always associate .py and .pyw with sources for Python2 and Python3 projects.
(grafted from c8594f4f1b71dfc71ab21d75a826d65b73b91556)

Project/Project.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Sat Jan 17 13:16:14 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