Plugins/PluginPep8Checker.py

changeset 843
522c8befcf49
parent 832
eb5ff61f927b
child 849
996367a89673
equal deleted inserted replaced
842:984b5535cd26 843:522c8befcf49
149 @param menu reference to the menu (QMenu) 149 @param menu reference to the menu (QMenu)
150 """ 150 """
151 if menuName == "Checks" and self.__projectAct is not None: 151 if menuName == "Checks" and self.__projectAct is not None:
152 self.__projectAct.setEnabled( 152 self.__projectAct.setEnabled(
153 e5App().getObject("Project").getProjectLanguage() in \ 153 e5App().getObject("Project").getProjectLanguage() in \
154 ["Python3"]) 154 ["Python3", "Python2", "Python"])
155 ## ["Python3", "Python2", "Python"])
156 155
157 def __projectBrowserShowMenu(self, menuName, menu): 156 def __projectBrowserShowMenu(self, menuName, menu):
158 """ 157 """
159 Private slot called, when the the project browser menu or a submenu is 158 Private slot called, when the the project browser menu or a submenu is
160 about to be shown. 159 about to be shown.
162 @param menuName name of the menu to be shown (string) 161 @param menuName name of the menu to be shown (string)
163 @param menu reference to the menu (QMenu) 162 @param menu reference to the menu (QMenu)
164 """ 163 """
165 if menuName == "Checks" and \ 164 if menuName == "Checks" and \
166 e5App().getObject("Project").getProjectLanguage() in \ 165 e5App().getObject("Project").getProjectLanguage() in \
167 ["Python3"]: 166 ["Python3", "Python2", "Python"]:
168 ## ["Python3", "Python2", "Python"]:
169 self.__projectBrowserMenu = menu 167 self.__projectBrowserMenu = menu
170 if self.__projectBrowserAct is None: 168 if self.__projectBrowserAct is None:
171 self.__projectBrowserAct = E5Action( 169 self.__projectBrowserAct = E5Action(
172 self.trUtf8('Check PEP 8 Compliance'), 170 self.trUtf8('Check PEP 8 Compliance'),
173 self.trUtf8('PEP &8 Compliance...'), 0, 0, 171 self.trUtf8('PEP &8 Compliance...'), 0, 0,
190 project.saveAllScripts() 188 project.saveAllScripts()
191 ppath = project.getProjectPath() 189 ppath = project.getProjectPath()
192 files = [os.path.join(ppath, file) \ 190 files = [os.path.join(ppath, file) \
193 for file in project.pdata["SOURCES"] \ 191 for file in project.pdata["SOURCES"] \
194 if file.endswith( 192 if file.endswith(
195 tuple(Preferences.getPython("Python3Extensions")))] 193 tuple(Preferences.getPython("Python3Extensions")) +
196 ## tuple(Preferences.getPython("Python3Extensions")) + 194 tuple(Preferences.getPython("PythonExtensions")))]
197 ## tuple(Preferences.getPython("PythonExtensions")))]
198 195
199 self.__projectPep8CheckerDialog = Pep8Dialog() 196 self.__projectPep8CheckerDialog = Pep8Dialog()
200 self.__projectPep8CheckerDialog.show() 197 self.__projectPep8CheckerDialog.show()
201 self.__projectPep8CheckerDialog.prepare(files, project) 198 self.__projectPep8CheckerDialog.prepare(files, project)
202 199
257 @param editor reference to the editor 254 @param editor reference to the editor
258 """ 255 """
259 if menuName == "Checks": 256 if menuName == "Checks":
260 if not self.__editorAct in menu.actions(): 257 if not self.__editorAct in menu.actions():
261 menu.addAction(self.__editorAct) 258 menu.addAction(self.__editorAct)
262 self.__editorAct.setEnabled(editor.isPy3File()) 259 self.__editorAct.setEnabled(editor.isPy3File() or editor.isPy2File())
263 ## self.__editorAct.setEnabled(editor.isPy3File() or editor.isPy2File())
264 260
265 def __editorPep8Check(self): 261 def __editorPep8Check(self):
266 """ 262 """
267 Private slot to handle the PEP 8 check context menu action 263 Private slot to handle the PEP 8 check context menu action
268 of the editors. 264 of the editors.

eric ide

mercurial