src/eric7/PipInterface/PipPackagesWidget.py

branch
eric7-maintenance
changeset 10814
ba20efe10336
parent 10694
f46c1e224e8a
parent 10806
2f6df822e3b9
child 10941
07cad049002c
--- a/src/eric7/PipInterface/PipPackagesWidget.py	Sun Jun 02 09:51:47 2024 +0200
+++ b/src/eric7/PipInterface/PipPackagesWidget.py	Wed Jul 03 09:20:41 2024 +0200
@@ -28,7 +28,7 @@
     QWidget,
 )
 
-from eric7 import Globals, Preferences
+from eric7 import EricUtilities, Preferences
 from eric7.EricGui import EricPixmapCache
 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor
 from eric7.EricWidgets import EricMessageBox
@@ -317,7 +317,10 @@
             self.environmentsComboBox.addItem(projectVenv)
         self.environmentsComboBox.addItems(
             self.__pip.getVirtualenvNames(
-                noRemote=True, noConda=Preferences.getPip("ExcludeCondaEnvironments")
+                noRemote=True,
+                noConda=Preferences.getPip("ExcludeCondaEnvironments"),
+                noGlobals=Preferences.getPip("ExcludeGlobalEnvironments"),
+                noServer=True,
             )
         )
 
@@ -360,7 +363,7 @@
                 "pip", Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive
             )
             if len(pipList) > 0:
-                pipVersionTuple = Globals.versionToTuple(
+                pipVersionTuple = EricUtilities.versionToTuple(
                     pipList[0].text(PipPackagesWidget.InstalledVersionColumn)
                 )
 
@@ -497,17 +500,17 @@
         """
         Private method to process the list of outdated packages.
 
-        @param outdatedPackages list of tuples containing the package name,
-            installed version and available version
-        @type list of tuple of (str, str, str)
+        @param outdatedPackages dictionary with the package name as key and
+            a tuple containing the installed and available version as the value
+        @type dict of [str: (str, str)]
         """
-        for package, _version, latest in outdatedPackages:
-            items = self.packagesList.findItems(
-                package,
-                Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive,
-            )
-            if items:
-                items[0].setText(PipPackagesWidget.AvailableVersionColumn, latest)
+        for row in range(self.packagesList.topLevelItemCount()):
+            item = self.packagesList.topLevelItem(row)
+            with contextlib.suppress(KeyError):
+                item.setText(
+                    PipPackagesWidget.AvailableVersionColumn,
+                    outdatedPackages[item.text(0)][1],
+                )
         self.packagesList.resizeColumnToContents(
             PipPackagesWidget.AvailableVersionColumn
         )

eric ide

mercurial