PyLintInterface/PyLintConfigDialog.py

branch
eric7
changeset 107
3bd2806a6ada
parent 102
e40ecfd9ec37
child 108
b452f300e6c7
equal deleted inserted replaced
106:40db039eb51f 107:3bd2806a6ada
24 24
25 class PyLintConfigDialog(QDialog, Ui_PyLintConfigDialog): 25 class PyLintConfigDialog(QDialog, Ui_PyLintConfigDialog):
26 """ 26 """
27 Class implementing a dialog to configure the PyLint process. 27 Class implementing a dialog to configure the PyLint process.
28 """ 28 """
29
29 def __init__(self, ppath, exe, parms, version): 30 def __init__(self, ppath, exe, parms, version):
30 """ 31 """
31 Constructor 32 Constructor
32 33
33 @param ppath project path; used to set the default path for the 34 @param ppath project path; used to set the default path for the
34 rcfile picker 35 rcfile picker
35 @type str 36 @type str
36 @param exe name of the pylint executable 37 @param exe name of the pylint executable
37 @type str 38 @type str
40 @param version pylint version (unused) 41 @param version pylint version (unused)
41 @type str 42 @type str
42 """ 43 """
43 super().__init__(None) 44 super().__init__(None)
44 self.setupUi(self) 45 self.setupUi(self)
45 46
46 self.__version = version 47 self.__version = version
47 self.__pylintProc = None 48 self.__pylintProc = None
48 self.__lint = exe 49 self.__lint = exe
49 50
50 self.__initializeDefaults() 51 self.__initializeDefaults()
51 52
52 # get a copy of the defaults to store the user settings 53 # get a copy of the defaults to store the user settings
53 self.parameters = copy.deepcopy(self.defaults) 54 self.parameters = copy.deepcopy(self.defaults)
54 55
55 # combine it with the values of parms 56 # combine it with the values of parms
56 if parms is not None: 57 if parms is not None:
57 self.parameters.update(parms) 58 self.parameters.update(parms)
58 59
59 self.configfilePicker.setWindowTitle( 60 self.configfilePicker.setWindowTitle(self.tr("Select configuration file"))
60 self.tr("Select configuration file"))
61 self.configfilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 61 self.configfilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
62 self.configfilePicker.setFilters(self.tr( 62 self.configfilePicker.setFilters(
63 "Configuration Files (*.cfg *.cnf *.rc);;" 63 self.tr("Configuration Files (*.cfg *.cnf *.rc);;" "All Files (*)")
64 "All Files (*)" 64 )
65 ))
66 self.configfilePicker.setDefaultDirectory(ppath) 65 self.configfilePicker.setDefaultDirectory(ppath)
67 66
68 self.reportfilePicker.setWindowTitle( 67 self.reportfilePicker.setWindowTitle(self.tr("Select report file"))
69 self.tr("Select report file"))
70 self.reportfilePicker.setMode(EricPathPickerModes.SAVE_FILE_MODE) 68 self.reportfilePicker.setMode(EricPathPickerModes.SAVE_FILE_MODE)
71 self.reportfilePicker.setFilters(self.tr( 69 self.reportfilePicker.setFilters(
72 "HTML Files (*.html);;" 70 self.tr(
73 "Report Files (*.rpt);;" 71 "HTML Files (*.html);;"
74 "Text Files (*.txt);;" 72 "Report Files (*.rpt);;"
75 "All Files (*)" 73 "Text Files (*.txt);;"
76 )) 74 "All Files (*)"
77 75 )
76 )
77
78 # initialize general tab 78 # initialize general tab
79 self.configfilePicker.setText(self.parameters['configFile']) 79 self.configfilePicker.setText(self.parameters["configFile"])
80 self.txtOutputButton.setChecked(self.parameters['txtReport']) 80 self.txtOutputButton.setChecked(self.parameters["txtReport"])
81 self.htmlOutputButton.setChecked(self.parameters['htmlReport']) 81 self.htmlOutputButton.setChecked(self.parameters["htmlReport"])
82 self.dialogOutputButton.setChecked(self.parameters['dialogReport']) 82 self.dialogOutputButton.setChecked(self.parameters["dialogReport"])
83 self.reportfilePicker.setText(self.parameters['reportFile']) 83 self.reportfilePicker.setText(self.parameters["reportFile"])
84 84
85 # initialize checkers tab 85 # initialize checkers tab
86 self.basicCheckBox.setChecked(self.parameters['enableBasic']) 86 self.basicCheckBox.setChecked(self.parameters["enableBasic"])
87 self.classesCheckBox.setChecked(self.parameters['enableClasses']) 87 self.classesCheckBox.setChecked(self.parameters["enableClasses"])
88 self.designCheckBox.setChecked(self.parameters['enableDesign']) 88 self.designCheckBox.setChecked(self.parameters["enableDesign"])
89 self.exceptionsCheckBox.setChecked(self.parameters['enableExceptions']) 89 self.exceptionsCheckBox.setChecked(self.parameters["enableExceptions"])
90 self.formatCheckBox.setChecked(self.parameters['enableFormat']) 90 self.formatCheckBox.setChecked(self.parameters["enableFormat"])
91 self.importsCheckBox.setChecked(self.parameters['enableImports']) 91 self.importsCheckBox.setChecked(self.parameters["enableImports"])
92 self.metricsCheckBox.setChecked(self.parameters['enableMetrics']) 92 self.metricsCheckBox.setChecked(self.parameters["enableMetrics"])
93 self.miscellaneousCheckBox.setChecked( 93 self.miscellaneousCheckBox.setChecked(self.parameters["enableMiscellaneous"])
94 self.parameters['enableMiscellaneous']) 94 self.newstyleCheckBox.setChecked(self.parameters["enableNewstyle"])
95 self.newstyleCheckBox.setChecked(self.parameters['enableNewstyle']) 95 self.similaritiesCheckBox.setChecked(self.parameters["enableSimilarities"])
96 self.similaritiesCheckBox.setChecked( 96 self.typecheckCheckBox.setChecked(self.parameters["enableTypecheck"])
97 self.parameters['enableSimilarities']) 97 self.variablesCheckBox.setChecked(self.parameters["enableVariables"])
98 self.typecheckCheckBox.setChecked(self.parameters['enableTypecheck']) 98 self.loggingCheckBox.setChecked(self.parameters["enableLogging"])
99 self.variablesCheckBox.setChecked(self.parameters['enableVariables']) 99 self.stringFormatCheckBox.setChecked(self.parameters["enableStringFormat"])
100 self.loggingCheckBox.setChecked(self.parameters['enableLogging']) 100
101 self.stringFormatCheckBox.setChecked(
102 self.parameters['enableStringFormat'])
103
104 # initialize messages tab 101 # initialize messages tab
105 self.enabledMessagesEdit.setText(self.parameters['enabledMessages']) 102 self.enabledMessagesEdit.setText(self.parameters["enabledMessages"])
106 self.disabledMessagesEdit.setText(self.parameters['disabledMessages']) 103 self.disabledMessagesEdit.setText(self.parameters["disabledMessages"])
107 104
108 def __initializeDefaults(self): 105 def __initializeDefaults(self):
109 """ 106 """
110 Private method to set the default values. 107 Private method to set the default values.
111 108
112 These are needed later on to generate the commandline 109 These are needed later on to generate the commandline
113 parameters. 110 parameters.
114 """ 111 """
115 self.defaults = { 112 self.defaults = {
116 # general options 113 # general options
117 'configFile': '', 114 "configFile": "",
118 'reportFile': '', 115 "reportFile": "",
119 'txtReport': False, 116 "txtReport": False,
120 'htmlReport': True, 117 "htmlReport": True,
121 'dialogReport': False, 118 "dialogReport": False,
122
123 # enabled checkers 119 # enabled checkers
124 'enableBasic': True, 120 "enableBasic": True,
125 'enableClasses': True, 121 "enableClasses": True,
126 'enableDesign': True, 122 "enableDesign": True,
127 'enableExceptions': True, 123 "enableExceptions": True,
128 'enableFormat': False, 124 "enableFormat": False,
129 'enableImports': False, 125 "enableImports": False,
130 'enableLogging': True, 126 "enableLogging": True,
131 'enableMetrics': True, 127 "enableMetrics": True,
132 'enableMiscellaneous': True, 128 "enableMiscellaneous": True,
133 'enableNewstyle': True, 129 "enableNewstyle": True,
134 'enableSimilarities': True, 130 "enableSimilarities": True,
135 'enableStringFormat': True, 131 "enableStringFormat": True,
136 'enableTypecheck': True, 132 "enableTypecheck": True,
137 'enableVariables': True, 133 "enableVariables": True,
138
139 # messages 134 # messages
140 'enabledMessages': '', 135 "enabledMessages": "",
141 'disabledMessages': '', 136 "disabledMessages": "",
142 } 137 }
143 138
144 def generateParameters(self): 139 def generateParameters(self):
145 """ 140 """
146 Public method that generates the commandline parameters. 141 Public method that generates the commandline parameters.
147 142
148 It generates a list of strings to be used 143 It generates a list of strings to be used
149 to set the QProcess arguments for the pylint call and 144 to set the QProcess arguments for the pylint call and
150 a list containing the non default parameters. The second 145 a list containing the non default parameters. The second
151 list can be passed back upon object generation to overwrite 146 list can be passed back upon object generation to overwrite
152 the default settings. 147 the default settings.
153 148
154 <b>Note</b>: The arguments list contains the name of the pylint 149 <b>Note</b>: The arguments list contains the name of the pylint
155 executable as the first parameter. 150 executable as the first parameter.
156 151
157 @return a tuple of the commandline parameters and non default 152 @return a tuple of the commandline parameters and non default
158 parameters 153 parameters
159 @rtype tuple of (list of str, dict) 154 @rtype tuple of (list of str, dict)
160 """ 155 """
161 parms = {} 156 parms = {}
162 args = [] 157 args = []
163 158
164 # 1. the program name 159 # 1. the program name
165 args.append(self.__lint) 160 args.append(self.__lint)
166 161
167 # 2. the commandline options 162 # 2. the commandline options
168 # 2.1 general options 163 # 2.1 general options
169 if self.parameters['configFile'] != self.defaults['configFile']: 164 if self.parameters["configFile"] != self.defaults["configFile"]:
170 parms['configFile'] = self.parameters['configFile'] 165 parms["configFile"] = self.parameters["configFile"]
171 args.append('--rcfile={0}'.format(self.parameters['configFile'])) 166 args.append("--rcfile={0}".format(self.parameters["configFile"]))
172 parms['txtReport'] = self.parameters['txtReport'] 167 parms["txtReport"] = self.parameters["txtReport"]
173 parms['htmlReport'] = self.parameters['htmlReport'] 168 parms["htmlReport"] = self.parameters["htmlReport"]
174 parms['dialogReport'] = self.parameters['dialogReport'] 169 parms["dialogReport"] = self.parameters["dialogReport"]
175 if self.parameters['htmlReport']: 170 if self.parameters["htmlReport"]:
176 args.append('--output-format=html') 171 args.append("--output-format=html")
177 elif self.parameters['dialogReport']: 172 elif self.parameters["dialogReport"]:
178 args.append('--output-format=parseable') 173 args.append("--output-format=parseable")
179 args.append('--reports=n') 174 args.append("--reports=n")
180 else: 175 else:
181 args.append('--output-format=text') 176 args.append("--output-format=text")
182 if self.parameters['reportFile'] != self.defaults['reportFile']: 177 if self.parameters["reportFile"] != self.defaults["reportFile"]:
183 parms['reportFile'] = self.parameters['reportFile'] 178 parms["reportFile"] = self.parameters["reportFile"]
184 179
185 # 2.2 checkers options 180 # 2.2 checkers options
186 parms['enableBasic'] = self.parameters['enableBasic'] 181 parms["enableBasic"] = self.parameters["enableBasic"]
187 parms['enableClasses'] = self.parameters['enableClasses'] 182 parms["enableClasses"] = self.parameters["enableClasses"]
188 parms['enableDesign'] = self.parameters['enableDesign'] 183 parms["enableDesign"] = self.parameters["enableDesign"]
189 parms['enableExceptions'] = self.parameters['enableExceptions'] 184 parms["enableExceptions"] = self.parameters["enableExceptions"]
190 parms['enableFormat'] = self.parameters['enableFormat'] 185 parms["enableFormat"] = self.parameters["enableFormat"]
191 parms['enableImports'] = self.parameters['enableImports'] 186 parms["enableImports"] = self.parameters["enableImports"]
192 parms['enableMetrics'] = self.parameters['enableMetrics'] 187 parms["enableMetrics"] = self.parameters["enableMetrics"]
193 parms['enableMiscellaneous'] = self.parameters['enableMiscellaneous'] 188 parms["enableMiscellaneous"] = self.parameters["enableMiscellaneous"]
194 parms['enableNewstyle'] = self.parameters['enableNewstyle'] 189 parms["enableNewstyle"] = self.parameters["enableNewstyle"]
195 parms['enableSimilarities'] = self.parameters['enableSimilarities'] 190 parms["enableSimilarities"] = self.parameters["enableSimilarities"]
196 parms['enableTypecheck'] = self.parameters['enableTypecheck'] 191 parms["enableTypecheck"] = self.parameters["enableTypecheck"]
197 parms['enableVariables'] = self.parameters['enableVariables'] 192 parms["enableVariables"] = self.parameters["enableVariables"]
198 parms['enableLogging'] = self.parameters['enableLogging'] 193 parms["enableLogging"] = self.parameters["enableLogging"]
199 parms['enableStringFormat'] = self.parameters['enableStringFormat'] 194 parms["enableStringFormat"] = self.parameters["enableStringFormat"]
200 195
201 checkers = [] 196 checkers = []
202 if self.parameters['enableBasic']: 197 if self.parameters["enableBasic"]:
203 checkers.append('basic') 198 checkers.append("basic")
204 if self.parameters['enableClasses']: 199 if self.parameters["enableClasses"]:
205 checkers.append('classes') 200 checkers.append("classes")
206 if self.parameters['enableDesign']: 201 if self.parameters["enableDesign"]:
207 checkers.append('design') 202 checkers.append("design")
208 if self.parameters['enableExceptions']: 203 if self.parameters["enableExceptions"]:
209 checkers.append('exceptions') 204 checkers.append("exceptions")
210 if self.parameters['enableFormat']: 205 if self.parameters["enableFormat"]:
211 checkers.append('format') 206 checkers.append("format")
212 if self.parameters['enableImports']: 207 if self.parameters["enableImports"]:
213 checkers.append('imports') 208 checkers.append("imports")
214 if self.parameters['enableMetrics']: 209 if self.parameters["enableMetrics"]:
215 checkers.append('metrics') 210 checkers.append("metrics")
216 if self.parameters['enableMiscellaneous']: 211 if self.parameters["enableMiscellaneous"]:
217 checkers.append('miscellaneous') 212 checkers.append("miscellaneous")
218 if self.parameters['enableNewstyle']: 213 if self.parameters["enableNewstyle"]:
219 checkers.append('newstyle') 214 checkers.append("newstyle")
220 if self.parameters['enableSimilarities']: 215 if self.parameters["enableSimilarities"]:
221 checkers.append('similarities') 216 checkers.append("similarities")
222 if self.parameters['enableTypecheck']: 217 if self.parameters["enableTypecheck"]:
223 checkers.append('typecheck') 218 checkers.append("typecheck")
224 if self.parameters['enableVariables']: 219 if self.parameters["enableVariables"]:
225 checkers.append('variables') 220 checkers.append("variables")
226 if self.parameters['enableLogging']: 221 if self.parameters["enableLogging"]:
227 checkers.append('logging') 222 checkers.append("logging")
228 if self.parameters['enableStringFormat']: 223 if self.parameters["enableStringFormat"]:
229 checkers.append('string') 224 checkers.append("string")
230 225
231 args.append('--disable=all') 226 args.append("--disable=all")
232 if checkers: 227 if checkers:
233 args.append('--enable={0}'.format(','.join(checkers))) 228 args.append("--enable={0}".format(",".join(checkers)))
234 229
235 # 2.3 messages options 230 # 2.3 messages options
236 parms['enabledMessages'] = self.parameters['enabledMessages'] 231 parms["enabledMessages"] = self.parameters["enabledMessages"]
237 parms['disabledMessages'] = self.parameters['disabledMessages'] 232 parms["disabledMessages"] = self.parameters["disabledMessages"]
238 if parms['enabledMessages']: 233 if parms["enabledMessages"]:
239 args.append('--enable={0}'.format(parms['enabledMessages'])) 234 args.append("--enable={0}".format(parms["enabledMessages"]))
240 if parms['disabledMessages']: 235 if parms["disabledMessages"]:
241 args.append('--disable={0}'.format(parms['disabledMessages'])) 236 args.append("--disable={0}".format(parms["disabledMessages"]))
242 237
243 return (args, parms) 238 return (args, parms)
244 239
245 def accept(self): 240 def accept(self):
246 """ 241 """
247 Public slot called by the Ok button. 242 Public slot called by the Ok button.
248 243
249 It saves the values in the parameters dictionary. 244 It saves the values in the parameters dictionary.
250 """ 245 """
251 # get data of general tab 246 # get data of general tab
252 self.parameters['configFile'] = self.configfilePicker.text() 247 self.parameters["configFile"] = self.configfilePicker.text()
253 self.parameters['txtReport'] = self.txtOutputButton.isChecked() 248 self.parameters["txtReport"] = self.txtOutputButton.isChecked()
254 self.parameters['htmlReport'] = self.htmlOutputButton.isChecked() 249 self.parameters["htmlReport"] = self.htmlOutputButton.isChecked()
255 self.parameters['dialogReport'] = self.dialogOutputButton.isChecked() 250 self.parameters["dialogReport"] = self.dialogOutputButton.isChecked()
256 self.parameters['reportFile'] = self.reportfilePicker.text() 251 self.parameters["reportFile"] = self.reportfilePicker.text()
257 252
258 # get data of checkers tab 253 # get data of checkers tab
259 self.parameters['enableBasic'] = self.basicCheckBox.isChecked() 254 self.parameters["enableBasic"] = self.basicCheckBox.isChecked()
260 self.parameters['enableClasses'] = self.classesCheckBox.isChecked() 255 self.parameters["enableClasses"] = self.classesCheckBox.isChecked()
261 self.parameters['enableDesign'] = self.designCheckBox.isChecked() 256 self.parameters["enableDesign"] = self.designCheckBox.isChecked()
262 self.parameters['enableExceptions'] = ( 257 self.parameters["enableExceptions"] = self.exceptionsCheckBox.isChecked()
263 self.exceptionsCheckBox.isChecked()) 258 self.parameters["enableFormat"] = self.formatCheckBox.isChecked()
264 self.parameters['enableFormat'] = self.formatCheckBox.isChecked() 259 self.parameters["enableImports"] = self.importsCheckBox.isChecked()
265 self.parameters['enableImports'] = self.importsCheckBox.isChecked() 260 self.parameters["enableMetrics"] = self.metricsCheckBox.isChecked()
266 self.parameters['enableMetrics'] = self.metricsCheckBox.isChecked() 261 self.parameters["enableMiscellaneous"] = self.miscellaneousCheckBox.isChecked()
267 self.parameters['enableMiscellaneous'] = ( 262 self.parameters["enableNewstyle"] = self.newstyleCheckBox.isChecked()
268 self.miscellaneousCheckBox.isChecked()) 263 self.parameters["enableSimilarities"] = self.similaritiesCheckBox.isChecked()
269 self.parameters['enableNewstyle'] = self.newstyleCheckBox.isChecked() 264 self.parameters["enableTypecheck"] = self.typecheckCheckBox.isChecked()
270 self.parameters['enableSimilarities'] = ( 265 self.parameters["enableVariables"] = self.variablesCheckBox.isChecked()
271 self.similaritiesCheckBox.isChecked()) 266 self.parameters["enableLogging"] = self.loggingCheckBox.isChecked()
272 self.parameters['enableTypecheck'] = self.typecheckCheckBox.isChecked() 267 self.parameters["enableStringFormat"] = self.stringFormatCheckBox.isChecked()
273 self.parameters['enableVariables'] = self.variablesCheckBox.isChecked() 268
274 self.parameters['enableLogging'] = self.loggingCheckBox.isChecked()
275 self.parameters['enableStringFormat'] = (
276 self.stringFormatCheckBox.isChecked())
277
278 # get data of messages tab 269 # get data of messages tab
279 self.parameters['enabledMessages'] = ','.join( 270 self.parameters["enabledMessages"] = ",".join(
280 [m.strip() for m in self.enabledMessagesEdit.text().split(',')]) 271 [m.strip() for m in self.enabledMessagesEdit.text().split(",")]
281 self.parameters['disabledMessages'] = ','.join( 272 )
282 [m.strip() for m in self.disabledMessagesEdit.text().split(',')]) 273 self.parameters["disabledMessages"] = ",".join(
283 274 [m.strip() for m in self.disabledMessagesEdit.text().split(",")]
275 )
276
284 # call the accept slot of the base class 277 # call the accept slot of the base class
285 super().accept() 278 super().accept()
286 279
287 ########################################################################### 280 ###########################################################################
288 ## Methods below are needed to generate a configuration file template 281 ## Methods below are needed to generate a configuration file template
294 Private slot to handle the generation of a sample configuration. 287 Private slot to handle the generation of a sample configuration.
295 """ 288 """
296 self.buf = "" 289 self.buf = ""
297 self.__pylintProc = QProcess() 290 self.__pylintProc = QProcess()
298 args = [] 291 args = []
299 292
300 self.__ioEncoding = Preferences.getSystem("IOEncoding") 293 self.__ioEncoding = Preferences.getSystem("IOEncoding")
301 294
302 args.append('--generate-rcfile') 295 args.append("--generate-rcfile")
303 296
304 self.__pylintProc.readyReadStandardOutput.connect(self.__readStdout) 297 self.__pylintProc.readyReadStandardOutput.connect(self.__readStdout)
305 self.__pylintProc.readyReadStandardError.connect(self.__readStderr) 298 self.__pylintProc.readyReadStandardError.connect(self.__readStderr)
306 self.__pylintProc.finished.connect(self.__createConfigDone) 299 self.__pylintProc.finished.connect(self.__createConfigDone)
307 300
308 self.__pylintProc.start(self.__lint, args) 301 self.__pylintProc.start(self.__lint, args)
309 procStarted = self.__pylintProc.waitForStarted() 302 procStarted = self.__pylintProc.waitForStarted()
310 if procStarted: 303 if procStarted:
311 ericApp().getObject("ViewManager").enableEditorsCheckFocusIn(False) 304 ericApp().getObject("ViewManager").enableEditorsCheckFocusIn(False)
312 else: 305 else:
313 EricMessageBox.critical( 306 EricMessageBox.critical(
314 self, 307 self,
315 self.tr('Process Generation Error'), 308 self.tr("Process Generation Error"),
316 self.tr( 309 self.tr(
317 'Could not start {0}.<br>' 310 "Could not start {0}.<br>" "Ensure that it is in the search path."
318 'Ensure that it is in the search path.' 311 ).format(self.__lint),
319 ).format(self.__lint)) 312 )
320 313
321 def __createConfigDone(self, exitCode, exitStatus): 314 def __createConfigDone(self, exitCode, exitStatus):
322 """ 315 """
323 Private slot to handle the the finished signal of the pylint process. 316 Private slot to handle the the finished signal of the pylint process.
324 317
325 @param exitCode exit code of the process 318 @param exitCode exit code of the process
326 @type int 319 @type int
327 @param exitStatus exit status of the process 320 @param exitStatus exit status of the process
328 @type QProcess.ExitStatus 321 @type QProcess.ExitStatus
329 """ 322 """
331 vm.enableEditorsCheckFocusIn(True) 324 vm.enableEditorsCheckFocusIn(True)
332 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: 325 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0:
333 vm.newEditor() 326 vm.newEditor()
334 aw = vm.activeWindow() 327 aw = vm.activeWindow()
335 aw.insertAt(self.buf, 0, 0) 328 aw.insertAt(self.buf, 0, 0)
336 aw.setLanguage('dummy.rc') 329 aw.setLanguage("dummy.rc")
337 self.reject() 330 self.reject()
338 331
339 def __readStdout(self): 332 def __readStdout(self):
340 """ 333 """
341 Private slot to handle the readyReadStandardOutput signal of the 334 Private slot to handle the readyReadStandardOutput signal of the
342 pylint process. 335 pylint process.
343 """ 336 """
344 if self.__pylintProc is None: 337 if self.__pylintProc is None:
345 return 338 return
346 339
347 self.__pylintProc.setReadChannel( 340 self.__pylintProc.setReadChannel(QProcess.ProcessChannel.StandardOutput)
348 QProcess.ProcessChannel.StandardOutput) 341
349
350 while self.__pylintProc and self.__pylintProc.canReadLine(): 342 while self.__pylintProc and self.__pylintProc.canReadLine():
351 line = str(self.__pylintProc.readLine(), self.__ioEncoding, 343 line = str(
352 "replace").rstrip() 344 self.__pylintProc.readLine(), self.__ioEncoding, "replace"
345 ).rstrip()
353 self.buf += line + os.linesep 346 self.buf += line + os.linesep
354 347
355 def __readStderr(self): 348 def __readStderr(self):
356 """ 349 """
357 Private slot to handle the readyReadStandardError signal of the 350 Private slot to handle the readyReadStandardError signal of the
358 pylint process. 351 pylint process.
359 """ 352 """
360 if self.__pylintProc is None: 353 if self.__pylintProc is None:
361 return 354 return
362 355
363 self.__pylintProc.setReadChannel( 356 self.__pylintProc.setReadChannel(QProcess.ProcessChannel.StandardError)
364 QProcess.ProcessChannel.StandardError)
365 while self.__pylintProc and self.__pylintProc.canReadLine(): 357 while self.__pylintProc and self.__pylintProc.canReadLine():
366 s = 'pylint: ' + str( 358 s = "pylint: " + str(
367 self.__pylintProc.readLine(), self.__ioEncoding, "replace") 359 self.__pylintProc.readLine(), self.__ioEncoding, "replace"
360 )
368 ericApp().getObject("UserInterface").appendStderr.emit(s) 361 ericApp().getObject("UserInterface").appendStderr.emit(s)

eric ide

mercurial