eric6/Plugins/PluginTabnanny.py

changeset 7635
0cdead130a81
parent 7360
9190402e4505
child 7637
c878e8255972
--- a/eric6/Plugins/PluginTabnanny.py	Sat Jun 20 17:36:20 2020 +0200
+++ b/eric6/Plugins/PluginTabnanny.py	Sun Jun 21 18:26:12 2020 +0200
@@ -68,11 +68,6 @@
         path = os.path.join(
             os.path.dirname(__file__), 'CheckerPlugins', 'Tabnanny')
         self.backgroundService.serviceConnect(
-            'indent', 'Python2', path, 'Tabnanny',
-            lambda *args: self.indentChecked.emit(*args),
-            onErrorCallback=self.serviceErrorPy2,
-            onBatchDone=self.batchJobDone)
-        self.backgroundService.serviceConnect(
             'indent', 'Python3', path, 'Tabnanny',
             lambda *args: self.indentChecked.emit(*args),
             onErrorCallback=self.serviceErrorPy3,
@@ -90,22 +85,6 @@
         """
         self.error.emit(fn, msg)
     
-    def serviceErrorPy2(self, fx, lang, fn, msg):
-        """
-        Public slot handling service errors for Python 2.
-        
-        @param fx service name (string)
-        @param lang language (string)
-        @param fn file name (string)
-        @param msg message text (string)
-        """
-        if fx in ['indent', 'batch_indent'] and lang == 'Python2':
-            if fx == 'indent':
-                self.__serviceError(fn, msg)
-            else:
-                self.__serviceError(self.tr("Python 2 batch check"), msg)
-                self.batchJobDone(fx, lang)
-    
     def serviceErrorPy3(self, fx, lang, fn, msg):
         """
         Public slot handling service errors for Python 2.
@@ -164,7 +143,7 @@
         """
         if lang is None:
             lang = 'Python{0}'.format(determinePythonVersion(filename, source))
-        if lang not in ['Python2', 'Python3']:
+        if lang != 'Python3':
             return
         
         self.backgroundService.enqueueRequest(
@@ -179,30 +158,27 @@
             containing filename and source (string, string)
         """
         data = {
-            "Python2": [],
             "Python3": [],
         }
         for filename, source in argumentsList:
             lang = 'Python{0}'.format(determinePythonVersion(filename, source))
-            if lang not in ['Python2', 'Python3']:
+            if lang != 'Python3':
                 continue
             else:
                 data[lang].append((filename, source))
         
         self.queuedBatches = []
-        for lang in ['Python2', 'Python3']:
-            if data[lang]:
-                self.queuedBatches.append(lang)
-                self.backgroundService.enqueueRequest('batch_indent', lang, "",
-                                                      data[lang])
-                self.batchesFinished = False
+        if data['Python3']:
+            self.queuedBatches.append('Python3')
+            self.backgroundService.enqueueRequest(
+                'batch_indent', 'Python3', "", data['Python3'])
+            self.batchesFinished = False
     
     def cancelIndentBatchCheck(self):
         """
         Public method to cancel all batch jobs.
         """
-        for lang in ['Python2', 'Python3']:
-            self.backgroundService.requestCancel('batch_style', lang)
+        self.backgroundService.requestCancel('batch_style', 'Python3')
     
     def activate(self):
         """
@@ -292,7 +268,7 @@
         if menuName == "Checks" and self.__projectAct is not None:
             self.__projectAct.setEnabled(
                 e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python", "MicroPython"])
+                ["Python3", "MicroPython"])
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
@@ -305,7 +281,7 @@
         if (
             menuName == "Checks" and
             e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python", "MicroPython"]
+                ["Python3", "MicroPython"]
         ):
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:

eric ide

mercurial