VirtualEnv/VirtualenvExecDialog.py

branch
maintenance
changeset 6826
c6dda2cbe081
parent 6696
706185900558
equal deleted inserted replaced
6764:d14ddbfbbd36 6826:c6dda2cbe081
31 Class implementing the virtualenv execution dialog. 31 Class implementing the virtualenv execution dialog.
32 32
33 This class starts a QProcess and displays a dialog that 33 This class starts a QProcess and displays a dialog that
34 shows the output of the virtualenv or pyvenv process. 34 shows the output of the virtualenv or pyvenv process.
35 """ 35 """
36 def __init__(self, pyvenv, targetDir, venvName, openTarget, createLog, 36 def __init__(self, configuration, venvManager, parent=None):
37 createScript, interpreter, venvManager, parent=None):
38 """ 37 """
39 Constructor 38 Constructor
40 39
41 @param pyvenv flag indicating the use of 'pyvenv' 40 @param configuration dictionary containing the configuration parameters
42 @type bool 41 as returned by the command configuration dialog
43 @param targetDir name of the virtualenv directory 42 @type dict
44 @type str
45 @param venvName logical name for the virtual environment
46 @type str
47 @param openTarget flag indicating to open the virtualenv directory
48 in a file manager
49 @type bool
50 @param createLog flag indicating to create a log file of the
51 creation process
52 @type bool
53 @param createScript flag indicating to create a script to recreate
54 the virtual environment
55 @type bool
56 @param interpreter name of the python interpreter to use
57 @type str
58 @param venvManager reference to the virtual environment manager 43 @param venvManager reference to the virtual environment manager
59 @type VirtualenvManager 44 @type VirtualenvManager
60 @param parent reference to the parent widget 45 @param parent reference to the parent widget
61 @type QWidget 46 @type QWidget
62 """ 47 """
64 self.setupUi(self) 49 self.setupUi(self)
65 50
66 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 51 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
67 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 52 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
68 53
69 self.__pyvenv = pyvenv 54 self.__pyvenv = configuration["envType"] == "pyvenv"
70 self.__targetDir = targetDir 55 self.__targetDir = configuration["targetDirectory"]
71 self.__openTarget = openTarget 56 self.__openTarget = configuration["openTarget"]
72 self.__createLog = createLog 57 self.__createLog = configuration["createLog"]
73 self.__createScript = createScript 58 self.__createScript = configuration["createScript"]
74 self.__venvName = venvName 59 self.__venvName = configuration["logicalName"]
75 self.__venvManager = venvManager 60 self.__venvManager = venvManager
76 61
77 self.__process = None 62 self.__process = None
78 self.__cmd = "" 63 self.__cmd = ""
79 64
80 if pyvenv: 65 if self.__pyvenv:
81 self.__calls = [] 66 self.__calls = []
82 if interpreter: 67 if configuration["pythonExe"]:
83 self.__calls.append((interpreter, ["-m", "venv"])) 68 self.__calls.append((configuration["pythonExe"],
69 ["-m", "venv"]))
84 self.__calls.extend([ 70 self.__calls.extend([
85 (sys.executable.replace("w.exe", ".exe"), 71 (sys.executable.replace("w.exe", ".exe"),
86 ["-m", "venv"]), 72 ["-m", "venv"]),
87 ("python3", ["-m", "venv"]), 73 ("python3", ["-m", "venv"]),
88 ("python", ["-m", "venv"]), 74 ("python", ["-m", "venv"]),
248 234
249 def __logOutput(self, s): 235 def __logOutput(self, s):
250 """ 236 """
251 Private method to log some output. 237 Private method to log some output.
252 238
253 @param s output sstring to log (string) 239 @param s output string to log (string)
254 """ 240 """
255 self.contents.insertPlainText(s) 241 self.contents.insertPlainText(s)
256 self.contents.ensureCursorVisible() 242 self.contents.ensureCursorVisible()
257 243
258 def __logError(self, s): 244 def __logError(self, s):

eric ide

mercurial