pip Interface eric7

Thu, 14 Jul 2022 16:08:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 14 Jul 2022 16:08:17 +0200
branch
eric7
changeset 9234
97bdad5be46d
parent 9233
d14a2ec006a7
child 9235
b5fe898e171f

pip Interface
- added capability to repair dependency issues

docs/changelog file | annotate | diff | comparison | revisions
eric7.epj file | annotate | diff | comparison | revisions
src/eric7/PipInterface/PipPackagesWidget.py file | annotate | diff | comparison | revisions
src/eric7/PipInterface/PipPackagesWidget.ui file | annotate | diff | comparison | revisions
src/eric7/icons/breeze-dark/repair.svg file | annotate | diff | comparison | revisions
src/eric7/icons/breeze-light/repair.svg file | annotate | diff | comparison | revisions
src/eric7/icons/oxygen/repair.png file | annotate | diff | comparison | revisions
--- a/docs/changelog	Thu Jul 14 15:40:26 2022 +0200
+++ b/docs/changelog	Thu Jul 14 16:08:17 2022 +0200
@@ -12,6 +12,7 @@
   -- added an interface to reformat Python source code with the 'Black' utility
 - pip Interface
   -- included a copy of pipdeptree and patched it to work with Python 3.11+
+  -- added capability to repair dependency issues
 - setup Wizard
   -- added support for 'project_urls'
   -- added support for 'entry_points'
--- a/eric7.epj	Thu Jul 14 15:40:26 2022 +0200
+++ b/eric7.epj	Thu Jul 14 16:08:17 2022 +0200
@@ -2413,7 +2413,7 @@
       "src/eric7/i18n/eric7_zh_CN.qm",
       "src/eric7/i18n/eric7_zh_CN.ts"
     ],
