Plugins/PluginTabnanny.py

changeset 805
83ca4d1ff648
parent 791
9ec2ac20e54e
child 945
8cd4d08fa9f6
child 955
377efd9104a7
equal deleted inserted replaced
804:3465556892de 805:83ca4d1ff648
141 @param menuName name of the menu to be shown (string) 141 @param menuName name of the menu to be shown (string)
142 @param menu reference to the menu (QMenu) 142 @param menu reference to the menu (QMenu)
143 """ 143 """
144 if menuName == "Checks" and self.__projectAct is not None: 144 if menuName == "Checks" and self.__projectAct is not None:
145 self.__projectAct.setEnabled( 145 self.__projectAct.setEnabled(
146 e5App().getObject("Project").getProjectLanguage() == "Python3") 146 e5App().getObject("Project").getProjectLanguage() in \
147 ["Python3", "Python2", "Python"])
147 148
148 def __projectBrowserShowMenu(self, menuName, menu): 149 def __projectBrowserShowMenu(self, menuName, menu):
149 """ 150 """
150 Private slot called, when the the project browser context menu or a submenu is 151 Private slot called, when the the project browser context menu or a submenu is
151 about to be shown. 152 about to be shown.
152 153
153 @param menuName name of the menu to be shown (string) 154 @param menuName name of the menu to be shown (string)
154 @param menu reference to the menu (QMenu) 155 @param menu reference to the menu (QMenu)
155 """ 156 """
156 if menuName == "Checks" and \ 157 if menuName == "Checks" and \
157 e5App().getObject("Project").getProjectLanguage() == "Python3": 158 e5App().getObject("Project").getProjectLanguage() in \
159 ["Python3", "Python2", "Python"]:
158 self.__projectBrowserMenu = menu 160 self.__projectBrowserMenu = menu
159 if self.__projectBrowserAct is None: 161 if self.__projectBrowserAct is None:
160 self.__projectBrowserAct = E5Action(self.trUtf8('Check Indentations'), 162 self.__projectBrowserAct = E5Action(self.trUtf8('Check Indentations'),
161 self.trUtf8('&Indentations...'), 0, 0, 163 self.trUtf8('&Indentations...'), 0, 0,
162 self, "") 164 self, "")
177 project = e5App().getObject("Project") 179 project = e5App().getObject("Project")
178 project.saveAllScripts() 180 project.saveAllScripts()
179 ppath = project.getProjectPath() 181 ppath = project.getProjectPath()
180 files = [os.path.join(ppath, file) \ 182 files = [os.path.join(ppath, file) \
181 for file in project.pdata["SOURCES"] \ 183 for file in project.pdata["SOURCES"] \
182 if file.endswith(tuple(Preferences.getPython("Python3Extensions")))] 184 if file.endswith(tuple(Preferences.getPython("Python3Extensions")) +
185 tuple(Preferences.getPython("PythonExtensions")))]
183 186
184 self.__projectTabnannyDialog = TabnannyDialog() 187 self.__projectTabnannyDialog = TabnannyDialog()
185 self.__projectTabnannyDialog.show() 188 self.__projectTabnannyDialog.show()
186 self.__projectTabnannyDialog.prepare(files, project) 189 self.__projectTabnannyDialog.prepare(files, project)
187 190
234 @param editor reference to the editor 237 @param editor reference to the editor
235 """ 238 """
236 if menuName == "Checks": 239 if menuName == "Checks":
237 if not self.__editorAct in menu.actions(): 240 if not self.__editorAct in menu.actions():
238 menu.addAction(self.__editorAct) 241 menu.addAction(self.__editorAct)
239 self.__editorAct.setEnabled(editor.isPy3File()) 242 self.__editorAct.setEnabled(editor.isPy3File() or editor.isPy2File())
240 243
241 def __editorTabnanny(self): 244 def __editorTabnanny(self):
242 """ 245 """
243 Private slot to handle the tabnanny context menu action of the editors. 246 Private slot to handle the tabnanny context menu action of the editors.
244 """ 247 """

eric ide

mercurial