25 class VirtualenvAddEditDialog(QDialog, Ui_VirtualenvAddEditDialog): |
25 class VirtualenvAddEditDialog(QDialog, Ui_VirtualenvAddEditDialog): |
26 """ |
26 """ |
27 Class implementing a dialog to enter the data of a virtual environment. |
27 Class implementing a dialog to enter the data of a virtual environment. |
28 """ |
28 """ |
29 def __init__(self, manager, venvName="", venvDirectory="", |
29 def __init__(self, manager, venvName="", venvDirectory="", |
30 venvInterpreter="", parent=None): |
30 venvInterpreter="", venvVariant=3, parent=None): |
31 """ |
31 """ |
32 Constructor |
32 Constructor |
33 |
33 |
34 @param manager reference to the virtual environment manager |
34 @param manager reference to the virtual environment manager |
35 @type VirtualenvManager |
35 @type VirtualenvManager |
37 @type str |
37 @type str |
38 @param venvDirectory directory of the virtual environment |
38 @param venvDirectory directory of the virtual environment |
39 @type str |
39 @type str |
40 @param venvInterpreter Python interpreter of the virtual environment |
40 @param venvInterpreter Python interpreter of the virtual environment |
41 @type str |
41 @type str |
|
42 @param venvVariant Python variant of the virtual environment |
|
43 @type int |
42 @param parent reference to the parent widget |
44 @param parent reference to the parent widget |
43 @type QWidget |
45 @type QWidget |
44 """ |
46 """ |
45 super(VirtualenvAddEditDialog, self).__init__(parent) |
47 super(VirtualenvAddEditDialog, self).__init__(parent) |
46 self.setupUi(self) |
48 self.setupUi(self) |
61 sys.executable.replace("w.exe", ".exe")) |
63 sys.executable.replace("w.exe", ".exe")) |
62 |
64 |
63 self.nameEdit.setText(venvName) |
65 self.nameEdit.setText(venvName) |
64 self.targetDirectoryPicker.setText(venvDirectory) |
66 self.targetDirectoryPicker.setText(venvDirectory) |
65 self.pythonExecPicker.setText(venvInterpreter) |
67 self.pythonExecPicker.setText(venvInterpreter) |
|
68 self.variantComboBox.setCurrentIndex(3 - venvVariant) |
66 self.globalCheckBox.setChecked(self.__editMode and |
69 self.globalCheckBox.setChecked(self.__editMode and |
67 not bool(venvDirectory)) |
70 not bool(venvDirectory)) |
68 |
71 |
69 self.__updateOk() |
72 self.__updateOk() |
70 |
73 |
149 |
152 |
150 def getData(self): |
153 def getData(self): |
151 """ |
154 """ |
152 Public method to retrieve the entered data. |
155 Public method to retrieve the entered data. |
153 |
156 |
154 @return tuple containing the logical name, the directory and the |
157 @return tuple containing the logical name, the directory, the |
155 interpreter of the virtual environment |
158 interpreter of the virtual environment and the Python variant |
156 @rtype tuple of (str, str, str) |
159 @rtype tuple of (str, str, str, int) |
157 """ |
160 """ |
158 if self.globalCheckBox.isChecked(): |
161 if self.globalCheckBox.isChecked(): |
159 return ( |
162 return ( |
160 self.nameEdit.text(), |
163 self.nameEdit.text(), |
161 "", |
164 "", |
162 self.pythonExecPicker.text(), |
165 self.pythonExecPicker.text(), |
|
166 3 - self.variantComboBox.currentIndex(), |
163 ) |
167 ) |
164 else: |
168 else: |
165 return ( |
169 return ( |
166 self.nameEdit.text(), |
170 self.nameEdit.text(), |
167 self.targetDirectoryPicker.text(), |
171 self.targetDirectoryPicker.text(), |
168 self.pythonExecPicker.text(), |
172 self.pythonExecPicker.text(), |
|
173 3 - self.variantComboBox.currentIndex(), |
169 ) |
174 ) |