src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

branch
eric7
changeset 9335
ec381c083dbd
parent 9221
bf71ee032bb4
child 9336
c94f53ab789a
equal deleted inserted replaced
9334:28e30230ab28 9335:ec381c083dbd
72 self.__fileList = [] 72 self.__fileList = []
73 self.__project = None 73 self.__project = None
74 self.filterFrame.setVisible(False) 74 self.filterFrame.setVisible(False)
75 75
76 self.checkProgress.setVisible(False) 76 self.checkProgress.setVisible(False)
77 self.checkProgressLabel.setVisible(False)
78 self.checkProgressLabel.setMaximumWidth(600)
79 77
80 try: 78 try:
81 self.syntaxCheckService = ericApp().getObject("SyntaxCheckService") 79 self.syntaxCheckService = ericApp().getObject("SyntaxCheckService")
82 self.syntaxCheckService.syntaxChecked.connect(self.__processResult) 80 self.syntaxCheckService.syntaxChecked.connect(self.__processResult)
83 self.syntaxCheckService.batchFinished.connect(self.__batchFinished) 81 self.syntaxCheckService.batchFinished.connect(self.__batchFinished)
218 self.__clearErrors(self.files) 216 self.__clearErrors(self.files)
219 217
220 if codestring or len(self.files) > 0: 218 if codestring or len(self.files) > 0:
221 self.checkProgress.setMaximum(max(1, len(self.files))) 219 self.checkProgress.setMaximum(max(1, len(self.files)))
222 self.checkProgress.setVisible(len(self.files) > 1) 220 self.checkProgress.setVisible(len(self.files) > 1)
223 self.checkProgressLabel.setVisible(len(self.files) > 1)
224 QApplication.processEvents() 221 QApplication.processEvents()
225 222
226 # now go through all the files 223 # now go through all the files
227 self.progress = 0 224 self.progress = 0
228 self.files.sort() 225 self.files.sort()
241 The results are reported to the __processResult slot. 238 The results are reported to the __processResult slot.
242 239
243 @param codestring optional sourcestring (str) 240 @param codestring optional sourcestring (str)
244 """ 241 """
245 if self.syntaxCheckService is None or not self.files: 242 if self.syntaxCheckService is None or not self.files:
246 self.checkProgressLabel.setPath("")
247 self.checkProgress.setMaximum(1) 243 self.checkProgress.setMaximum(1)
248 self.checkProgress.setValue(1) 244 self.checkProgress.setValue(1)
249 self.__finish() 245 self.__finish()
250 return 246 return
251 247
252 self.filename = self.files.pop(0) 248 self.filename = self.files.pop(0)
253 self.checkProgress.setValue(self.progress) 249 self.checkProgress.setValue(self.progress)
254 self.checkProgressLabel.setPath(self.filename)
255 QApplication.processEvents() 250 QApplication.processEvents()
256 self.__resort() 251 self.__resort()
257 252
258 if self.cancelled: 253 if self.cancelled:
259 return 254 return
289 284
290 The results are reported to the __processResult slot. 285 The results are reported to the __processResult slot.
291 """ 286 """
292 self.__lastFileItem = None 287 self.__lastFileItem = None
293 288
294 self.checkProgressLabel.setPath(self.tr("Preparing files..."))
295 289
296 argumentsList = [] 290 argumentsList = []
297 for progress, filename in enumerate(self.files, start=1): 291 for progress, filename in enumerate(self.files, start=1):
298 self.checkProgress.setValue(progress) 292 self.checkProgress.setValue(progress)
299 if time.monotonic() - self.__timenow > 0.01: 293 if time.monotonic() - self.__timenow > 0.01:
316 310
317 argumentsList.append((filename, source)) 311 argumentsList.append((filename, source))
318 312
319 # reset the progress bar to the checked files 313 # reset the progress bar to the checked files
320 self.checkProgress.setValue(self.progress) 314 self.checkProgress.setValue(self.progress)
321 self.checkProgressLabel.setPath(self.tr("Transferring data..."))
322 QApplication.processEvents() 315 QApplication.processEvents()
323 316
324 self.__finished = False 317 self.__finished = False
325 self.syntaxCheckService.syntaxBatchCheck(argumentsList) 318 self.syntaxCheckService.syntaxBatchCheck(argumentsList)
326 319
327 def __batchFinished(self): 320 def __batchFinished(self):
328 """ 321 """
329 Private slot handling the completion of a batch job. 322 Private slot handling the completion of a batch job.
330 """ 323 """
331 self.checkProgressLabel.setPath("")
332 self.checkProgress.setMaximum(1) 324 self.checkProgress.setMaximum(1)
333 self.checkProgress.setValue(1) 325 self.checkProgress.setValue(1)
334 self.__finish() 326 self.__finish()
335 327
336 def __processError(self, fn, msg): 328 def __processError(self, fn, msg):
393 scr_line = "" 385 scr_line = ""
394 self.__createResultItem(filename, lineno, col, msg, scr_line, True) 386 self.__createResultItem(filename, lineno, col, msg, scr_line, True)
395 387
396 self.progress += 1 388 self.progress += 1
397 self.checkProgress.setValue(self.progress) 389 self.checkProgress.setValue(self.progress)
398 self.checkProgressLabel.setPath(fn)
399 if time.monotonic() - self.__timenow > 0.01: 390 if time.monotonic() - self.__timenow > 0.01:
400 QApplication.processEvents() 391 QApplication.processEvents()
401 self.__timenow = time.monotonic() 392 self.__timenow = time.monotonic()
402 self.__resort() 393 self.__resort()
403 394
433 QHeaderView.ResizeMode.ResizeToContents 424 QHeaderView.ResizeMode.ResizeToContents
434 ) 425 )
435 self.resultList.header().setStretchLastSection(True) 426 self.resultList.header().setStretchLastSection(True)
436 427
437 self.checkProgress.setVisible(False) 428 self.checkProgress.setVisible(False)
438 self.checkProgressLabel.setVisible(False)
439 429
440 def on_buttonBox_clicked(self, button): 430 def on_buttonBox_clicked(self, button):
441 """ 431 """
442 Private slot called by a button of the button box clicked. 432 Private slot called by a button of the button box clicked.
443 433

eric ide

mercurial