VirtualenvExecDialog: changed the interface to use a configuration dictionary. conda

Sun, 27 Jan 2019 12:39:53 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 27 Jan 2019 12:39:53 +0100
branch
conda
changeset 6676
536ad4fa35aa
parent 6672
2af01e538c57
child 6677
6299d69a218a

VirtualenvExecDialog: changed the interface to use a configuration dictionary.

VirtualEnv/VirtualenvExecDialog.py file | annotate | diff | comparison | revisions
VirtualEnv/VirtualenvManager.py file | annotate | diff | comparison | revisions
--- a/VirtualEnv/VirtualenvExecDialog.py	Sat Jan 26 19:42:53 2019 +0100
+++ b/VirtualEnv/VirtualenvExecDialog.py	Sun Jan 27 12:39:53 2019 +0100
@@ -33,28 +33,13 @@
     This class starts a QProcess and displays a dialog that
     shows the output of the virtualenv or pyvenv process.
     """
-    def __init__(self, pyvenv, targetDir, venvName, openTarget, createLog,
-                 createScript, interpreter, venvManager, parent=None):
+    def __init__(self, configuration, venvManager, parent=None):
         """
         Constructor
         
-        @param pyvenv flag indicating the use of 'pyvenv'
-        @type bool
-        @param targetDir name of the virtualenv directory
-        @type str
-        @param venvName logical name for the virtual environment
-        @type str
-        @param openTarget flag indicating to open the virtualenv directory
-            in a file manager
-        @type bool
-        @param createLog flag indicating to create a log file of the
-            creation process
-        @type bool
-        @param createScript flag indicating to create a script to recreate
-            the virtual environment
-        @type bool
-        @param interpreter name of the python interpreter to use
-        @type str
+        @param configuration dictionary containing the configuration parameters
+            as returned by the command configuration dialog
+        @type dictResolver
         @param venvManager reference to the virtual environment manager
         @type VirtualenvManager
         @param parent reference to the parent widget
@@ -66,21 +51,22 @@
         self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
         self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
         
-        self.__pyvenv = pyvenv
-        self.__targetDir = targetDir
-        self.__openTarget = openTarget
-        self.__createLog = createLog
-        self.__createScript = createScript
-        self.__venvName = venvName
+        self.__pyvenv = configuration["envType"] == "pyvenv"
+        self.__targetDir = configuration["targetDirectory"]
+        self.__openTarget = configuration["openTarget"]
+        self.__createLog = configuration["createLog"]
+        self.__createScript = configuration["createScript"]
+        self.__venvName = configuration["logicalName"]
         self.__venvManager = venvManager
         
         self.__process = None
         self.__cmd = ""
         
-        if pyvenv:
+        if self.__pyvenv:
             self.__calls = []
-            if interpreter:
-                self.__calls.append((interpreter, ["-m", "venv"]))
+            if configuration["pythonExe"]:
+                self.__calls.append((configuration["pythonExe"],
+                                     ["-m", "venv"]))
             self.__calls.extend([
                 (sys.executable.replace("w.exe", ".exe"),
                  ["-m", "venv"]),
--- a/VirtualEnv/VirtualenvManager.py	Sat Jan 26 19:42:53 2019 +0100
+++ b/VirtualEnv/VirtualenvManager.py	Sun Jan 27 12:39:53 2019 +0100
@@ -21,6 +21,7 @@
 from E5Gui import E5MessageBox
 
 import Preferences
+import Utilities
 
 
 class VirtualenvManager(QObject):
@@ -157,9 +158,6 @@
                 # now do the call
                 from .VirtualenvExecDialog import VirtualenvExecDialog
                 dia = VirtualenvExecDialog(resultDict, self)
-##                dia = VirtualenvExecDialog(pyvenv, targetDir, name, openTarget,
-##                                           createLog, createScript, interpreter,
-##                                           self)
             dia.show()
             dia.start(resultDict["arguments"])
             dia.exec_()
@@ -203,7 +201,9 @@
             dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory)
             if dlg.exec_() == QDialog.Accepted:
                 venvInterpreter, venvVariant = dlg.getData()
-                isGlobal = True
+                if not Utilities.startswithPath(venvInterpreter,
+                                                venvDirectory):
+                    isGlobal = True
         
         if venvInterpreter:
             self.__virtualEnvironments[venvName] = {

eric ide

mercurial