Sat, 26 Jan 2019 19:42:53 +0100
Started implementing support conda virtual environments.
--- a/Preferences/ConfigurationDialog.py Sat Jan 26 17:04:11 2019 +0100 +++ b/Preferences/ConfigurationDialog.py Sat Jan 26 19:42:53 2019 +0100 @@ -142,6 +142,9 @@ "applicationPage": [self.tr("Application"), "preferences-application.png", "ApplicationPage", None, None], + "condaPage": + [self.tr("Conda"), "miniconda.png", + "CondaPage", None, None], "cooperationPage": [self.tr("Cooperation"), "preferences-cooperation.png", "CooperationPage", None, None],
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Preferences/ConfigurationPages/CondaPage.py Sat Jan 26 19:42:53 2019 +0100 @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the conda configuration page. +""" + +from __future__ import unicode_literals + +from E5Gui.E5PathPicker import E5PathPickerModes + +from .ConfigurationPageBase import ConfigurationPageBase +from .Ui_CondaPage import Ui_CondaPage + +import Preferences + + +class CondaPage(ConfigurationPageBase, Ui_CondaPage): + """ + Class implementing the conda configuration page. + """ + def __init__(self): + """ + Constructor + + @param parent reference to the parent widget + @type QWidget + """ + super(CondaPage, self).__init__() + self.setupUi(self) + self.setObjectName("CondaPage") + + self.condaExePicker.setMode(E5PathPickerModes.OpenFileMode) + self.condaExePicker.setToolTip(self.tr( + "Press to select the conda executable via a file selection" + " dialog.")) + + # set initial values + self.condaExePicker.setText(Preferences.getConda("CondaExecutable")) + + def save(self): + """ + Public slot to save the conda configuration. + """ + Preferences.setConda("CondaExecutable", self.condaExePicker.text()) + + +def create(dlg): + """ + Module function to create the configuration page. + + @param dlg reference to the configuration dialog + @return reference to the instantiated page (ConfigurationPageBase) + """ + page = CondaPage() + return page
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Preferences/ConfigurationPages/CondaPage.ui Sat Jan 26 19:42:53 2019 +0100 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CondaPage</class> + <widget class="QWidget" name="CondaPage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>585</width> + <height>431</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="headerLabel"> + <property name="text"> + <string><b>Configure "conda" support</b></string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line13"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>conda Executable</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="E5PathPicker" name="condaExePicker" native="true"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the path to the conda executable.</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="textLabel1_4"> + <property name="text"> + <string><b>Note:</b> Leave this entry empty to use the default value (conda or conda.exe).</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>292</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>E5PathPicker</class> + <extends>QWidget</extends> + <header>E5Gui/E5PathPicker.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui>
--- a/Preferences/ProgramsDialog.py Sat Jan 26 17:04:11 2019 +0100 +++ b/Preferences/ProgramsDialog.py Sat Jan 26 19:42:53 2019 +0100 @@ -215,8 +215,17 @@ Utilities.isWindowsPlatform() and "rbrcc.exe" or "rbrcc", '-version', 'Ruby Resource Compiler', -1) - # 5. do the CORBA and Protobuf programs - # 5a. omniORB + # 5. do the Conda program(s) + exe = Preferences.getConda("CondaExecutable") + if not exe: + exe = "conda" + if Utilities.isWindowsPlatform(): + exe += ".exe" + self.__createProgramEntry( + self.tr("conda Manager"), exe, '--version', 'conda', -1) + + # 6. do the CORBA and Protobuf programs + # 6a. omniORB exe = Preferences.getCorba("omniidl") if not exe: exe = "omniidl" @@ -224,7 +233,7 @@ exe += ".exe" self.__createProgramEntry( self.tr("CORBA IDL Compiler"), exe, '-V', 'omniidl', -1) - # 5b. protobuf + # 6b. protobuf exe = Preferences.getProtobuf("protoc") if not exe: exe = "protoc" @@ -232,7 +241,7 @@ exe += ".exe" self.__createProgramEntry( self.tr("Protobuf Compiler"), exe, '--version', 'libprotoc', -1) - # 5c. grpc + # 6c. grpc exe = Preferences.getProtobuf("grpcPython") if not exe: exe = sys.executable @@ -240,7 +249,7 @@ self.tr("gRPC Compiler"), exe, '--version', 'libprotoc', -1, exeModule=['-m', 'grpc_tools.protoc']) - # 6. do the spell checking entry + # 7. do the spell checking entry try: import enchant try: @@ -257,7 +266,7 @@ self.__createEntry( self.tr("Spell Checker - PyEnchant"), text, version) - # 7. do the pygments entry + # 8. do the pygments entry try: import pygments try: @@ -274,7 +283,7 @@ self.__createEntry( self.tr("Source Highlighter - Pygments"), text, version) - # do the plugin related programs + # 9. do the plugin related programs pm = e5App().getObject("PluginManager") for info in pm.getPluginExeDisplayData(): if info["programEntry"]:
--- a/Preferences/__init__.py Sat Jan 26 17:04:11 2019 +0100 +++ b/Preferences/__init__.py Sat Jan 26 19:42:53 2019 +0100 @@ -1580,6 +1580,11 @@ "Provider": "disabled", "ShowInfoOnOpenParenthesis": True, } + + # defaults for conda + condaDefaults = { + "CondaExecutable": "", + } def readToolGroups(prefClass=Prefs): @@ -3720,7 +3725,7 @@ @param key the key of the value to get @param prefClass preferences class used as the storage area - @return the requested editor colour + @return the requested Code Documentation Viewer value """ if key in ["ShowInfoAsRichText", "ShowInfoOnOpenParenthesis"]: return toBool(prefClass.settings.value( @@ -3743,6 +3748,30 @@ prefClass.settings.setValue("CodeDocumentationViewer/" + key, value) +def getConda(key, prefClass=Prefs): + """ + Module function to retrieve the conda related settings. + + @param key the key of the value to get + @param prefClass preferences class used as the storage area + @return the requested conda value + """ + return prefClass.settings.value( + "Conda/" + key, + prefClass.condaDefaults[key]) + + +def setConda(key, value, prefClass=Prefs): + """ + Module function to store the conda related settings. + + @param key the key of the setting to be set + @param value the value to be set + @param prefClass preferences class used as the storage area + """ + prefClass.settings.setValue("Conda/" + key, value) + + def getGeometry(key, prefClass=Prefs): """ Module function to retrieve the display geometry.
--- a/VirtualEnv/VirtualenvConfigurationDialog.py Sat Jan 26 17:04:11 2019 +0100 +++ b/VirtualEnv/VirtualenvConfigurationDialog.py Sat Jan 26 19:42:53 2019 +0100 @@ -60,22 +60,43 @@ self.pythonExecPicker.setDefaultDirectory( sys.executable.replace("w.exe", ".exe")) + self.condaTargetDirectoryPicker.setMode( + E5PathPickerModes.DirectoryMode) + self.condaTargetDirectoryPicker.setWindowTitle( + self.tr("Conda Environment Location")) + self.condaTargetDirectoryPicker.setDefaultDirectory( + Utilities.getHomeDir()) + + self.condaCloneDirectoryPicker.setMode( + E5PathPickerModes.DirectoryMode) + self.condaCloneDirectoryPicker.setWindowTitle( + self.tr("Conda Environment Location")) + self.condaCloneDirectoryPicker.setDefaultDirectory( + Utilities.getHomeDir()) + self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""") self.__virtualenvFound = False self.__pyvenvFound = False + self.__condaFound = False self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) self.__mandatoryStyleSheet = "QLineEdit {border: 2px solid;}" self.targetDirectoryPicker.setStyleSheet(self.__mandatoryStyleSheet) self.nameEdit.setStyleSheet(self.__mandatoryStyleSheet) + self.condaTargetDirectoryPicker.setStyleSheet( + self.__mandatoryStyleSheet) + self.condaNameEdit.setStyleSheet(self.__mandatoryStyleSheet) self.__setVirtualenvVersion() self.__setPyvenvVersion() - if self.__virtualenvFound: + self.__setCondaVersion() + if self.__pyvenvFound: + self.pyvenvButton.setChecked(True) + elif self.__virtualenvFound: self.virtualenvButton.setChecked(True) - elif self.__pyvenvFound: - self.pyvenvButton.setChecked(True) + elif self.__condaFound: + self.condaButton.setChecked(True) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -84,17 +105,28 @@ """ Private method to update the enabled status of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - (self.__virtualenvFound or self.__pyvenvFound) and - bool(self.targetDirectoryPicker.text()) and - bool(self.nameEdit.text()) - ) + if self.virtualenvButton.isChecked() or self.pyvenvButton.isChecked(): + self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + (self.__virtualenvFound or self.__pyvenvFound) and + bool(self.targetDirectoryPicker.text()) and + bool(self.nameEdit.text()) + ) + elif self.condaButton.isChecked(): + enable = bool(self.condaNameEdit.text()) or \ + bool(self.condaTargetDirectoryPicker.text()) + if self.condaCloneGroup.isChecked(): + enable &= bool(self.condaCloneNameEdit.text()) or \ + bool(self.condaCloneDirectoryPicker.text()) + self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + else: + self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) def __updateUi(self): """ Private method to update the UI depending on the selected virtual environment creator (virtualenv or pyvenv). """ + # venv page enable = self.virtualenvButton.isChecked() self.extraSearchPathLabel.setEnabled(enable) self.extraSearchPathPicker.setEnabled(enable) @@ -108,6 +140,19 @@ self.noSetuptoolsCheckBox.setEnabled(enable) self.symlinkCheckBox.setEnabled(not enable) self.upgradeCheckBox.setEnabled(not enable) + + # conda page + enable = not self.condaCloneGroup.isChecked() + self.condaPackagesEdit.setEnabled(enable) + self.condaPythonEdit.setEnabled(enable) + self.condaInsecureCheckBox.setEnabled(enable) + self.condaDryrunCheckBox.setEnabled(enable) + + # select page + if self.condaButton.isChecked(): + self.venvStack.setCurrentWidget(self.condaPage) + else: + self.venvStack.setCurrentWidget(self.venvPage) @pyqtSlot(str) def on_targetDirectoryPicker_textChanged(self, txt): @@ -151,6 +196,64 @@ """ self.__updateUi() + @pyqtSlot(bool) + def on_condaButton_toggled(self, checked): + """ + Private slot to react to the selection of 'conda'. + + @param checked state of the checkbox + @type bool + """ + self.__updateUi() + + @pyqtSlot(str) + def on_condaNameEdit_textChanged(self, txt): + """ + Private slot handling a change of the conda environment name. + + @param txt environment name + @type str + """ + self.__updateOK() + + @pyqtSlot(str) + def on_condaTargetDirectoryPicker_textChanged(self, txt): + """ + Private slot handling a change of the conda target directory. + + @param txt target directory + @type str + """ + self.__updateOK() + + @pyqtSlot() + def on_condaCloneGroup_clicked(self): + """ + Private slot handling the selection of the clone group. + """ + self.__updateOK() + self.__updateUi() + + @pyqtSlot(str) + def on_condaCloneNameEdit_textChanged(self, txt): + """ + Private slot handling a change of the conda source environment name. + + @param txt name of the environment to be cloned + @type str + """ + self.__updateOK() + + @pyqtSlot(str) + def on_condaCloneDirectoryPicker_textChanged(self, txt): + """ + Private slot handling a change of the cloned from directory. + + @param txt target directory + @type str + """ + self.__updateOK() + def __setVirtualenvVersion(self): """ Private method to determine the virtualenv version and set the @@ -259,6 +362,38 @@ if not self.__pyvenvFound: self.pyvenvButton.setChecked(False) + def __setCondaVersion(self): + """ + Private method to determine the conda version and set the respective + label. + """ + exe = Preferences.getConda("CondaExecutable") + if not exe: + exe = "conda" + + proc = QProcess() + proc.start(exe, ["--version"]) + if not proc.waitForStarted(5000): + self.__condaFound = False + version = self.tr('<conda not found or not configured.>') + else: + proc.waitForFinished(5000) + output = str(proc.readAllStandardOutput(), + Preferences.getSystem("IOEncoding"), + 'replace').strip() + match = re.match(self.__versionRe, output) + if match: + self.__condaFound = True + version = match.group(1) + else: + self.__condaFound = False + version = self.tr('<conda returned strange version info.') + self.condaButton.setText(self.tr( + "conda Version: {0}".format(version))) + self.condaButton.setEnabled(self.__condaFound) + if not self.__condaFound: + self.condaButton.setChecked(False) + def __generateTargetDir(self): """ Private method to generate a valid target directory path. @@ -281,75 +416,97 @@ @rtype list of str """ args = [] - if self.virtualenvButton.isChecked(): - if self.extraSearchPathPicker.text(): - args.append("--extra-search-dir={0}".format( - Utilities.toNativeSeparators( - self.extraSearchPathPicker.text()))) - if self.promptPrefixEdit.text(): - args.append("--prompt={0}".format( - self.promptPrefixEdit.text().replace(" ", "_"))) - if self.pythonExecPicker.text(): - args.append("--python={0}".format( - Utilities.toNativeSeparators( - self.pythonExecPicker.text()))) - elif self.versionComboBox.currentText(): - args.append("--python=python{0}".format( - self.versionComboBox.currentText())) - if self.verbositySpinBox.value() == 1: - args.append("--verbose") - elif self.verbositySpinBox.value() == -1: - args.append("--quiet") - if self.clearCheckBox.isChecked(): - args.append("--clear") - if self.systemCheckBox.isChecked(): - args.append("--system-site-packages") - if self.unzipCheckBox.isChecked(): - args.append("--unzip-setuptools") - if self.noSetuptoolsCheckBox.isChecked(): - args.append("--no-setuptools") - if self.noPipCcheckBox.isChecked(): - args.append("--no-pip") - if self.copyCheckBox.isChecked(): - args.append("--always-copy") - elif self.pyvenvButton.isChecked(): - if self.clearCheckBox.isChecked(): - args.append("--clear") - if self.systemCheckBox.isChecked(): - args.append("--system-site-packages") - if self.noPipCcheckBox.isChecked(): - args.append("--without-pip") - if self.copyCheckBox.isChecked(): - args.append("--copies") - if self.symlinkCheckBox.isChecked(): - args.append("--symlinks") - if self.upgradeCheckBox.isChecked(): - args.append("--upgrade") - targetDirectory = self.__generateTargetDir() - args.append(targetDirectory) + if self.condaButton.isChecked(): + # TODO: assemble the conda arguments + pass + else: + if self.virtualenvButton.isChecked(): + if self.extraSearchPathPicker.text(): + args.append("--extra-search-dir={0}".format( + Utilities.toNativeSeparators( + self.extraSearchPathPicker.text()))) + if self.promptPrefixEdit.text(): + args.append("--prompt={0}".format( + self.promptPrefixEdit.text().replace(" ", "_"))) + if self.pythonExecPicker.text(): + args.append("--python={0}".format( + Utilities.toNativeSeparators( + self.pythonExecPicker.text()))) + elif self.versionComboBox.currentText(): + args.append("--python=python{0}".format( + self.versionComboBox.currentText())) + if self.verbositySpinBox.value() == 1: + args.append("--verbose") + elif self.verbositySpinBox.value() == -1: + args.append("--quiet") + if self.clearCheckBox.isChecked(): + args.append("--clear") + if self.systemCheckBox.isChecked(): + args.append("--system-site-packages") + if self.unzipCheckBox.isChecked(): + args.append("--unzip-setuptools") + if self.noSetuptoolsCheckBox.isChecked(): + args.append("--no-setuptools") + if self.noPipCcheckBox.isChecked(): + args.append("--no-pip") + if self.copyCheckBox.isChecked(): + args.append("--always-copy") + elif self.pyvenvButton.isChecked(): + if self.clearCheckBox.isChecked(): + args.append("--clear") + if self.systemCheckBox.isChecked(): + args.append("--system-site-packages") + if self.noPipCcheckBox.isChecked(): + args.append("--without-pip") + if self.copyCheckBox.isChecked(): + args.append("--copies") + if self.symlinkCheckBox.isChecked(): + args.append("--symlinks") + if self.upgradeCheckBox.isChecked(): + args.append("--upgrade") + targetDirectory = self.__generateTargetDir() + args.append(targetDirectory) + return args def getData(self): """ Public method to retrieve the dialog data. - @return tuple containing a flag indicating the pyvenv selection, the - process arguments, a name for the virtual environment, a flag - indicating to open the target directory after creation, a flag - indicating to write a log file, a flag indicating to write a - script, the name of the target directory and the name of the - Python interpreter to use - @rtype tuple of (bool, list of str, str, bool, bool, bool, str, str) + @return dictionary containing the data for the two environment + variants. The keys for both variants are 'arguments' containing the + command line arguments, 'logicalName' containing the environment + name to be used with the virtual env manager and 'envType' + containing the environment type (virtualenv, pyvenv or conda). The + virtualenv/pyvenv specific keys are 'openTarget' containg a flag to + open the target directory after creation, 'createLog' containing a + flag to write a log file, 'createScript' containing a flag to write + a script, 'targetDirectory' containing the target directory and + 'pythonExe' containing the Python interpreter to be used. The conda + specific keys are + @rtype dict """ + # TODO: add the conda keys to the above description + # TODO: change to returning a method specific dictionary args = self.__generateArguments() - targetDirectory = self.__generateTargetDir() - return ( - self.pyvenvButton.isChecked(), - args, - self.nameEdit.text(), - self.openCheckBox.isChecked(), - self.logCheckBox.isChecked(), - self.scriptCheckBox.isChecked(), - targetDirectory, - Utilities.toNativeSeparators(self.pythonExecPicker.text()), - ) + resultDict = { + "arguments": args, + "logicalName": self.nameEdit.text(), + } + if self.condaButton.isChecked(): + resultDict.update({ + "envType": "conda", + }) + else: + resultDict.update({ + "envType": ("pyvenv" if self.pyvenvButton.isChecked() else + "virtualenv"), + "openTarget": self.openCheckBox.isChecked(), + "createLog": self.logCheckBox.isChecked(), + "createScript":self.scriptCheckBox.isChecked(), + "targetDirectory": self.__generateTargetDir(), + "pythonExe": Utilities.toNativeSeparators( + self.pythonExecPicker.text()), + }) + + return resultDict
--- a/VirtualEnv/VirtualenvConfigurationDialog.ui Sat Jan 26 17:04:11 2019 +0100 +++ b/VirtualEnv/VirtualenvConfigurationDialog.ui Sat Jan 26 19:42:53 2019 +0100 @@ -7,11 +7,11 @@ <x>0</x> <y>0</y> <width>700</width> - <height>592</height> + <height>622</height> </rect> </property> <property name="windowTitle"> - <string>Virtualenv Configuration</string> + <string>Virtual Environment Configuration</string> </property> <property name="sizeGripEnabled"> <bool>true</bool> @@ -68,6 +68,22 @@ </property> </widget> </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="condaButton"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="toolTip"> + <string>Select to use 'conda'</string> + </property> + <property name="text"> + <string notr="true">0.0</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -93,332 +109,563 @@ </layout> </item> <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Paths</string> + <widget class="QStackedWidget" name="venvStack"> + <property name="currentIndex"> + <number>1</number> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Target Directory:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="E5PathPicker" name="targetDirectoryPicker" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::WheelFocus</enum> - </property> - <property name="toolTip"> - <string>Enter the target directory for the virtual environment</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="extraSearchPathLabel"> - <property name="text"> - <string>Extra Search Path:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="E5PathPicker" name="extraSearchPathPicker" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::WheelFocus</enum> - </property> - <property name="toolTip"> - <string>Enter the extra search path to look for setuptools/pip</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="promptPrefixLabel"> - <property name="text"> - <string>Prompt Prefix:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="E5ClearableLineEdit" name="promptPrefixEdit"> - <property name="toolTip"> - <string>Enter the prompt prefix for the virtual environment</string> - </property> - <property name="placeholderText"> - <string>Prompt prefix for the virtual environment</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Python Executable:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="E5PathPicker" name="pythonExecPicker" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::WheelFocus</enum> - </property> - <property name="toolTip"> - <string>Enter the Python interpreter for the virtual environment</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Options</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="verbosityLabel"> - <property name="text"> - <string>Verbosity:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="verbositySpinBox"> - <property name="toolTip"> - <string>Select the verbosity (-1: quiet, 0: normal, 1: verbose)</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="minimum"> - <number>-1</number> - </property> - <property name="maximum"> - <number>1</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="versionLabel"> - <property name="text"> - <string>Python Version:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="versionComboBox"> - <property name="toolTip"> - <string>Select the Python version (empty for current)</string> - </property> - <item> + <widget class="QWidget" name="venvPage"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Paths</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Target Directory:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="E5PathPicker" name="targetDirectoryPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target directory for the virtual environment</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="extraSearchPathLabel"> + <property name="text"> + <string>Extra Search Path:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="extraSearchPathPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the extra search path to look for setuptools/pip</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="promptPrefixLabel"> + <property name="text"> + <string>Prompt Prefix:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="E5ClearableLineEdit" name="promptPrefixEdit"> + <property name="toolTip"> + <string>Enter the prompt prefix for the virtual environment</string> + </property> + <property name="placeholderText"> + <string>Prompt prefix for the virtual environment</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Python Executable:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="E5PathPicker" name="pythonExecPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the Python interpreter for the virtual environment</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Options</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="verbosityLabel"> + <property name="text"> + <string>Verbosity:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="verbositySpinBox"> + <property name="toolTip"> + <string>Select the verbosity (-1: quiet, 0: normal, 1: verbose)</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="minimum"> + <number>-1</number> + </property> + <property name="maximum"> + <number>1</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="versionLabel"> + <property name="text"> + <string>Python Version:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="versionComboBox"> + <property name="toolTip"> + <string>Select the Python version (empty for current)</string> + </property> + <item> + <property name="text"> + <string notr="true"/> + </property> + </item> + <item> + <property name="text"> + <string notr="true">2.6</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">2.7</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">3.4</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">3.5</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">3.6</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">3.7</string> + </property> + </item> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="systemCheckBox"> + <property name="toolTip"> + <string>Select to give the virtualenv access to the global site-packages</string> + </property> + <property name="text"> + <string>System-wide Python Packages</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="unzipCheckBox"> + <property name="toolTip"> + <string>Select to unzip setuptools when installing it</string> + </property> + <property name="text"> + <string>Unzip Setuptool to virtualenv</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="noSetuptoolsCheckBox"> + <property name="toolTip"> + <string>Select to not install setuptools (or pip) in the new virtualenv</string> + </property> + <property name="text"> + <string>Don't install 'setuptool' (or pip) in the virtualenv</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="noPipCcheckBox"> + <property name="toolTip"> + <string>Select to not install pip in the new virtualenv</string> + </property> + <property name="text"> + <string>Don't install 'pip' in the virtualenv</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="clearCheckBox"> + <property name="toolTip"> + <string>Select to clear the target first</string> + </property> + <property name="text"> + <string>Clear out the target directory</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="copyCheckBox"> + <property name="toolTip"> + <string>Select to always copy files rather than symlinking</string> + </property> + <property name="text"> + <string>Always copy files</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QCheckBox" name="symlinkCheckBox"> + <property name="toolTip"> + <string>Select to use symlinks instead of copies</string> + </property> + <property name="text"> + <string>Use Symbolic Links</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QCheckBox" name="upgradeCheckBox"> + <property name="toolTip"> + <string>Select to upgrade a virtual environment</string> + </property> + <property name="text"> + <string>Upgrade</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="logCheckBox"> + <property name="toolTip"> + <string>Select to generate a log file in the target directory</string> + </property> + <property name="text"> + <string>Save a log file in the target directory after creation</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="scriptCheckBox"> + <property name="toolTip"> + <string>Select to write a shell script/batch file to regenerate the virtualenv</string> + </property> + <property name="text"> + <string>Save virtualenv generation script</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="openCheckBox"> + <property name="toolTip"> + <string>Open the newly created virtualenv in a file manager window</string> + </property> + <property name="text"> + <string>Open target directory after creation</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="condaPage"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Target Environment Specification</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="E5ClearableLineEdit" name="condaNameEdit"> + <property name="toolTip"> + <string>Enter the name for the environment</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Path:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="condaTargetDirectoryPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the target directory for the conda environment</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string><b>Note:</b> Only one of the above entries is mandatory.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="condaCloneGroup"> + <property name="toolTip"> + <string>Select to clone an existing environment</string> + </property> + <property name="title"> + <string>Clone Environment</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="E5ClearableLineEdit" name="condaCloneNameEdit"> + <property name="toolTip"> + <string>Enter the name of the environment to be cloned</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Path:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5PathPicker" name="condaCloneDirectoryPicker" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> + </property> + <property name="toolTip"> + <string>Enter the directory of the environment to be cloned</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label_9"> <property name="text"> - <string notr="true"/> - </property> - </item> - <item> - <property name="text"> - <string notr="true">2.6</string> + <string>Package Specs:</string> </property> - </item> - <item> - <property name="text"> - <string notr="true">2.7</string> + </widget> + </item> + <item> + <widget class="E5ClearableLineEdit" name="condaPackagesEdit"> + <property name="toolTip"> + <string>Enter the package specifications for the environment</string> </property> - </item> - <item> - <property name="text"> - <string notr="true">3.4</string> - </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Options</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="versionLabel_2"> + <property name="text"> + <string>Python Version:</string> + </property> + </widget> </item> - <item> - <property name="text"> - <string notr="true">3.5</string> - </property> + <item row="0" column="1"> + <widget class="E5ClearableLineEdit" name="condaPythonEdit"> + <property name="toolTip"> + <string>Enter the Python version for the environment</string> + </property> + </widget> </item> - <item> - <property name="text"> - <string notr="true">3.6</string> - </property> - </item> - <item> - <property name="text"> - <string notr="true">3.7</string> - </property> + <item row="1" column="0" colspan="2"> + <widget class="QCheckBox" name="condaInsecureCheckBox"> + <property name="text"> + <string>Allow insecure SSL connections</string> + </property> + </widget> </item> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="systemCheckBox"> - <property name="toolTip"> - <string>Select to give the virtualenv access to the global site-packages</string> - </property> - <property name="text"> - <string>System-wide Python Packages</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="unzipCheckBox"> - <property name="toolTip"> - <string>Select to unzip setuptools when installing it</string> - </property> - <property name="text"> - <string>Unzip Setuptool to virtualenv</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="noSetuptoolsCheckBox"> - <property name="toolTip"> - <string>Select to not install setuptools (or pip) in the new virtualenv</string> - </property> - <property name="text"> - <string>Don't install 'setuptool' (or pip) in the virtualenv</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="noPipCcheckBox"> - <property name="toolTip"> - <string>Select to not install pip in the new virtualenv</string> - </property> - <property name="text"> - <string>Don't install 'pip' in the virtualenv</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QCheckBox" name="clearCheckBox"> - <property name="toolTip"> - <string>Select to clear the target first</string> - </property> - <property name="text"> - <string>Clear out the target directory</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="copyCheckBox"> - <property name="toolTip"> - <string>Select to always copy files rather than symlinking</string> - </property> - <property name="text"> - <string>Always copy files</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QCheckBox" name="symlinkCheckBox"> - <property name="toolTip"> - <string>Select to use symlinks instead of copies</string> - </property> - <property name="text"> - <string>Use Symbolic Links</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QCheckBox" name="upgradeCheckBox"> - <property name="toolTip"> - <string>Select to upgrade a virtual environment</string> - </property> - <property name="text"> - <string>Upgrade</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QCheckBox" name="logCheckBox"> - <property name="toolTip"> - <string>Select to generate a log file in the target directory</string> - </property> - <property name="text"> - <string>Save a log file in the target directory after creation</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="scriptCheckBox"> - <property name="toolTip"> - <string>Select to write a shell script/batch file to regenerate the virtualenv</string> - </property> - <property name="text"> - <string>Save virtualenv generation script</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QCheckBox" name="openCheckBox"> - <property name="toolTip"> - <string>Open the newly created virtualenv in a file manager window</string> - </property> - <property name="text"> - <string>Open target directory after creation</string> - </property> - </widget> - </item> - </layout> + <item row="1" column="2"> + <widget class="QCheckBox" name="condaDryrunCheckBox"> + <property name="toolTip"> + <string>Select to perform just a dry-run</string> + </property> + <property name="text"> + <string>Perform dry-run</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>33</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> <item> @@ -449,6 +696,7 @@ <tabstops> <tabstop>virtualenvButton</tabstop> <tabstop>pyvenvButton</tabstop> + <tabstop>condaButton</tabstop> <tabstop>nameEdit</tabstop> <tabstop>targetDirectoryPicker</tabstop> <tabstop>extraSearchPathPicker</tabstop> @@ -467,6 +715,15 @@ <tabstop>logCheckBox</tabstop> <tabstop>scriptCheckBox</tabstop> <tabstop>openCheckBox</tabstop> + <tabstop>condaNameEdit</tabstop> + <tabstop>condaTargetDirectoryPicker</tabstop> + <tabstop>condaCloneGroup</tabstop> + <tabstop>condaCloneNameEdit</tabstop> + <tabstop>condaCloneDirectoryPicker</tabstop> + <tabstop>condaPackagesEdit</tabstop> + <tabstop>condaPythonEdit</tabstop> + <tabstop>condaInsecureCheckBox</tabstop> + <tabstop>condaDryrunCheckBox</tabstop> </tabstops> <resources/> <connections>
--- a/VirtualEnv/VirtualenvManager.py Sat Jan 26 17:04:11 2019 +0100 +++ b/VirtualEnv/VirtualenvManager.py Sat Jan 26 19:42:53 2019 +0100 @@ -146,16 +146,22 @@ dlg = VirtualenvConfigurationDialog() if dlg.exec_() == QDialog.Accepted: - (pyvenv, args, name, openTarget, createLog, createScript, - targetDir, interpreter) = dlg.getData() + resultDict = dlg.getData() +## (pyvenv, args, name, openTarget, createLog, createScript, +## targetDir, interpreter) = dlg.getData() - # now do the call - from .VirtualenvExecDialog import VirtualenvExecDialog - dia = VirtualenvExecDialog(pyvenv, targetDir, name, openTarget, - createLog, createScript, interpreter, - self) + if resultDict["envType"] == "conda": + # TODO: add call to the conda exec dialog + pass + else: + # now do the call + from .VirtualenvExecDialog import VirtualenvExecDialog + dia = VirtualenvExecDialog(resultDict, self) +## dia = VirtualenvExecDialog(pyvenv, targetDir, name, openTarget, +## createLog, createScript, interpreter, +## self) dia.show() - dia.start(args) + dia.start(resultDict["arguments"]) dia.exec_() def addVirtualEnv(self, venvName, venvDirectory, venvInterpreter="",
--- a/eric6.e4p Sat Jan 26 17:04:11 2019 +0100 +++ b/eric6.e4p Sat Jan 26 19:42:53 2019 +0100 @@ -838,6 +838,7 @@ <Source>Plugins/__init__.py</Source> <Source>Preferences/ConfigurationDialog.py</Source> <Source>Preferences/ConfigurationPages/ApplicationPage.py</Source> + <Source>Preferences/ConfigurationPages/CondaPage.py</Source> <Source>Preferences/ConfigurationPages/ConfigurationPageBase.py</Source> <Source>Preferences/ConfigurationPages/CooperationPage.py</Source> <Source>Preferences/ConfigurationPages/CorbaPage.py</Source> @@ -2008,6 +2009,7 @@ <Form>Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardRepeatDialog.ui</Form> <Form>Plugins/WizardPlugins/SetupWizard/SetupWizardDialog.ui</Form> <Form>Preferences/ConfigurationPages/ApplicationPage.ui</Form> + <Form>Preferences/ConfigurationPages/CondaPage.ui</Form> <Form>Preferences/ConfigurationPages/CooperationPage.ui</Form> <Form>Preferences/ConfigurationPages/CorbaPage.ui</Form> <Form>Preferences/ConfigurationPages/DebuggerGeneralPage.ui</Form>