Optimized the Python type detection of the editor to improve Python3 detection. 5_3_x

Tue, 10 Sep 2013 18:50:19 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Sep 2013 18:50:19 +0200
branch
5_3_x
changeset 2901
11fdeb2891a8
parent 2887
9b6d993bf7c2
child 2903
d752d00ed744

Optimized the Python type detection of the editor to improve Python3 detection.
(grafted from 04a13651238eaaef808a6754789f5b6005fce7a8)

QScintilla/Editor.py file | annotate | diff | comparison | revisions
diff -r 9b6d993bf7c2 -r 11fdeb2891a8 QScintilla/Editor.py
--- a/QScintilla/Editor.py	Thu Sep 05 18:11:19 2013 +0200
+++ b/QScintilla/Editor.py	Tue Sep 10 18:50:19 2013 +0200
@@ -1420,10 +1420,10 @@
         if not language:
             ext = os.path.splitext(filename)[1]
             if ext in [".py", ".pyw"]:
-                if self.isPy2File():
+                if self.isPy3File():
+                    language = "Python3"
+                elif self.isPy2File():
                     language = "Python2"
-                elif self.isPy3File():
-                    language = "Python3"
                 else:
                     # default is Python 3
                     language = "Python3"
@@ -1541,10 +1541,10 @@
         filename = os.path.basename(filename)
         apiLanguage = Preferences.getEditorLexerAssoc(filename)
         if apiLanguage == "":
-            if self.isPy2File():
+            if self.isPy3File():
+                apiLanguage = "Python3"
+            elif self.isPy2File():
                 apiLanguage = "Python2"
-            elif self.isPy3File():
-                apiLanguage = "Python3"
             elif self.isRubyFile():
                 apiLanguage = "Ruby"
         
@@ -1668,10 +1668,10 @@
         if not ftype:
             ftype = self.getFileTypeByFlag()
         if not ftype:
-            if self.isPy2File():
+            if self.isPy3File():
+                ftype = "Python3"
+            elif self.isPy2File():
                 ftype = "Python2"
-            elif self.isPy3File():
-                ftype = "Python3"
             elif self.isRubyFile():
                 ftype = "Ruby"
             else:

eric ide

mercurial