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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Sep 2013 18:50:19 +0200
changeset 2900
04a13651238e
parent 2899
88d2458a4739
child 2902
15a5fe0b0a09

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

QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Editor.py	Mon Sep 09 20:04:19 2013 +0200
+++ b/QScintilla/Editor.py	Tue Sep 10 18:50:19 2013 +0200
@@ -1407,10 +1407,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"
@@ -1529,10 +1529,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"
         
@@ -1660,10 +1660,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