74 self.condaCloneDirectoryPicker.setWindowTitle( |
74 self.condaCloneDirectoryPicker.setWindowTitle( |
75 self.tr("Conda Environment Location")) |
75 self.tr("Conda Environment Location")) |
76 self.condaCloneDirectoryPicker.setDefaultDirectory( |
76 self.condaCloneDirectoryPicker.setDefaultDirectory( |
77 Utilities.getHomeDir()) |
77 Utilities.getHomeDir()) |
78 |
78 |
79 # TODO: add creation from requirements |
79 self.condaRequirementsFilePicker.setMode( |
|
80 E5PathPickerModes.OpenFileMode) |
|
81 self.condaRequirementsFilePicker.setWindowTitle( |
|
82 self.tr("Conda Requirements File")) |
|
83 self.condaRequirementsFilePicker.setDefaultDirectory( |
|
84 Utilities.getHomeDir()) |
|
85 self.condaRequirementsFilePicker.setFilters( |
|
86 self.tr("Text Files (*.txt);;All Files (*)")) |
80 |
87 |
81 self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""") |
88 self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""") |
82 |
89 |
83 self.__virtualenvFound = False |
90 self.__virtualenvFound = False |
84 self.__pyvenvFound = False |
91 self.__pyvenvFound = False |
119 bool(self.nameEdit.text()) |
126 bool(self.nameEdit.text()) |
120 ) |
127 ) |
121 elif self.condaButton.isChecked(): |
128 elif self.condaButton.isChecked(): |
122 enable = bool(self.condaNameEdit.text()) or \ |
129 enable = bool(self.condaNameEdit.text()) or \ |
123 bool(self.condaTargetDirectoryPicker.text()) |
130 bool(self.condaTargetDirectoryPicker.text()) |
124 if self.condaCloneGroup.isChecked(): |
131 if self.condaSpecialsGroup.isChecked(): |
125 enable &= bool(self.condaCloneNameEdit.text()) or \ |
132 if self.condaCloneButton.isChecked(): |
126 bool(self.condaCloneDirectoryPicker.text()) |
133 enable &= bool(self.condaCloneNameEdit.text()) or \ |
|
134 bool(self.condaCloneDirectoryPicker.text()) |
|
135 elif self.condaRequirementsButton.isChecked(): |
|
136 enable &= bool(self.condaRequirementsFilePicker.text()) |
127 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
137 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
128 else: |
138 else: |
129 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
139 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
130 |
140 |
131 def __updateUi(self): |
141 def __updateUi(self): |
147 self.noSetuptoolsCheckBox.setEnabled(enable) |
157 self.noSetuptoolsCheckBox.setEnabled(enable) |
148 self.symlinkCheckBox.setEnabled(not enable) |
158 self.symlinkCheckBox.setEnabled(not enable) |
149 self.upgradeCheckBox.setEnabled(not enable) |
159 self.upgradeCheckBox.setEnabled(not enable) |
150 |
160 |
151 # conda page |
161 # conda page |
152 # TODO: add creation from requirements |
162 enable = not self.condaSpecialsGroup.isChecked() |
153 enable = not self.condaCloneGroup.isChecked() |
|
154 self.condaPackagesEdit.setEnabled(enable) |
163 self.condaPackagesEdit.setEnabled(enable) |
155 self.condaPythonEdit.setEnabled(enable) |
164 self.condaPythonEdit.setEnabled(enable) |
156 self.condaInsecureCheckBox.setEnabled( |
165 self.condaInsecureCheckBox.setEnabled( |
157 enable and CondaInterface.condaVersion() >= (4, 3, 18)) |
166 enable and CondaInterface.condaVersion() >= (4, 3, 18)) |
158 self.condaDryrunCheckBox.setEnabled(enable) |
167 self.condaDryrunCheckBox.setEnabled(enable) |
257 def on_condaCloneDirectoryPicker_textChanged(self, txt): |
266 def on_condaCloneDirectoryPicker_textChanged(self, txt): |
258 """ |
267 """ |
259 Private slot handling a change of the cloned from directory. |
268 Private slot handling a change of the cloned from directory. |
260 |
269 |
261 @param txt target directory |
270 @param txt target directory |
|
271 @type str |
|
272 """ |
|
273 self.__updateOK() |
|
274 |
|
275 @pyqtSlot() |
|
276 def on_condaCloneButton_clicked(self): |
|
277 """ |
|
278 Private slot handling the selection of the clone button. |
|
279 """ |
|
280 self.__updateOK() |
|
281 |
|
282 @pyqtSlot() |
|
283 def on_condaRequirementsButton_clicked(self): |
|
284 """ |
|
285 Private slot handling the selection of the requirements button. |
|
286 """ |
|
287 self.__updateOK() |
|
288 |
|
289 @pyqtSlot(str) |
|
290 def on_condaRequirementsFilePicker_textChanged(self, txt): |
|
291 """ |
|
292 Private slot handling a change of the requirements file entry. |
|
293 |
|
294 @param txt current text of the requirements file entry |
262 @type str |
295 @type str |
263 """ |
296 """ |
264 self.__updateOK() |
297 self.__updateOK() |
265 |
298 |
266 def __setVirtualenvVersion(self): |
299 def __setVirtualenvVersion(self): |
409 if bool(self.condaNameEdit.text()): |
442 if bool(self.condaNameEdit.text()): |
410 args.extend(["--name", self.condaNameEdit.text()]) |
443 args.extend(["--name", self.condaNameEdit.text()]) |
411 if bool(self.condaTargetDirectoryPicker.text()): |
444 if bool(self.condaTargetDirectoryPicker.text()): |
412 args.extend(["--prefix", |
445 args.extend(["--prefix", |
413 self.condaTargetDirectoryPicker.text()]) |
446 self.condaTargetDirectoryPicker.text()]) |
414 if self.condaCloneGroup.isChecked(): |
447 if self.condaSpecialsGroup.isChecked(): |
415 if bool(self.condaCloneNameEdit.text()): |
448 if self.condaCloneButton.isChecked(): |
416 args.extend(["--clone", self.condaCloneNameEdit.text()]) |
449 if bool(self.condaCloneNameEdit.text()): |
417 elif bool(self.condaCloneDirectoryPicker.text()): |
450 args.extend( |
418 args.extend(["--clone", |
451 ["--clone", self.condaCloneNameEdit.text()] |
419 self.condaCloneDirectoryPicker.text()]) |
452 ) |
|
453 elif bool(self.condaCloneDirectoryPicker.text()): |
|
454 args.extend(["--clone", |
|
455 self.condaCloneDirectoryPicker.text()]) |
|
456 elif self.condaRequirementsButton.isChecked(): |
|
457 args.extend( |
|
458 ["--file", self.condaRequirementsFilePicker.text()] |
|
459 ) |
420 if self.condaInsecureCheckBox.isChecked(): |
460 if self.condaInsecureCheckBox.isChecked(): |
421 args.append("--insecure") |
461 args.append("--insecure") |
422 if self.condaDryrunCheckBox.isChecked(): |
462 if self.condaDryrunCheckBox.isChecked(): |
423 args.append("--dry-run") |
463 args.append("--dry-run") |
424 # TODO: add creation from requirements |
464 if not self.condaSpecialsGroup.isChecked(): |
425 if not self.condaCloneGroup.isChecked(): |
|
426 if bool(self.condaPythonEdit.text()): |
465 if bool(self.condaPythonEdit.text()): |
427 args.append("python={0}".format( |
466 args.append("python={0}".format( |
428 self.condaPythonEdit.text())) |
467 self.condaPythonEdit.text())) |
429 if bool(self.condaPackagesEdit.text()): |
468 if bool(self.condaPackagesEdit.text()): |
430 args.extend(self.condaPackagesEdit.text().split()) |
469 args.extend(self.condaPackagesEdit.text().split()) |