366 |
366 |
367 def __projectCodeStyleCheck(self): |
367 def __projectCodeStyleCheck(self): |
368 """ |
368 """ |
369 Private slot used to check the project files for code style. |
369 Private slot used to check the project files for code style. |
370 """ |
370 """ |
|
371 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
|
372 |
371 project = ericApp().getObject("Project") |
373 project = ericApp().getObject("Project") |
372 project.saveAllScripts() |
374 project.saveAllScripts() |
373 ppath = project.getProjectPath() |
375 ppath = project.getProjectPath() |
374 files = [ |
376 files = [ |
375 os.path.join(ppath, file) |
377 os.path.join(ppath, file) |
376 for file in project.pdata["SOURCES"] |
378 for file in project.pdata["SOURCES"] |
377 if file.endswith(tuple(Preferences.getPython("Python3Extensions"))) |
379 if file.endswith(tuple(Preferences.getPython("Python3Extensions"))) |
378 ] |
380 ] |
379 |
381 |
380 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
|
381 |
|
382 self.__projectCodeStyleCheckerDialog = ( |
382 self.__projectCodeStyleCheckerDialog = ( |
383 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
383 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
384 ) |
384 ) |
385 self.__projectCodeStyleCheckerDialog.show() |
385 self.__projectCodeStyleCheckerDialog.show() |
386 self.__projectCodeStyleCheckerDialog.prepare(files, project) |
386 self.__projectCodeStyleCheckerDialog.prepare(files, project) |
388 def __projectBrowserCodeStyleCheck(self): |
388 def __projectBrowserCodeStyleCheck(self): |
389 """ |
389 """ |
390 Private method to handle the code style check context menu action of |
390 Private method to handle the code style check context menu action of |
391 the project sources browser. |
391 the project sources browser. |
392 """ |
392 """ |
|
393 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
|
394 |
393 browser = ericApp().getObject("ProjectBrowser").getProjectBrowser("sources") |
395 browser = ericApp().getObject("ProjectBrowser").getProjectBrowser("sources") |
394 if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1: |
396 if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1: |
395 fn = [] |
397 fn = [] |
396 for itm in browser.getSelectedItems([ProjectBrowserFileItem]): |
398 for itm in browser.getSelectedItems([ProjectBrowserFileItem]): |
397 fn.append(itm.fileName()) |
399 fn.append(itm.fileName()) |
403 isDir = False |
405 isDir = False |
404 except AttributeError: |
406 except AttributeError: |
405 fn = itm.dirName() |
407 fn = itm.dirName() |
406 isDir = True |
408 isDir = True |
407 |
409 |
408 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
|
409 |
|
410 self.__projectBrowserCodeStyleCheckerDialog = ( |
410 self.__projectBrowserCodeStyleCheckerDialog = ( |
411 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
411 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
412 ) |
412 ) |
413 self.__projectBrowserCodeStyleCheckerDialog.show() |
413 self.__projectBrowserCodeStyleCheckerDialog.show() |
414 if isDir: |
414 if isDir: |
456 def __editorCodeStyleCheck(self): |
456 def __editorCodeStyleCheck(self): |
457 """ |
457 """ |
458 Private slot to handle the code style check context menu action |
458 Private slot to handle the code style check context menu action |
459 of the editors. |
459 of the editors. |
460 """ |
460 """ |
|
461 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog |
|
462 |
461 editor = ericApp().getObject("ViewManager").activeWindow() |
463 editor = ericApp().getObject("ViewManager").activeWindow() |
462 if ( |
464 if ( |
463 editor is not None |
465 editor is not None |
464 and editor.checkDirty() |
466 and editor.checkDirty() |
465 and editor.getFileName() is not None |
467 and editor.getFileName() is not None |
466 ): |
468 ): |
467 from eric7.Plugins.CheckerPlugins.CodeStyleChecker import ( |
|
468 CodeStyleCheckerDialog, |
|
469 ) |
|
470 |
|
471 self.__editorCodeStyleCheckerDialog = ( |
469 self.__editorCodeStyleCheckerDialog = ( |
472 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
470 CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) |
473 ) |
471 ) |
474 self.__editorCodeStyleCheckerDialog.show() |
472 self.__editorCodeStyleCheckerDialog.show() |
475 self.__editorCodeStyleCheckerDialog.start( |
473 self.__editorCodeStyleCheckerDialog.start( |