Plugins/UiExtensionPlugins/PipInterface/PipListDialog.py

changeset 6327
a1716d9210f4
parent 6301
f488d2cc5841
child 6342
c79ecba9cde7
--- a/Plugins/UiExtensionPlugins/PipInterface/PipListDialog.py	Tue Jun 05 19:14:10 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipListDialog.py	Wed Jun 06 20:05:39 2018 +0200
@@ -26,7 +26,6 @@
 import Preferences
 
 
-# TODO: add support for --user (User Site only)
 class PipListDialog(QDialog, Ui_PipListDialog):
     """
     Class implementing a dialog to list installed packages.
@@ -271,6 +270,8 @@
             args.append("--local")
         if self.notRequiredCheckBox.isChecked():
             args.append("--not-required")
+        if self.userCheckBox.isChecked():
+            args.append("--user")
         
         if self.__indexUrl:
             args.append("--index-url")
@@ -350,7 +351,8 @@
         """
         Private slot handling the switching of the local mode.
         
-        @param checked state of the local check box (boolean)
+        @param checked state of the local check box
+        @type bool
         """
         self.__refresh()
     
@@ -359,7 +361,18 @@
         """
         Private slot handling the switching of the 'not required' mode.
         
-        @param checked state of the 'not required' check box (boolean)
+        @param checked state of the 'not required' check box
+        @type bool
+        """
+        self.__refresh()
+    
+    @pyqtSlot(bool)
+    def on_userCheckBox_clicked(self, checked):
+        """
+        Private slot handling the switching of the 'user-site' mode.
+        
+        @param checked state of the 'user-site' check box
+        @type bool
         """
         self.__refresh()
     
@@ -455,7 +468,6 @@
         """
         self.on_packageList_itemSelectionChanged()
     
-    # TODO: add support for --user
     def __upgradePackages(self):
         """
         Private slot to upgrade the selected packages.
@@ -470,7 +482,6 @@
             else:
                 self.__executeUpgradePackages(packages)
     
-    # TODO: add support for --user
     def __upgradeAllPackages(self):
         """
         Private slot to upgrade all listed packages.
@@ -486,7 +497,6 @@
             else:
                 self.__executeUpgradePackages(packages)
     
-    # TODO: add support for --user
     def __upgradePip(self):
         """
         Private slot to upgrade pip itself.
@@ -495,11 +505,11 @@
         if pip == self.__default:
             pip = ""
 
-        res = self.__pip.upgradePip(pip=pip)
+        res = self.__pip.upgradePip(
+            pip=pip, userSite=self.userCheckBox.isChecked())
         if res:
             self.__refresh()
     
-    # TODO: add support for --user
     def __executeUpgradePackages(self, packages):
         """
         Private method to execute the pip upgrade command.
@@ -511,7 +521,8 @@
         if command == self.__default:
             command = ""
 
-        res = self.__pip.upgradePackages(packages, cmd=command)
+        res = self.__pip.upgradePackages(
+            packages, cmd=command, userSite=self.userCheckBox.isChecked())
         if res:
             self.__refresh()
     

eric ide

mercurial