148 @param menu reference to the menu (QMenu) |
148 @param menu reference to the menu (QMenu) |
149 """ |
149 """ |
150 if menuName == "Checks" and self.__projectAct is not None: |
150 if menuName == "Checks" and self.__projectAct is not None: |
151 self.__projectAct.setEnabled( |
151 self.__projectAct.setEnabled( |
152 e5App().getObject("Project").getProjectLanguage() in |
152 e5App().getObject("Project").getProjectLanguage() in |
153 ["Python3", "Python2", "Python"]) |
153 ["Python3", "Python2", "Python", "JavaScript"]) |
154 |
154 |
155 def __projectBrowserShowMenu(self, menuName, menu): |
155 def __projectBrowserShowMenu(self, menuName, menu): |
156 """ |
156 """ |
157 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 |
158 about to be shown. |
158 about to be shown. |
160 @param menuName name of the menu to be shown (string) |
160 @param menuName name of the menu to be shown (string) |
161 @param menu reference to the menu (QMenu) |
161 @param menu reference to the menu (QMenu) |
162 """ |
162 """ |
163 if menuName == "Checks" and \ |
163 if menuName == "Checks" and \ |
164 e5App().getObject("Project").getProjectLanguage() in \ |
164 e5App().getObject("Project").getProjectLanguage() in \ |
165 ["Python3", "Python2", "Python"]: |
165 ["Python3", "Python2", "Python", "JavaScript"]: |
166 self.__projectBrowserMenu = menu |
166 self.__projectBrowserMenu = menu |
167 if self.__projectBrowserAct is None: |
167 if self.__projectBrowserAct is None: |
168 self.__projectBrowserAct = E5Action( |
168 self.__projectBrowserAct = E5Action( |
169 self.tr('Check Syntax'), |
169 self.tr('Check Syntax'), |
170 self.tr('&Syntax...'), 0, 0, |
170 self.tr('&Syntax...'), 0, 0, |
187 ppath = project.getProjectPath() |
187 ppath = project.getProjectPath() |
188 files = [os.path.join(ppath, file) |
188 files = [os.path.join(ppath, file) |
189 for file in project.pdata["SOURCES"] |
189 for file in project.pdata["SOURCES"] |
190 if file.endswith( |
190 if file.endswith( |
191 tuple(Preferences.getPython("Python3Extensions")) + |
191 tuple(Preferences.getPython("Python3Extensions")) + |
192 tuple(Preferences.getPython("PythonExtensions")))] |
192 tuple(Preferences.getPython("PythonExtensions")) + |
|
193 (".js", ))] |
193 |
194 |
194 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
195 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
195 SyntaxCheckerDialog |
196 SyntaxCheckerDialog |
196 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
197 self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() |
197 self.__projectSyntaxCheckerDialog.show() |
198 self.__projectSyntaxCheckerDialog.show() |
250 """ |
251 """ |
251 if menuName == "Checks": |
252 if menuName == "Checks": |
252 if not self.__editorAct in menu.actions(): |
253 if not self.__editorAct in menu.actions(): |
253 menu.addAction(self.__editorAct) |
254 menu.addAction(self.__editorAct) |
254 self.__editorAct.setEnabled( |
255 self.__editorAct.setEnabled( |
255 editor.isPy3File() or editor.isPy2File()) |
256 editor.isPy3File() or |
|
257 editor.isPy2File() or |
|
258 editor.isJavascriptFile() |
|
259 ) |
256 |
260 |
257 def __editorSyntaxCheck(self): |
261 def __editorSyntaxCheck(self): |
258 """ |
262 """ |
259 Private slot to handle the syntax check context menu action of the |
263 Private slot to handle the syntax check context menu action of the |
260 editors. |
264 editors. |
261 """ |
265 """ |
262 editor = e5App().getObject("ViewManager").activeWindow() |
266 editor = e5App().getObject("ViewManager").activeWindow() |
263 if editor is not None: |
267 if editor is not None: |
264 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
268 from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ |
265 SyntaxCheckerDialog |
269 SyntaxCheckerDialog |
266 self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() |
270 self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() |
267 self.__editorSyntaxCheckerDialog.show() |
271 self.__editorSyntaxCheckerDialog.show() |
268 self.__editorSyntaxCheckerDialog.start( |
272 if editor.isJavascriptFile(): |
269 editor.getFileName() or "Unnamed.py", editor.text()) |
273 unnamed = "Unnamed.js" |
|
274 else: |
|
275 unnamed = "Unnamed.py" |
|
276 self.__editorSyntaxCheckerDialog.start( |
|
277 editor.getFileName() or unnamed, editor.text()) |