Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py

changeset 6342
c79ecba9cde7
parent 6327
a1716d9210f4
child 6619
1d34365c082c
--- a/Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py	Tue Jun 12 18:59:45 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py	Tue Jun 12 19:01:06 2018 +0200
@@ -19,12 +19,12 @@
     """
     Class implementing a dialog to enter package specifications.
     """
-    def __init__(self, plugin, title, install=True, parent=None):
+    def __init__(self, pip, title, install=True, parent=None):
         """
         Constructor
         
-        @param plugin reference to the plugin object
-        @type ToolPipPlugin
+        @param pip reference to the pip object
+        @type Pip
         @param title dialog title
         @type str
         @param install flag indicating an install action
@@ -39,10 +39,8 @@
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
         
-        self.__default = self.tr("<Default>")
-        pipExecutables = sorted(plugin.getPreferences("PipExecutables"))
-        self.pipComboBox.addItem(self.__default)
-        self.pipComboBox.addItems(pipExecutables)
+        self.venvComboBox.addItem(pip.getDefaultEnvironmentString())
+        self.venvComboBox.addItems(pip.getVirtualenvNames())
         
         self.userCheckBox.setVisible(install)
         
@@ -54,7 +52,8 @@
         """
         Private slot handling entering package names.
         
-        @param txt name of the requirements file (string)
+        @param txt name of the requirements file
+        @type str
         """
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
     
@@ -62,13 +61,15 @@
         """
         Public method to get the entered data.
         
-        @return tuple with the pip command, the list of package specifications
-            and a flag indicating to install to the user install directory
+        @return tuple with the environment name, the list of package
+            specifications and a flag indicating to install to the user
+            install directory
         @rtype tuple of (str, list of str, bool)
         """
-        command = self.pipComboBox.currentText()
-        if command == self.__default:
-            command = ""
         packages = [p.strip() for p in self.packagesEdit.text().split()]
         
-        return command, packages, self.userCheckBox.isChecked()
+        return (
+            self.venvComboBox.currentText(),
+            packages,
+            self.userCheckBox.isChecked()
+        )

eric ide

mercurial