-    "TRANSLATIONSBINPATH": ".",
+    "TRANSLATIONSBINPATH": "",
     "UICPARAMS": {
       "Package": "",
       "PackagesRoot": "src/eric7",
--- a/src/eric7/PipInterface/PipPackagesWidget.py	Thu Jul 14 15:40:26 2022 +0200
+++ b/src/eric7/PipInterface/PipPackagesWidget.py	Thu Jul 14 16:08:17 2022 +0200
@@ -213,6 +213,7 @@
 
         self.refreshDependenciesButton.setIcon(UI.PixmapCache.getIcon("reload"))
         self.showDepPackageDetailsButton.setIcon(UI.PixmapCache.getIcon("info"))
+        self.dependencyRepairButton.setIcon(UI.PixmapCache.getIcon("repair"))
 
         self.__pip = pip
 
@@ -1762,6 +1763,8 @@
         if len(self.dependenciesList.selectedItems()) == 0:
             self.dependencyInfoWidget.clear()
 
+        self.__updateDepActionButtons()
+
     @pyqtSlot(QTreeWidgetItem, int)
     def on_dependenciesList_itemPressed(self, item, column):
         """
@@ -1821,9 +1824,38 @@
         Private method to set the state of the dependency page action buttons.
         """
         self.showDepPackageDetailsButton.setEnabled(
-            len(self.dependenciesList.selectedItems()) == 1 and self.__isPipAvailable()
+            len(self.dependenciesList.selectedItems()) == 1
+        )
+
+        self.dependencyRepairButton.setEnabled(
+            any(
+                not itm.icon(PipPackagesWidget.DepRequiredVersionColumn).isNull()
+                for itm in self.dependenciesList.selectedItems()
+            )
         )
 
+    @pyqtSlot()
+    def on_dependencyRepairButton_clicked(self):
+        """
+        Private slot to repair all selected dependencies.
+        """
+        packages = []
+        for itm in self.dependenciesList.selectedItems():
+            if not itm.icon(PipPackagesWidget.DepRequiredVersionColumn).isNull():
+                packages.append(
+                    "{0}{1}".format(
+                        itm.text(PipPackagesWidget.DepPackageColumn),
+                        itm.text(PipPackagesWidget.DepRequiredVersionColumn),
+                    )
+                )
+
+        venvName = self.environmentsComboBox.currentText()
+        if venvName and packages:
+            self.__pip.installPackages(
+                packages, venvName=venvName, userSite=self.userDepCheckBox.isChecked()
+            )
+            self.on_refreshDependenciesButton_clicked()
+
     ##################################################################
     ## Interface to show the licenses dialog below
     ##################################################################
--- a/src/eric7/PipInterface/PipPackagesWidget.ui	Thu Jul 14 15:40:26 2022 +0200
+++ b/src/eric7/PipInterface/PipPackagesWidget.ui	Thu Jul 14 16:08:17 2022 +0200
@@ -602,6 +602,9 @@
           <property name="alternatingRowColors">
            <bool>true</bool>
           </property>
+          <property name="selectionMode">
+           <enum>QAbstractItemView::ExtendedSelection</enum>
+          </property>
           <property name="sortingEnabled">
            <bool>true</bool>
           </property>
@@ -701,6 +704,16 @@
           </widget>
          </item>
          <item>
+          <widget class="QToolButton" name="dependencyRepairButton">
+           <property name="toolTip">
+            <string>Press to repair the selected dependency</string>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
           <spacer name="horizontalSpacer_6">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/icons/breeze-dark/repair.svg	Thu Jul 14 16:08:17 2022 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg fill="none" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><path d="m3.5818 21c-0.3372-0.004723-0.66996-0.077708-0.97823-0.21466-0.30829-0.13696-0.5857-0.33502-0.81556-0.58217-0.44726-0.40814-0.72464-0.96999-0.7769-1.5738-0.059321-0.6241 0.12134-1.2473 0.50511-1.7425 1.7235-1.8209 5.1228-5.2262 7.5954-7.6513-0.52611-1.4252-0.50153-2.996 0.068943-4.404 0.4691-1.1715 1.3033-2.16 2.3785-2.8183 0.84344-0.55957 1.8129-0.89962 2.8206-0.98937 1.0077-0.08974 2.0217 0.073644 2.9506 0.47539l0.88157 0.3825-4.094 4.2234 1.7924 1.8009 4.2054-4.1172 0.38186 0.88586c0.32186 0.74686 0.49257 1.5503 0.50214 2.3638 0.0096 0.81344-0.14214 1.6207-0.44643 2.3749-0.30171 0.7458-0.74986 1.4233-1.3179 1.9922-0.32186 0.31551-0.67757 0.59434-1.0607 0.8314-0.79271 0.53032-1.6997 0.86463-2.6464 0.97546-0.94686 0.11082-1.9064-5e-3 -2.7998-0.33796-1.5684 1.5937-5.4834 5.5423-7.598 7.5197-0.42419 0.38596-0.97553 0.60163-1.5485 0.60564zm11.339-18.672c-0.93972-0.00236-1.8589 0.275-2.6409 0.79687-0.30499 0.18654-0.58824 0.4066-0.84451 0.65608-0.68156 0.68825-1.1367 1.5688-1.3045 2.5236-0.16777 0.95476-0.04011 1.9381 0.36586 2.8181l0.19357 0.42499-0.33277 0.32539c-2.4832 2.4278-6.0986 6.039-7.8367 7.8771-0.15476 0.23083-0.22096 0.5099-0.18634 0.78567 0.0346 0.27591 0.16766 0.52993 0.3746 0.71511 0.11926 0.13309 0.26457 0.24028 0.42691 0.3147 0.14309 0.06483 0.29774 0.10003 0.45474 0.10361 0.23844-6e-3 0.46673-0.09803 0.643-0.25888 2.2472-2.1011 6.5891-6.4945 7.8632-7.7855l0.32747-0.33071 0.4216 0.19258c0.73393 0.34273 1.5438 0.48946 2.3511 0.42592 0.80728-0.06353 1.5844-0.33516 2.256-0.7885 0.30557-0.18872 0.58886-0.41148 0.84443-0.66405 0.44257-0.44209 0.79229-0.96843 1.0287-1.548 0.23628-0.57958 0.35443-1.2007 0.34757-1.8267 0-0.30863-0.03057-0.61651-0.09157-0.91906l-3.6817 3.5992-3.6445-3.6457 3.5928-3.7054c-0.30571-0.059533-0.61657-0.088455-0.928-0.086323z" fill="#eff0f1" stroke-width="1.4298"/></svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/icons/breeze-light/repair.svg	Thu Jul 14 16:08:17 2022 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg fill="none" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><path d="m3.5818 21c-0.3372-0.004723-0.66996-0.077708-0.97823-0.21466-0.30829-0.13696-0.5857-0.33502-0.81556-0.58217-0.44726-0.40814-0.72464-0.96999-0.7769-1.5738-0.059321-0.6241 0.12134-1.2473 0.50511-1.7425 1.7235-1.8209 5.1228-5.2262 7.5954-7.6513-0.52611-1.4252-0.50153-2.996 0.068943-4.404 0.4691-1.1715 1.3033-2.16 2.3785-2.8183 0.84344-0.55957 1.8129-0.89962 2.8206-0.98937 1.0077-0.08974 2.0217 0.073644 2.9506 0.47539l0.88157 0.3825-4.094 4.2234 1.7924 1.8009 4.2054-4.1172 0.38186 0.88586c0.32186 0.74686 0.49257 1.5503 0.50214 2.3638 0.0096 0.81344-0.14214 1.6207-0.44643 2.3749-0.30171 0.7458-0.74986 1.4233-1.3179 1.9922-0.32186 0.31551-0.67757 0.59434-1.0607 0.8314-0.79271 0.53032-1.6997 0.86463-2.6464 0.97546-0.94686 0.11082-1.9064-5e-3 -2.7998-0.33796-1.5684 1.5937-5.4834 5.5423-7.598 7.5197-0.42419 0.38596-0.97553 0.60163-1.5485 0.60564zm11.339-18.672c-0.93972-0.00236-1.8589 0.275-2.6409 0.79687-0.30499 0.18654-0.58824 0.4066-0.84451 0.65608-0.68156 0.68825-1.1367 1.5688-1.3045 2.5236-0.16777 0.95476-0.04011 1.9381 0.36586 2.8181l0.19357 0.42499-0.33277 0.32539c-2.4832 2.4278-6.0986 6.039-7.8367 7.8771-0.15476 0.23083-0.22096 0.5099-0.18634 0.78567 0.0346 0.27591 0.16766 0.52993 0.3746 0.71511 0.11926 0.13309 0.26457 0.24028 0.42691 0.3147 0.14309 0.06483 0.29774 0.10003 0.45474 0.10361 0.23844-6e-3 0.46673-0.09803 0.643-0.25888 2.2472-2.1011 6.5891-6.4945 7.8632-7.7855l0.32747-0.33071 0.4216 0.19258c0.73393 0.34273 1.5438 0.48946 2.3511 0.42592 0.80728-0.06353 1.5844-0.33516 2.256-0.7885 0.30557-0.18872 0.58886-0.41148 0.84443-0.66405 0.44257-0.44209 0.79229-0.96843 1.0287-1.548 0.23628-0.57958 0.35443-1.2007 0.34757-1.8267 0-0.30863-0.03057-0.61651-0.09157-0.91906l-3.6817 3.5992-3.6445-3.6457 3.5928-3.7054c-0.30571-0.059533-0.61657-0.088455-0.928-0.086323z" fill="#232629" stroke-width="1.4298"/></svg>
Binary file src/eric7/icons/oxygen/repair.png has changed

eric ide

mercurial