Plugins/UiExtensionPlugins/PipInterface/Pip.py

changeset 6619
1d34365c082c
parent 6394
17ecf4a340e7
child 6645
ad476851d7e0
--- a/Plugins/UiExtensionPlugins/PipInterface/Pip.py	Sun Dec 09 12:22:08 2018 +0100
+++ b/Plugins/UiExtensionPlugins/PipInterface/Pip.py	Sun Dec 09 13:13:27 2018 +0100
@@ -49,6 +49,7 @@
         self.__ui = parent
         
         self.__virtualenvManager = e5App().getObject("VirtualEnvManager")
+        self.__project = e5App().getObject("Project")
         
         self.__menus = {}   # dictionary with references to menus
         
@@ -561,7 +562,19 @@
         @return string for the default environment
         @rtype str
         """
-        return self.tr("<default>")
+        return self.tr("<standard>")
+    
+    def getProjectEnvironmentString(self):
+        """
+        Public method to get the string for the project environment.
+        
+        @return string for the project environment
+        @rtype str
+        """
+        if self.__project.isOpen():
+            return self.tr("<project>")
+        else:
+            return ""
     
     def getVirtualenvInterpreter(self, venvName):
         """
@@ -574,6 +587,11 @@
         """
         if venvName == self.getDefaultEnvironmentString():
             venvName = self.__plugin.getPreferences("CurrentEnvironment")
+        elif venvName == self.getProjectEnvironmentString():
+            venvName = self.__project.getDebugProperty("VIRTUALENV")
+            if not venvName:
+                # fall back to standard if not defined
+                venvName = self.__plugin.getPreferences("CurrentEnvironment")
         
         interpreter = self.__virtualenvManager.getVirtualenvInterpreter(
             venvName)

eric ide

mercurial