VirtualEnv/VirtualenvConfigurationDialog.py

branch
conda
changeset 6681
9c1513b488ef
parent 6678
5f1de9e59227
child 6684
37e280d711af
equal deleted inserted replaced
6679:c5f7b2e9a06d 6681:9c1513b488ef
25 25
26 from .Ui_VirtualenvConfigurationDialog import Ui_VirtualenvConfigurationDialog 26 from .Ui_VirtualenvConfigurationDialog import Ui_VirtualenvConfigurationDialog
27 27
28 import Preferences 28 import Preferences
29 import Utilities 29 import Utilities
30
31 import CondaInterface
30 32
31 33
32 class VirtualenvConfigurationDialog(QDialog, Ui_VirtualenvConfigurationDialog): 34 class VirtualenvConfigurationDialog(QDialog, Ui_VirtualenvConfigurationDialog):
33 """ 35 """
34 Class implementing a dialog to enter the parameters for the 36 Class implementing a dialog to enter the parameters for the
95 self.pyvenvButton.setChecked(True) 97 self.pyvenvButton.setChecked(True)
96 elif self.__virtualenvFound: 98 elif self.__virtualenvFound:
97 self.virtualenvButton.setChecked(True) 99 self.virtualenvButton.setChecked(True)
98 elif self.__condaFound: 100 elif self.__condaFound:
99 self.condaButton.setChecked(True) 101 self.condaButton.setChecked(True)
102
103 self.condaInsecureCheckBox.setEnabled(
104 CondaInterface.condaVersion() >= (4, 3, 18))
100 105
101 msh = self.minimumSizeHint() 106 msh = self.minimumSizeHint()
102 self.resize(max(self.width(), msh.width()), msh.height()) 107 self.resize(max(self.width(), msh.width()), msh.height())
103 108
104 def __updateOK(self): 109 def __updateOK(self):
143 148
144 # conda page 149 # conda page
145 enable = not self.condaCloneGroup.isChecked() 150 enable = not self.condaCloneGroup.isChecked()
146 self.condaPackagesEdit.setEnabled(enable) 151 self.condaPackagesEdit.setEnabled(enable)
147 self.condaPythonEdit.setEnabled(enable) 152 self.condaPythonEdit.setEnabled(enable)
148 self.condaInsecureCheckBox.setEnabled(enable) 153 self.condaInsecureCheckBox.setEnabled(
154 enable and CondaInterface.condaVersion() >= (4, 3, 18))
149 self.condaDryrunCheckBox.setEnabled(enable) 155 self.condaDryrunCheckBox.setEnabled(enable)
150 156
151 # select page 157 # select page
152 if self.condaButton.isChecked(): 158 if self.condaButton.isChecked():
153 self.venvStack.setCurrentWidget(self.condaPage) 159 self.venvStack.setCurrentWidget(self.condaPage)
365 def __setCondaVersion(self): 371 def __setCondaVersion(self):
366 """ 372 """
367 Private method to determine the conda version and set the respective 373 Private method to determine the conda version and set the respective
368 label. 374 label.
369 """ 375 """
370 exe = Preferences.getConda("CondaExecutable") 376 self.__condaFound = bool(CondaInterface.condaVersion())
371 if not exe:
372 exe = "conda"
373
374 proc = QProcess()
375 proc.start(exe, ["--version"])
376 if not proc.waitForStarted(5000):
377 self.__condaFound = False
378 version = self.tr('<conda not found or not configured.>')
379 else:
380 proc.waitForFinished(5000)
381 output = str(proc.readAllStandardOutput(),
382 Preferences.getSystem("IOEncoding"),
383 'replace').strip()
384 match = re.match(self.__versionRe, output)
385 if match:
386 self.__condaFound = True
387 version = match.group(1)
388 else:
389 self.__condaFound = False
390 version = self.tr('<conda returned strange version info.')
391 self.condaButton.setText(self.tr( 377 self.condaButton.setText(self.tr(
392 "conda Version: {0}".format(version))) 378 "conda Version: {0}".format(CondaInterface.condaVersionStr())))
393 self.condaButton.setEnabled(self.__condaFound) 379 self.condaButton.setEnabled(self.__condaFound)
394 if not self.__condaFound: 380 if not self.__condaFound:
395 self.condaButton.setChecked(False) 381 self.condaButton.setChecked(False)
396 382
397 def __generateTargetDir(self): 383 def __generateTargetDir(self):

eric ide

mercurial