Preferences/__init__.py

branch
pypi
changeset 6782
390a45748883
parent 6761
0b69fe8314e3
child 6785
058d63c537a4
--- a/Preferences/__init__.py	Sun Feb 17 18:33:42 2019 +0100
+++ b/Preferences/__init__.py	Sun Feb 17 19:19:30 2019 +0100
@@ -1587,6 +1587,12 @@
     condaDefaults = {
         "CondaExecutable": "",
     }
+    
+    # defaults for pip
+    pipDefaults = {
+        "CurrentEnvironment": "",
+        "PipSearchIndex": "",           # used by the search command
+    }
 
 
 def readToolGroups(prefClass=Prefs):
@@ -3775,6 +3781,30 @@
     prefClass.settings.setValue("Conda/" + key, value)
 
 
+def getPip(key, prefClass=Prefs):
+    """
+    Module function to retrieve the pip related settings.
+    
+    @param key the key of the value to get
+    @param prefClass preferences class used as the storage area
+    @return the requested pip value
+    """
+    return prefClass.settings.value(
+        "Pip/" + key,
+        prefClass.pipDefaults[key])
+
+
+def setPip(key, value, prefClass=Prefs):
+    """
+    Module function to store the pip related settings.
+    
+    @param key the key of the setting to be set
+    @param value the value to be set
+    @param prefClass preferences class used as the storage area
+    """
+    prefClass.settings.setValue("Pip/" + key, value)
+
+
 def getGeometry(key, prefClass=Prefs):
     """
     Module function to retrieve the display geometry.

eric ide

mercurial