Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py

changeset 6327
a1716d9210f4
parent 6301
f488d2cc5841
child 6342
c79ecba9cde7
--- a/Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py	Tue Jun 05 19:14:10 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipPackagesInputDialog.py	Wed Jun 06 20:05:39 2018 +0200
@@ -15,18 +15,22 @@
 from .Ui_PipPackagesInputDialog import Ui_PipPackagesInputDialog
 
 
-# TODO: add checkbox to select an installation into 'user site'
 class PipPackagesInputDialog(QDialog, Ui_PipPackagesInputDialog):
     """
     Class implementing a dialog to enter package specifications.
     """
-    def __init__(self, plugin, title, parent=None):
+    def __init__(self, plugin, title, install=True, parent=None):
         """
         Constructor
         
-        @param plugin reference to the plugin object (ToolPipPlugin)
-        @param title dialog title (string)
-        @param parent reference to the parent widget (QWidget)
+        @param plugin reference to the plugin object
+        @type ToolPipPlugin
+        @param title dialog title
+        @type str
+        @param install flag indicating an install action
+        @type bool
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super(PipPackagesInputDialog, self).__init__(parent)
         self.setupUi(self)
@@ -40,6 +44,8 @@
         self.pipComboBox.addItem(self.__default)
         self.pipComboBox.addItems(pipExecutables)
         
+        self.userCheckBox.setVisible(install)
+        
         msh = self.minimumSizeHint()
         self.resize(max(self.width(), msh.width()), msh.height())
     
@@ -56,12 +62,13 @@
         """
         Public method to get the entered data.
         
-        @return tuple with the pip command (string) and the list of
-            package specifications (list of string)
+        @return tuple with the pip command, 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
+        return command, packages, self.userCheckBox.isChecked()

eric ide

mercurial