Plugins/PluginCodeStyleChecker.py

changeset 3558
7f2bc8910d28
parent 3523
8df1ab89e261
child 3591
2f2a4a76dd22
--- a/Plugins/PluginCodeStyleChecker.py	Mon May 05 19:27:30 2014 +0200
+++ b/Plugins/PluginCodeStyleChecker.py	Wed May 07 19:51:24 2014 +0200
@@ -67,12 +67,48 @@
         
         path = os.path.join(
             os.path.dirname(__file__), 'CheckerPlugins', 'CodeStyleChecker')
-        for lang in ['Python2', 'Python3']:
-            self.backgroundService.serviceConnect(
-                'style', lang, path, 'CodeStyleChecker',
-                self.__translateStyleCheck,
-                lambda fx, fn, ver, msg: self.styleChecked.emit(
-                    fn, {}, 0, [[1, 1, '---- ' + msg, False, False]]))
+        self.backgroundService.serviceConnect(
+            'style', 'Python2', path, 'CodeStyleChecker',
+            self.__translateStyleCheck,
+            onErrorCallback=self.serviceErrorPy2)
+        self.backgroundService.serviceConnect(
+            'style', 'Python3', path, 'CodeStyleChecker',
+            self.__translateStyleCheck,
+            onErrorCallback=self.serviceErrorPy3)
+    
+    def __serviceError(self, fn, msg):
+        """
+        Private slot handling service errors.
+        
+        @param fn file name (string)
+        @param msg message text (string)
+        """
+        self.styleChecked.emit(
+            fn, {}, 0, [[1, 1, '---- ' + msg, False, False, False]])
+    
+    def serviceErrorPy2(self, fx, lang, fn, msg):
+        """
+        Public method 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 == 'style' and lang == 'Python2':
+            self.__serviceError(fn, msg)
+    
+    def serviceErrorPy3(self, fx, lang, fn, msg):
+        """
+        Public method 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 == 'style' and lang == 'Python3':
+            self.__serviceError(fn, msg)
 
     def __initialize(self):
         """

eric ide

mercurial