25 version = "5.4.0" |
25 version = "5.4.0" |
26 className = "SyntaxCheckerPlugin" |
26 className = "SyntaxCheckerPlugin" |
27 packageName = "__core__" |
27 packageName = "__core__" |
28 shortDescription = "Show the Syntax Checker dialog." |
28 shortDescription = "Show the Syntax Checker dialog." |
29 longDescription = """This plugin implements the Syntax Checker dialog.""" \ |
29 longDescription = """This plugin implements the Syntax Checker dialog.""" \ |
30 """ Syntax Checker is used to check Python source files for correct syntax.""" |
30 """ Syntax Checker is used to check Python source files for correct""" \ |
|
31 """ syntax.""" |
31 pyqtApi = 2 |
32 pyqtApi = 2 |
32 # End-Of-Header |
33 # End-Of-Header |
33 |
34 |
34 error = "" |
35 error = "" |
35 |
36 |
88 self.__editorAct = E5Action( |
89 self.__editorAct = E5Action( |
89 self.trUtf8('Check Syntax'), |
90 self.trUtf8('Check Syntax'), |
90 self.trUtf8('&Syntax...'), 0, 0, |
91 self.trUtf8('&Syntax...'), 0, 0, |
91 self, "") |
92 self, "") |
92 self.__editorAct.setWhatsThis(self.trUtf8( |
93 self.__editorAct.setWhatsThis(self.trUtf8( |
93 """<b>Check Syntax...</b>""" |
94 """<b>Check Syntax...</b>""" |
94 """<p>This checks Python files for syntax errors.</p>""" |
95 """<p>This checks Python files for syntax errors.</p>""" |
95 )) |
96 )) |
96 self.__editorAct.triggered[()].connect(self.__editorSyntaxCheck) |
97 self.__editorAct.triggered[()].connect(self.__editorSyntaxCheck) |
97 |
98 |
98 e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) |
99 e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) |
99 e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ |
100 e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ |
147 @param menu reference to the menu (QMenu) |
148 @param menu reference to the menu (QMenu) |
148 """ |
149 """ |
149 if menuName == "Checks" and self.__projectAct is not None: |
150 if menuName == "Checks" and self.__projectAct is not None: |
150 self.__projectAct.setEnabled( |
151 self.__projectAct.setEnabled( |
151 e5App().getObject("Project").getProjectLanguage() in |
152 e5App().getObject("Project").getProjectLanguage() in |
152 ["Python3", "Python2", "Python"]) |
153 ["Python3", "Python2", "Python"]) |
153 |
154 |
154 def __projectBrowserShowMenu(self, menuName, menu): |
155 def __projectBrowserShowMenu(self, menuName, menu): |
155 """ |
156 """ |
156 Private slot called, when the the project browser menu or a submenu is |
157 Private slot called, when the the project browser menu or a submenu is |
157 about to be shown. |
158 about to be shown. |
185 project.saveAllScripts() |
186 project.saveAllScripts() |
186 ppath = project.getProjectPath() |
187 ppath = project.getProjectPath() |
187 files = [os.path.join(ppath, file) |
188 files = [os.path.join(ppath, file) |
188 for file in project.pdata["SOURCES"] |
189 for file in project.pdata["SOURCES"] |
189 if file.endswith( |
190 if file.endswith( |
190 tuple(Preferences.getPython("Python3Extensions")) + |
191 tuple(Preferences.getPython("Python3Extensions")) + |
191 tuple(Preferences.getPython("PythonExtensions")))] |
192 tuple(Preferences.getPython("PythonExtensions")))] |
192 |
193 |
193 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
194 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
194 SyntaxCheckerDialog |
195 SyntaxCheckerDialog |
195 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
196 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
196 self.__projectSyntaxCheckerDialog.show() |
197 self.__projectSyntaxCheckerDialog.show() |