PluginMetricsRadon.py

branch
eric7
changeset 112
df1e86e89b24
parent 110
261babeb7cc6
child 113
ab0e46f963ee
equal deleted inserted replaced
111:897c71cbc967 112:df1e86e89b24
16 from eric7 import Globals, Preferences 16 from eric7 import Globals, Preferences
17 from eric7.EricGui.EricAction import EricAction 17 from eric7.EricGui.EricAction import EricAction
18 from eric7.EricWidgets import EricMessageBox 18 from eric7.EricWidgets import EricMessageBox
19 from eric7.EricWidgets.EricApplication import ericApp 19 from eric7.EricWidgets.EricApplication import ericApp
20 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem 20 from eric7.Project.ProjectBrowserModel import ProjectBrowserFileItem
21 from eric7.SystemUtilities import FileSystemUtilities
21 22
22 try: 23 try:
23 from eric7.SystemUtilities.PythonUtilities import determinePythonVersion 24 from eric7.SystemUtilities.PythonUtilities import determinePythonVersion
24 except ImportError: 25 except ImportError:
25 # imports for eric < 23.1 26 # imports for eric < 23.1
28 # Start-Of-Header 29 # Start-Of-Header
29 name = "Radon Metrics Plugin" 30 name = "Radon Metrics Plugin"
30 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 31 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
31 autoactivate = True 32 autoactivate = True
32 deactivateable = True 33 deactivateable = True
33 version = "10.2.1" 34 version = "10.3.0"
34 className = "RadonMetricsPlugin" 35 className = "RadonMetricsPlugin"
35 packageName = "RadonMetrics" 36 packageName = "RadonMetrics"
36 shortDescription = "Code metrics plugin using radon package" 37 shortDescription = "Code metrics plugin using radon package"
37 longDescription = ( 38 longDescription = (
38 """This plug-in implements dialogs to show various code metrics. These""" 39 """This plug-in implements dialogs to show various code metrics. These"""
647 """ 648 """
648 if menuName == "Show": 649 if menuName == "Show":
649 for act in self.__projectMetricsActs[1:]: 650 for act in self.__projectMetricsActs[1:]:
650 act.setEnabled( 651 act.setEnabled(
651 ericApp().getObject("Project").getProjectLanguage() == "Python3" 652 ericApp().getObject("Project").getProjectLanguage() == "Python3"
653 and not FileSystemUtilities.isRemoteFileName(
654 ericApp().getObject("Project").getProjectPath()
655 )
652 ) 656 )
653 657
654 def __projectBrowserShowMenu(self, menuName, menu): 658 def __projectBrowserShowMenu(self, menuName, menu):
655 """ 659 """
656 Private slot called, when the the project browser context menu or a 660 Private slot called, when the the project browser context menu or a
662 @type QMenu 666 @type QMenu
663 """ 667 """
664 if ( 668 if (
665 menuName == "Show" 669 menuName == "Show"
666 and ericApp().getObject("Project").getProjectLanguage() == "Python3" 670 and ericApp().getObject("Project").getProjectLanguage() == "Python3"
671 and not FileSystemUtilities.isRemoteFileName(
672 ericApp().getObject("Project").getProjectPath()
673 )
667 and self.__projectBrowserMenu is None 674 and self.__projectBrowserMenu is None
668 ): 675 ):
669 self.__projectBrowserMenu = menu 676 self.__projectBrowserMenu = menu
670 677
671 act = menu.addSeparator() 678 act = menu.addSeparator()
801 @type QMenu 808 @type QMenu
802 @param editor reference to the editor 809 @param editor reference to the editor
803 @type Editor 810 @type Editor
804 """ 811 """
805 if menuName == "Show": 812 if menuName == "Show":
806 enable = editor.isPyFile() 813 enable = (
814 editor.isPyFile()
815 and not FileSystemUtilities.isRemoteFileName(editor.getFileName())
816 )
807 for act in self.__editorMetricsActs: 817 for act in self.__editorMetricsActs:
808 act.setEnabled(enable) 818 act.setEnabled(enable)
809 819
810 ################################################################## 820 ##################################################################
811 ## Raw code metrics calculations 821 ## Raw code metrics calculations

eric ide

mercurial