65 |
65 |
66 self.backgroundService = e5App().getObject("BackgroundService") |
66 self.backgroundService = e5App().getObject("BackgroundService") |
67 |
67 |
68 path = os.path.join( |
68 path = os.path.join( |
69 os.path.dirname(__file__), 'CheckerPlugins', 'CodeStyleChecker') |
69 os.path.dirname(__file__), 'CheckerPlugins', 'CodeStyleChecker') |
70 for lang in ['Python2', 'Python3']: |
70 self.backgroundService.serviceConnect( |
71 self.backgroundService.serviceConnect( |
71 'style', 'Python2', path, 'CodeStyleChecker', |
72 'style', lang, path, 'CodeStyleChecker', |
72 self.__translateStyleCheck, |
73 self.__translateStyleCheck, |
73 onErrorCallback=self.serviceErrorPy2) |
74 lambda fx, fn, ver, msg: self.styleChecked.emit( |
74 self.backgroundService.serviceConnect( |
75 fn, {}, 0, [[1, 1, '---- ' + msg, False, False]])) |
75 'style', 'Python3', path, 'CodeStyleChecker', |
|
76 self.__translateStyleCheck, |
|
77 onErrorCallback=self.serviceErrorPy3) |
|
78 |
|
79 def __serviceError(self, fn, msg): |
|
80 """ |
|
81 Private slot handling service errors. |
|
82 |
|
83 @param fn file name (string) |
|
84 @param msg message text (string) |
|
85 """ |
|
86 self.styleChecked.emit( |
|
87 fn, {}, 0, [[1, 1, '---- ' + msg, False, False, False]]) |
|
88 |
|
89 def serviceErrorPy2(self, fx, lang, fn, msg): |
|
90 """ |
|
91 Public method handling service errors for Python 2. |
|
92 |
|
93 @param fx service name (string) |
|
94 @param lang language (string) |
|
95 @param fn file name (string) |
|
96 @param msg message text (string) |
|
97 """ |
|
98 if fx == 'style' and lang == 'Python2': |
|
99 self.__serviceError(fn, msg) |
|
100 |
|
101 def serviceErrorPy3(self, fx, lang, fn, msg): |
|
102 """ |
|
103 Public method handling service errors for Python 2. |
|
104 |
|
105 @param fx service name (string) |
|
106 @param lang language (string) |
|
107 @param fn file name (string) |
|
108 @param msg message text (string) |
|
109 """ |
|
110 if fx == 'style' and lang == 'Python3': |
|
111 self.__serviceError(fn, msg) |
76 |
112 |
77 def __initialize(self): |
113 def __initialize(self): |
78 """ |
114 """ |
79 Private slot to (re)initialize the plugin. |
115 Private slot to (re)initialize the plugin. |
80 """ |
116 """ |