VirtualEnv/VirtualenvConfigurationDialog.py

branch
conda
changeset 6739
110ab101766a
parent 6736
9a244f0d5dc0
--- a/VirtualEnv/VirtualenvConfigurationDialog.py	Wed Feb 13 19:48:48 2019 +0100
+++ b/VirtualEnv/VirtualenvConfigurationDialog.py	Wed Feb 13 20:39:03 2019 +0100
@@ -76,7 +76,14 @@
         self.condaCloneDirectoryPicker.setDefaultDirectory(
             Utilities.getHomeDir())
         
-        # TODO: add creation from requirements
+        self.condaRequirementsFilePicker.setMode(
+            E5PathPickerModes.OpenFileMode)
+        self.condaRequirementsFilePicker.setWindowTitle(
+            self.tr("Conda Requirements File"))
+        self.condaRequirementsFilePicker.setDefaultDirectory(
+            Utilities.getHomeDir())
+        self.condaRequirementsFilePicker.setFilters(
+            self.tr("Text Files (*.txt);;All Files (*)"))
         
         self.__versionRe = re.compile(r""".*?(\d+\.\d+\.\d+).*""")
         
@@ -121,9 +128,12 @@
         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())
+            if self.condaSpecialsGroup.isChecked():
+                if self.condaCloneButton.isChecked():
+                    enable &= bool(self.condaCloneNameEdit.text()) or \
+                        bool(self.condaCloneDirectoryPicker.text())
+                elif self.condaRequirementsButton.isChecked():
+                    enable &= bool(self.condaRequirementsFilePicker.text())
             self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
         else:
             self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
@@ -149,8 +159,7 @@
         self.upgradeCheckBox.setEnabled(not enable)
         
         # conda page
-        # TODO: add creation from requirements
-        enable = not self.condaCloneGroup.isChecked()
+        enable = not self.condaSpecialsGroup.isChecked()
         self.condaPackagesEdit.setEnabled(enable)
         self.condaPythonEdit.setEnabled(enable)
         self.condaInsecureCheckBox.setEnabled(
@@ -236,9 +245,9 @@
         self.__updateOK()
     
     @pyqtSlot()
-    def on_condaCloneGroup_clicked(self):
+    def on_condaSpecialsGroup_clicked(self):
         """
-        Private slot handling the selection of the clone group.
+        Private slot handling the selection of the specials group.
         """
         self.__updateOK()
         self.__updateUi()
@@ -263,6 +272,30 @@
         """
         self.__updateOK()
     
+    @pyqtSlot()
+    def on_condaCloneButton_clicked(self):
+        """
+        Private slot handling the selection of the clone button.
+        """
+        self.__updateOK()
+    
+    @pyqtSlot()
+    def on_condaRequirementsButton_clicked(self):
+        """
+        Private slot handling the selection of the requirements button.
+        """
+        self.__updateOK()
+    
+    @pyqtSlot(str)
+    def on_condaRequirementsFilePicker_textChanged(self, txt):
+        """
+        Private slot handling a change of the requirements file entry.
+        
+        @param txt current text of the requirements file entry
+        @type str
+        """
+        self.__updateOK()
+    
     def __setVirtualenvVersion(self):
         """
         Private method to determine the virtualenv version and set the
@@ -411,18 +444,24 @@
             if bool(self.condaTargetDirectoryPicker.text()):
                 args.extend(["--prefix",
                              self.condaTargetDirectoryPicker.text()])
-            if self.condaCloneGroup.isChecked():
-                if bool(self.condaCloneNameEdit.text()):
-                    args.extend(["--clone", self.condaCloneNameEdit.text()])
-                elif bool(self.condaCloneDirectoryPicker.text()):
-                    args.extend(["--clone",
-                                 self.condaCloneDirectoryPicker.text()])
+            if self.condaSpecialsGroup.isChecked():
+                if self.condaCloneButton.isChecked():
+                    if bool(self.condaCloneNameEdit.text()):
+                        args.extend(
+                            ["--clone", self.condaCloneNameEdit.text()]
+                        )
+                    elif bool(self.condaCloneDirectoryPicker.text()):
+                        args.extend(["--clone",
+                                     self.condaCloneDirectoryPicker.text()])
+                elif self.condaRequirementsButton.isChecked():
+                    args.extend(
+                        ["--file", self.condaRequirementsFilePicker.text()]
+                    )
             if self.condaInsecureCheckBox.isChecked():
                 args.append("--insecure")
             if self.condaDryrunCheckBox.isChecked():
                 args.append("--dry-run")
-            # TODO: add creation from requirements
-            if not self.condaCloneGroup.isChecked():
+            if not self.condaSpecialsGroup.isChecked():
                 if bool(self.condaPythonEdit.text()):
                     args.append("python={0}".format(
                         self.condaPythonEdit.text()))

eric ide

mercurial