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