Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py

changeset 6327
a1716d9210f4
parent 6301
f488d2cc5841
child 6342
c79ecba9cde7
diff -r 5ef9456a0cbe -r a1716d9210f4 Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py
--- a/Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py	Tue Jun 05 19:14:10 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py	Wed Jun 06 20:05:39 2018 +0200
@@ -22,12 +22,11 @@
 import Utilities
 
 
-# TODO: add checkbox to select an installation into 'user site'
 class PipFileSelectionDialog(QDialog, Ui_PipFileSelectionDialog):
     """
     Class implementing a dialog to enter a file to be processed.
     """
-    def __init__(self, plugin, mode, parent=None):
+    def __init__(self, plugin, mode, install=True, parent=None):
         """
         Constructor
         
@@ -35,6 +34,8 @@
         @type PipInterfacePlugin
         @param mode mode of the dialog
         @type str
+        @param install flag indicating an install action
+        @type bool
         @param parent reference to the parent widget
         @type QWidget
         """
@@ -74,6 +75,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())
     
@@ -94,12 +97,14 @@
         """
         Public method to get the entered data.
         
-        @return tuple with the pip command and the name of the
-            selected file
-        @rtype tuple of (str, str)
+        @return tuple with the pip command, the name of the
+            selected file and a flag indicating to install to the
+            user install directory
+        @rtype tuple of (str, str, bool)
         """
         command = self.pipComboBox.currentText()
         if command == self.__default:
             command = ""
         
-        return command, self.filePicker.text()
+        return (command, self.filePicker.text(),
+                self.userCheckBox.isChecked())

eric ide

mercurial