eric6/PipInterface/PipPackagesWidget.py

changeset 7626
7f643d41464e
parent 7477
98058d3ba634
child 7641
21ea4fd50b0a
--- a/eric6/PipInterface/PipPackagesWidget.py	Tue Jun 16 20:03:23 2020 +0200
+++ b/eric6/PipInterface/PipPackagesWidget.py	Wed Jun 17 17:12:21 2020 +0200
@@ -938,6 +938,19 @@
             self.tr("Generate Requirements..."),
             self.__generateRequirements)
         self.__pipMenu.addSeparator()
+        self.__cacheInfoAct = self.__pipMenu.addAction(
+            self.tr("Show Cache Info..."),
+            self.__showCacheInfo)
+        self.__cacheShowListAct = self.__pipMenu.addAction(
+            self.tr("Show Cached Files..."),
+            self.__showCacheList)
+        self.__cacheRemoveAct = self.__pipMenu.addAction(
+            self.tr("Remove Cached Files..."),
+            self.__removeCachedFiles)
+        self.__cachePurgeAct = self.__pipMenu.addAction(
+            self.tr("Purge Cache..."),
+            self.__purgeCache)
+        self.__pipMenu.addSeparator()
         # editUserConfigAct
         self.__pipMenu.addAction(
             self.tr("Edit User Configuration..."),
@@ -973,6 +986,11 @@
         self.__uninstallRequirementsAct.setEnabled(enablePip)
         self.__generateRequirementsAct.setEnabled(enablePip)
         
+        self.__cacheInfoAct.setEnabled(enablePip)
+        self.__cacheShowListAct.setEnabled(enablePip)
+        self.__cacheRemoveAct.setEnabled(enablePip)
+        self.__cachePurgeAct.setEnabled(enablePip)
+        
         self.__editVirtualenvConfigAct.setEnabled(enable)
     
     @pyqtSlot()
@@ -1140,3 +1158,39 @@
         Private slot to open the configuration page.
         """
         e5App().getObject("UserInterface").showPreferences("pipPage")
+    
+    @pyqtSlot()
+    def __showCacheInfo(self):
+        """
+        Private slot to show information about the cache.
+        """
+        venvName = self.environmentsComboBox.currentText()
+        if venvName:
+            self.__pip.showCacheInfo(venvName)
+    
+    @pyqtSlot()
+    def __showCacheList(self):
+        """
+        Private slot to show a list of cached files.
+        """
+        venvName = self.environmentsComboBox.currentText()
+        if venvName:
+            self.__pip.cacheList(venvName)
+    
+    @pyqtSlot()
+    def __removeCachedFiles(self):
+        """
+        Private slot to remove files from the pip cache.
+        """
+        venvName = self.environmentsComboBox.currentText()
+        if venvName:
+            self.__pip.cacheRemove(venvName)
+    
+    @pyqtSlot()
+    def __purgeCache(self):
+        """
+        Private slot to empty the pip cache.
+        """
+        venvName = self.environmentsComboBox.currentText()
+        if venvName:
+            self.__pip.cachePurge(venvName)

eric ide

mercurial