VirtualEnv/VirtualenvAddEditDialog.py

changeset 6716
1c9d3b369ea8
parent 6645
ad476851d7e0
child 6719
705080ffd4a9
diff -r a3aec8edaef5 -r 1c9d3b369ea8 VirtualEnv/VirtualenvAddEditDialog.py
--- a/VirtualEnv/VirtualenvAddEditDialog.py	Sat Feb 09 14:40:32 2019 +0100
+++ b/VirtualEnv/VirtualenvAddEditDialog.py	Sun Feb 10 12:13:10 2019 +0100
@@ -28,7 +28,7 @@
     """
     def __init__(self, manager, venvName="", venvDirectory="",
                  venvInterpreter="", venvVariant=3, isGlobal=False,
-                 isConda=False, execPath="", parent=None):
+                 isConda=False, isRemote=False, execPath="", parent=None):
         """
         Constructor
         
@@ -46,6 +46,8 @@
         @type bool
         @param isConda flag indicating an Anaconda virtual environment
         @type bool
+        @param isRemote flag indicating a remotely accessed environment
+        @type bool
         @param execPath search path string to be prepended to the PATH
             environment variable
         @type str
@@ -82,6 +84,7 @@
         self.variantComboBox.setCurrentIndex(3 - venvVariant)
         self.globalCheckBox.setChecked(isGlobal)
         self.anacondaCheckBox.setChecked(isConda)
+        self.remoteCheckBox.setChecked(isRemote)
         self.execPathEdit.setText(execPath)
         
         self.__updateOk()
@@ -104,15 +107,20 @@
         
         if not self.globalCheckBox.isChecked():
             enable = (
-                enable and
-                bool(self.targetDirectoryPicker.text()) and
-                os.path.exists(self.targetDirectoryPicker.text())
+                enable and (
+                    self.remoteCheckBox.isChecked() or (
+                        bool(self.targetDirectoryPicker.text()) and
+                        os.path.exists(self.targetDirectoryPicker.text())
+                    )
+                )
             )
         
         enable = (
             enable and
-            bool(self.pythonExecPicker.text()) and
-            os.access(self.pythonExecPicker.text(), os.X_OK)
+            bool(self.pythonExecPicker.text()) and (
+                self.remoteCheckBox.isChecked() or
+                os.access(self.pythonExecPicker.text(), os.X_OK)
+            )
         )
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
@@ -164,6 +172,16 @@
         self.__updateOk()
     
     @pyqtSlot(bool)
+    def on_remoteCheckBox_toggled(self, checked):
+        """
+        Private slot handling a change of the remote check box state.
+        
+        @param checked state of the check box
+        @type bool
+        """
+        self.__updateOk()
+    
+    @pyqtSlot(bool)
     def on_anacondaCheckBox_clicked(self, checked):
         """
         Private slot handling a user click on this check box.
@@ -194,9 +212,10 @@
         @return tuple containing the logical name, the directory, the
             interpreter of the virtual environment, the Python variant,
             a flag indicating a global environment, a flag indicating an
-            Anaconda environment and a string to be prepended to the PATH
-            environment variable
-        @rtype tuple of (str, str, str, int, bool,bool, str)
+            Anaconda environment, aflag indicating a remotely accessed
+            environment and a string to be prepended to the PATH environment
+            variable
+        @rtype tuple of (str, str, str, int, bool, bool, bool, str)
         """
         return (
             self.nameEdit.text(),
@@ -205,5 +224,6 @@
             3 - self.variantComboBox.currentIndex(),
             self.globalCheckBox.isChecked(),
             self.anacondaCheckBox.isChecked(),
+            self.remoteCheckBox.isChecked(),
             self.execPathEdit.text(),
         )

eric ide

mercurial