eric7/Project/Project.py

branch
unittest
changeset 9056
af7c8c7b7c62
parent 8943
23f9c7b9e18e
child 9065
39405e6eba20
equal deleted inserted replaced
9055:08b2702b4f81 9056:af7c8c7b7c62
37 import UI.PixmapCache 37 import UI.PixmapCache
38 from UI.NotificationWidget import NotificationTypes 38 from UI.NotificationWidget import NotificationTypes
39 39
40 from EricGui.EricAction import EricAction, createActionGroup 40 from EricGui.EricAction import EricAction, createActionGroup
41 41
42 import Globals
42 import Preferences 43 import Preferences
43 import Utilities 44 import Utilities
44 45
45 from .ProjectFile import ProjectFile 46 from .ProjectFile import ProjectFile
46 from .UserProjectFile import UserProjectFile 47 from .UserProjectFile import UserProjectFile
3702 @return project description 3703 @return project description
3703 @rtype str 3704 @rtype str
3704 """ 3705 """
3705 return self.pdata["DESCRIPTION"] 3706 return self.pdata["DESCRIPTION"]
3706 3707
3708 def getProjectVenv(self, resolveDebugger=True):
3709 """
3710 Public method to get the name of the virtual environment used by the
3711 project.
3712
3713 @param resolveDebugger flag indicating to resolve the virtual
3714 environment name via the debugger settings if none was configured
3715 @type bool
3716 @return name of the project's virtual environment
3717 @rtype str
3718 """
3719 venvName = self.getDebugProperty("VIRTUALENV")
3720 if (
3721 not venvName and
3722 resolveDebugger and
3723 self.getProjectLanguage() in ("Python3", "MicroPython", "Cython")
3724 ):
3725 venvName = Preferences.getDebugger("Python3VirtualEnv")
3726
3727 return venvName
3728
3729 def getProjectInterpreter(self, resolveGlobal=True):
3730 """
3731 Public method to get the path of the interpreter used by the project.
3732
3733 @param resolveGlobal flag indicating to resolve the interpreter using
3734 the global interpreter if no project of debugger specific
3735 environment was configured
3736 @type bool
3737 @return path of the project's interpreter
3738 @rtype str
3739 """
3740 interpreter = ""
3741 venvName = self.getProjectVenv()
3742 if venvName:
3743 interpreter = (
3744 ericApp().getObject("VirtualEnvManager")
3745 .getVirtualenvInterpreter(venvName)
3746 )
3747 if not interpreter and resolveGlobal:
3748 interpreter = Globals.getPythonExecutable()
3749
3750 return interpreter
3751
3752 def getProjectExecPath(self):
3753 """
3754 Public method to get the executable search path prefix of the project.
3755
3756 @return executable search path prefix
3757 @rtype str
3758 """
3759 execPath = ""
3760 venvName = self.getProjectVenv()
3761 if venvName:
3762 execPath = (
3763 ericApp().getObject("VirtualEnvManager")
3764 .getVirtualenvExecPath(venvName)
3765 )
3766
3767 return execPath
3768
3707 def __isInPdata(self, fn): 3769 def __isInPdata(self, fn):
3708 """ 3770 """
3709 Private method used to check, if the passed in filename is project 3771 Private method used to check, if the passed in filename is project
3710 controlled.. 3772 controlled..
3711 3773

eric ide

mercurial