Plugins/PluginTabnanny.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3036
30c81c9e88b8
child 3145
a9de05d4a22f
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
27 version = "5.4.0" 27 version = "5.4.0"
28 className = "TabnannyPlugin" 28 className = "TabnannyPlugin"
29 packageName = "__core__" 29 packageName = "__core__"
30 shortDescription = "Show the Tabnanny dialog." 30 shortDescription = "Show the Tabnanny dialog."
31 longDescription = """This plugin implements the Tabnanny dialog.""" \ 31 longDescription = """This plugin implements the Tabnanny dialog.""" \
32 """ Tabnanny is used to check Python source files for correct indentations.""" 32 """ Tabnanny is used to check Python source files for correct""" \
33 """ indentations."""
33 pyqtApi = 2 34 pyqtApi = 2
34 # End-Of-Header 35 # End-Of-Header
35 36
36 error = "" 37 error = ""
37 38
150 @param menuName name of the menu to be shown (string) 151 @param menuName name of the menu to be shown (string)
151 @param menu reference to the menu (QMenu) 152 @param menu reference to the menu (QMenu)
152 """ 153 """
153 if menuName == "Checks" and self.__projectAct is not None: 154 if menuName == "Checks" and self.__projectAct is not None:
154 self.__projectAct.setEnabled( 155 self.__projectAct.setEnabled(
155 e5App().getObject("Project").getProjectLanguage() in \ 156 e5App().getObject("Project").getProjectLanguage() in
156 ["Python3", "Python2", "Python"]) 157 ["Python3", "Python2", "Python"])
157 158
158 def __projectBrowserShowMenu(self, menuName, menu): 159 def __projectBrowserShowMenu(self, menuName, menu):
159 """ 160 """
160 Private slot called, when the the project browser context menu or a 161 Private slot called, when the the project browser context menu or a
161 submenu is about to be shown. 162 submenu is about to be shown.
187 Public slot used to check the project files for bad indentations. 188 Public slot used to check the project files for bad indentations.
188 """ 189 """
189 project = e5App().getObject("Project") 190 project = e5App().getObject("Project")
190 project.saveAllScripts() 191 project.saveAllScripts()
191 ppath = project.getProjectPath() 192 ppath = project.getProjectPath()
192 files = [os.path.join(ppath, file) \ 193 files = [os.path.join(ppath, file)
193 for file in project.pdata["SOURCES"] \ 194 for file in project.pdata["SOURCES"]
194 if file.endswith( 195 if file.endswith(
195 tuple(Preferences.getPython("Python3Extensions")) + 196 tuple(Preferences.getPython("Python3Extensions")) +
196 tuple(Preferences.getPython("PythonExtensions")))] 197 tuple(Preferences.getPython("PythonExtensions")))]
197 198
198 from CheckerPlugins.Tabnanny.TabnannyDialog import TabnannyDialog 199 from CheckerPlugins.Tabnanny.TabnannyDialog import TabnannyDialog
199 self.__projectTabnannyDialog = TabnannyDialog() 200 self.__projectTabnannyDialog = TabnannyDialog()
200 self.__projectTabnannyDialog.show() 201 self.__projectTabnannyDialog.show()
201 self.__projectTabnannyDialog.prepare(files, project) 202 self.__projectTabnannyDialog.prepare(files, project)

eric ide

mercurial