61 sys.executable.replace("w.exe", ".exe")) |
61 sys.executable.replace("w.exe", ".exe")) |
62 |
62 |
63 self.nameEdit.setText(venvName) |
63 self.nameEdit.setText(venvName) |
64 self.targetDirectoryPicker.setText(venvDirectory) |
64 self.targetDirectoryPicker.setText(venvDirectory) |
65 self.pythonExecPicker.setText(venvInterpreter) |
65 self.pythonExecPicker.setText(venvInterpreter) |
|
66 self.globalCheckBox.setChecked(self.__editMode and |
|
67 not bool(venvDirectory)) |
66 |
68 |
67 self.__updateOk() |
69 self.__updateOk() |
68 |
70 |
69 def __updateOk(self): |
71 def __updateOk(self): |
70 """ |
72 """ |
79 else: |
81 else: |
80 enable = ( |
82 enable = ( |
81 bool(self.nameEdit.text()) and |
83 bool(self.nameEdit.text()) and |
82 self.__manager.isUnique(self.nameEdit.text()) |
84 self.__manager.isUnique(self.nameEdit.text()) |
83 ) |
85 ) |
84 |
86 |
|
87 if not self.globalCheckBox.isChecked(): |
|
88 enable = ( |
|
89 enable and |
|
90 bool(self.targetDirectoryPicker.text()) and |
|
91 os.path.exists(self.targetDirectoryPicker.text()) |
|
92 ) |
|
93 |
85 enable = ( |
94 enable = ( |
86 enable and |
95 enable and |
87 bool(self.targetDirectoryPicker.text()) and |
|
88 os.path.exists(self.targetDirectoryPicker.text()) and |
|
89 bool(self.pythonExecPicker.text()) and |
96 bool(self.pythonExecPicker.text()) and |
90 os.access(self.pythonExecPicker.text(), os.X_OK) |
97 os.access(self.pythonExecPicker.text(), os.X_OK) |
91 ) |
98 ) |
92 |
99 |
93 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
100 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
126 @param txt virtual environment interpreter |
133 @param txt virtual environment interpreter |
127 @type str |
134 @type str |
128 """ |
135 """ |
129 self.__updateOk() |
136 self.__updateOk() |
130 |
137 |
|
138 @pyqtSlot(bool) |
|
139 def on_globalCheckBox_toggled(self, checked): |
|
140 """ |
|
141 Private slot handling a change of the global check box state. |
|
142 |
|
143 @param checked state of the check box |
|
144 @type bool |
|
145 """ |
|
146 self.targetDirectoryPicker.setEnabled(not checked) |
|
147 |
|
148 self.__updateOk() |
|
149 |
131 def getData(self): |
150 def getData(self): |
132 """ |
151 """ |
133 Public method to retrieve the entered data. |
152 Public method to retrieve the entered data. |
134 |
153 |
135 @return tuple containing the logical name, the directory and the |
154 @return tuple containing the logical name, the directory and the |
136 interpreter of the virtual environment |
155 interpreter of the virtual environment |
137 @rtype tuple of (str, str, str) |
156 @rtype tuple of (str, str, str) |
138 """ |
157 """ |
139 return ( |
158 if self.globalCheckBox.isChecked(): |
140 self.nameEdit.text(), |
159 return ( |
141 self.targetDirectoryPicker.text(), |
160 self.nameEdit.text(), |
142 self.pythonExecPicker.text(), |
161 "", |
143 ) |
162 self.pythonExecPicker.text(), |
|
163 ) |
|
164 else: |
|
165 return ( |
|
166 self.nameEdit.text(), |
|
167 self.targetDirectoryPicker.text(), |
|
168 self.pythonExecPicker.text(), |
|
169 ) |