Plugins/PluginCodeStyleChecker.py

changeset 3450
2f7c8fd8e3f5
parent 3446
5a670e55adbb
child 3515
1b8381afe38f
equal deleted inserted replaced
3449:aa2bd0199c64 3450:2f7c8fd8e3f5
10 import os 10 import os
11 11
12 from PyQt4.QtCore import QObject 12 from PyQt4.QtCore import QObject
13 13
14 from E5Gui.E5Application import e5App 14 from E5Gui.E5Application import e5App
15
16 from E5Gui.E5Action import E5Action 15 from E5Gui.E5Action import E5Action
16
17 from Project.ProjectBrowserModel import ProjectBrowserFileItem
17 18
18 import Preferences 19 import Preferences
19 20
20 # Start-Of-Header 21 # Start-Of-Header
21 name = "Code Style Checker Plugin" 22 name = "Code Style Checker Plugin"
210 Private method to handle the code style check context menu action of 211 Private method to handle the code style check context menu action of
211 the project sources browser. 212 the project sources browser.
212 """ 213 """
213 browser = e5App().getObject("ProjectBrowser")\ 214 browser = e5App().getObject("ProjectBrowser")\
214 .getProjectBrowser("sources") 215 .getProjectBrowser("sources")
215 itm = browser.model().item(browser.currentIndex()) 216 if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1:
216 try: 217 fn = []
217 fn = itm.fileName() 218 for itm in browser.getSelectedItems([ProjectBrowserFileItem]):
219 fn.append(itm.fileName())
218 isDir = False 220 isDir = False
219 except AttributeError: 221 else:
220 fn = itm.dirName() 222 itm = browser.model().item(browser.currentIndex())
221 isDir = True 223 try:
224 fn = itm.fileName()
225 isDir = False
226 except AttributeError:
227 fn = itm.dirName()
228 isDir = True
222 229
223 from CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog import \ 230 from CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog import \
224 CodeStyleCheckerDialog 231 CodeStyleCheckerDialog
225 self.__projectBrowserCodeStyleCheckerDialog = CodeStyleCheckerDialog() 232 self.__projectBrowserCodeStyleCheckerDialog = CodeStyleCheckerDialog()
226 self.__projectBrowserCodeStyleCheckerDialog.show() 233 self.__projectBrowserCodeStyleCheckerDialog.show()

eric ide

mercurial