eric6/QScintilla/MiniEditor.py

changeset 7635
0cdead130a81
parent 7628
f904d0eef264
child 7690
a59680062837
diff -r 8c3d033e5044 -r 0cdead130a81 eric6/QScintilla/MiniEditor.py
--- a/eric6/QScintilla/MiniEditor.py	Sat Jun 20 17:36:20 2020 +0200
+++ b/eric6/QScintilla/MiniEditor.py	Sun Jun 21 18:26:12 2020 +0200
@@ -3034,10 +3034,7 @@
         filename = os.path.basename(filename)
         language = Preferences.getEditorLexerAssoc(filename)
         if language == "Python":
-            if self.__isPy2File():
-                language = "Python2"
-            else:
-                language = "Python3"
+            language = "Python3"
         if language.startswith("Pygments|"):
             pyname = language.split("|", 1)[1]
             language = ""
@@ -3078,39 +3075,7 @@
         
         self.lexer_.setDefaultColor(self.lexer_.color(0))
         self.lexer_.setDefaultPaper(self.lexer_.paper(0))
-        
-    def __isPy2File(self):
-        """
-        Private method to return a flag indicating a Python 2 file.
-        
-        @return flag indicating a Python 2 file (boolean)
-        """
-        if self.filetype in ["Python", "Python2"]:
-            return True
-        
-        if self.filetype == "":
-            line0 = self.__textEdit.text(0)
-            if (
-                line0.startswith("#!") and
-                ("python2" in line0 or
-                 ("python" in line0 and "python3" not in line0))
-            ):
-                return True
-            
-            if self.__curFile is not None:
-                exts = []
-                for ext in Preferences.getDebugger("PythonExtensions").split():
-                    if ext.startswith("."):
-                        exts.append(ext)
-                    else:
-                        exts.append(".{0}".format(ext))
-                
-                ext = os.path.splitext(self.__curFile)[1]
-                if ext in exts:
-                    return True
-        
-        return False
-        
+    
     def __styleNeeded(self, position):
         """
         Private slot to handle the need for more styling.
@@ -3146,8 +3111,7 @@
             supportedLanguages = Lexers.getSupportedLanguages()
             if self.filetype in supportedLanguages:
                 bindName = supportedLanguages[self.filetype][1]
-            elif self.filetype in ["Python", "Python2", "Python3",
-                                   "MicroPython"]:
+            elif self.filetype in ["Python", "Python3", "MicroPython"]:
                 bindName = "dummy.py"
         
         if not bindName and line0.startswith("#!"):
@@ -3155,12 +3119,9 @@
             if "python3" in line0:
                 bindName = "dummy.py"
                 self.filetype = "Python3"
-            elif "python2" in line0:
-                bindName = "dummy.py"
-                self.filetype = "Python2"
             elif "python" in line0:
                 bindName = "dummy.py"
-                self.filetype = "Python2"
+                self.filetype = "Python3"
             elif ("/bash" in line0 or "/sh" in line0):
                 bindName = "dummy.sh"
             elif "ruby" in line0:
@@ -3182,9 +3143,6 @@
                 if mode in ["python3", "pypy3"]:
                     bindName = "dummy.py"
                     self.filetype = "Python3"
-                elif mode in ["python2", "pypy2", "python", "pypy"]:
-                    bindName = "dummy.py"
-                    self.filetype = "Python2"
                 elif mode == "ruby":
                     bindName = "dummy.rb"
                     self.filetype = "Ruby"

eric ide

mercurial