Moved the configuration of including global environments in the pip packages widget from the pip configuration page to that widget (see issue 586). eric7

Mon, 05 May 2025 10:17:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 05 May 2025 10:17:49 +0200
branch
eric7
changeset 11262
07d9cc8d773c
parent 11261
141060a924a6
child 11263
28f0ead11a82

Moved the configuration of including global environments in the pip packages widget from the pip configuration page to that widget (see issue 586).

src/eric7/PipInterface/PipPackagesWidget.py file | annotate | diff | comparison | revisions
src/eric7/PipInterface/PipPackagesWidget.ui file | annotate | diff | comparison | revisions
src/eric7/PipInterface/Ui_PipPackagesWidget.py file | annotate | diff | comparison | revisions
src/eric7/Preferences/ConfigurationPages/PipPage.py file | annotate | diff | comparison | revisions
src/eric7/Preferences/ConfigurationPages/PipPage.ui file | annotate | diff | comparison | revisions
src/eric7/Preferences/ConfigurationPages/Ui_PipPage.py file | annotate | diff | comparison | revisions
src/eric7/VirtualEnv/VirtualenvManagerWidgets.py file | annotate | diff | comparison | revisions
src/eric7/icons/breeze-dark/global.svg file | annotate | diff | comparison | revisions
src/eric7/icons/breeze-light/global.svg file | annotate | diff | comparison | revisions
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/PipInterface/PipPackagesWidget.py
--- a/src/eric7/PipInterface/PipPackagesWidget.py	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/PipInterface/PipPackagesWidget.py	Mon May 05 10:17:49 2025 +0200
@@ -100,6 +100,11 @@
         self.dependencyRepairButton.setIcon(EricPixmapCache.getIcon("repair"))
         self.dependencyRepairAllButton.setIcon(EricPixmapCache.getIcon("repairAll"))
 
+        self.includeGlobalsButton.setIcon(EricPixmapCache.getIcon("global"))
+        self.includeGlobalsButton.setChecked(
+            not Preferences.getPip("ExcludeGlobalEnvironments")
+        )
+
         self.__pip = pip
 
         self.packagesList.header().setSortIndicator(
@@ -196,7 +201,7 @@
             self.environmentsComboBox.addItem(projectVenv)
         self.environmentsComboBox.addItems(
             self.__pip.getVirtualenvNames(
-                noGlobals=Preferences.getPip("ExcludeGlobalEnvironments"),
+                noGlobals=not self.includeGlobalsButton.isChecked(),
                 filterList=("+standard",),
             )
         )
@@ -259,6 +264,19 @@
     ## Slots handling widget signals below
     #######################################################################
 
+    @pyqtSlot(bool)
+    def on_includeGlobalsButton_clicked(self, checked):
+        """
+        Private slot to handle a change of the 'Include Global Environments' button
+
+        @param checked current check state
+        @type bool
+        """
+        Preferences.setPip(
+            "ExcludeGlobalEnvironments", not self.includeGlobalsButton.isChecked()
+        )
+        self.on_refreshButton_clicked()
+
     def __selectedUpdateableItems(self):
         """
         Private method to get a list of selected items that can be updated.
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/PipInterface/PipPackagesWidget.ui
--- a/src/eric7/PipInterface/PipPackagesWidget.ui	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/PipInterface/PipPackagesWidget.ui	Mon May 05 10:17:49 2025 +0200
@@ -24,6 +24,16 @@
       </widget>
      </item>
      <item>
+      <widget class="QToolButton" name="includeGlobalsButton">
+       <property name="toolTip">
+        <string>Press to include global environments.</string>
+       </property>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QComboBox" name="environmentsComboBox"/>
      </item>
      <item>
@@ -278,7 +288,7 @@
             </widget>
             <widget class="QTabWidget" name="infoWidget">
              <property name="currentIndex">
-              <number>1</number>
+              <number>0</number>
              </property>
              <widget class="QWidget" name="packageTab">
               <attribute name="title">
@@ -712,6 +722,7 @@
  </customwidgets>
  <tabstops>
   <tabstop>viewToggleButton</tabstop>
+  <tabstop>includeGlobalsButton</tabstop>
   <tabstop>environmentsComboBox</tabstop>
   <tabstop>pipMenuButton</tabstop>
   <tabstop>refreshButton</tabstop>
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/PipInterface/Ui_PipPackagesWidget.py
--- a/src/eric7/PipInterface/Ui_PipPackagesWidget.py	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/PipInterface/Ui_PipPackagesWidget.py	Mon May 05 10:17:49 2025 +0200
@@ -1,6 +1,6 @@
 # Form implementation generated from reading ui file 'src/eric7/PipInterface/PipPackagesWidget.ui'
 #
-# Created by: PyQt6 UI code generator 6.8.1
+# Created by: PyQt6 UI code generator 6.9.0
 #
 # WARNING: Any manual changes made to this file will be lost when pyuic6 is
 # run again.  Do not edit this file unless you know what you are doing.
@@ -21,6 +21,10 @@
         self.viewToggleButton.setCheckable(True)
         self.viewToggleButton.setObjectName("viewToggleButton")
         self.horizontalLayout.addWidget(self.viewToggleButton)
+        self.includeGlobalsButton = QtWidgets.QToolButton(parent=PipPackagesWidget)
+        self.includeGlobalsButton.setCheckable(True)
+        self.includeGlobalsButton.setObjectName("includeGlobalsButton")
+        self.horizontalLayout.addWidget(self.includeGlobalsButton)
         self.environmentsComboBox = QtWidgets.QComboBox(parent=PipPackagesWidget)
         self.environmentsComboBox.setObjectName("environmentsComboBox")
         self.horizontalLayout.addWidget(self.environmentsComboBox)
@@ -287,9 +291,10 @@
 
         self.retranslateUi(PipPackagesWidget)
         self.viewsStackWidget.setCurrentIndex(0)
-        self.infoWidget.setCurrentIndex(1)
+        self.infoWidget.setCurrentIndex(0)
         QtCore.QMetaObject.connectSlotsByName(PipPackagesWidget)
-        PipPackagesWidget.setTabOrder(self.viewToggleButton, self.environmentsComboBox)
+        PipPackagesWidget.setTabOrder(self.viewToggleButton, self.includeGlobalsButton)
+        PipPackagesWidget.setTabOrder(self.includeGlobalsButton, self.environmentsComboBox)
         PipPackagesWidget.setTabOrder(self.environmentsComboBox, self.pipMenuButton)
         PipPackagesWidget.setTabOrder(self.pipMenuButton, self.refreshButton)
         PipPackagesWidget.setTabOrder(self.refreshButton, self.installButton)
@@ -325,6 +330,7 @@
     def retranslateUi(self, PipPackagesWidget):
         _translate = QtCore.QCoreApplication.translate
         self.viewToggleButton.setToolTip(_translate("PipPackagesWidget", "Toggle to show or hide the dependency tree view"))
+        self.includeGlobalsButton.setToolTip(_translate("PipPackagesWidget", "Press to include global environments."))
         self.refreshButton.setToolTip(_translate("PipPackagesWidget", "Press to refresh the lists"))
         self.installButton.setToolTip(_translate("PipPackagesWidget", "Press to install a package."))
         self.upgradeButton.setToolTip(_translate("PipPackagesWidget", "Press to upgrade the selected packages"))
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/Preferences/ConfigurationPages/PipPage.py
--- a/src/eric7/Preferences/ConfigurationPages/PipPage.py	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/Preferences/ConfigurationPages/PipPage.py	Mon May 05 10:17:49 2025 +0200
@@ -54,10 +54,6 @@
         )
         # seconds converted to hours
 
-        self.noGlobalsCheckBox.setChecked(
-            Preferences.getPip("ExcludeGlobalEnvironments")
-        )
-
         self.initColour(
             "DependencyHighlightColor",
             self.searchMarkerColourButton,
@@ -86,10 +82,6 @@
         )
         # hours converted to seconds
 
-        Preferences.setPip(
-            "ExcludeGlobalEnvironments", self.noGlobalsCheckBox.isChecked()
-        )
-
         self.saveColours(Preferences.setPip)
 
 
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/Preferences/ConfigurationPages/PipPage.ui
--- a/src/eric7/Preferences/ConfigurationPages/PipPage.ui	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/Preferences/ConfigurationPages/PipPage.ui	Mon May 05 10:17:49 2025 +0200
@@ -145,25 +145,6 @@
     </widget>
    </item>
    <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Environment</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <widget class="QCheckBox" name="noGlobalsCheckBox">
-        <property name="toolTip">
-         <string>Select to exclude global environments</string>
-        </property>
-        <property name="text">
-         <string>Don't show global environments</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
     <widget class="QGroupBox" name="groupBox_3">
      <property name="title">
       <string>Dependencies List</string>
@@ -228,7 +209,6 @@
   <tabstop>vulnerabilityGroup</tabstop>
   <tabstop>safetyDbMirrorEdit</tabstop>
   <tabstop>validitySpinBox</tabstop>
-  <tabstop>noGlobalsCheckBox</tabstop>
   <tabstop>searchMarkerColourButton</tabstop>
  </tabstops>
  <resources/>
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/Preferences/ConfigurationPages/Ui_PipPage.py
--- a/src/eric7/Preferences/ConfigurationPages/Ui_PipPage.py	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/Preferences/ConfigurationPages/Ui_PipPage.py	Mon May 05 10:17:49 2025 +0200
@@ -68,14 +68,6 @@
         spacerItem = QtWidgets.QSpacerItem(330, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
         self.gridLayout.addItem(spacerItem, 2, 2, 1, 1)
         self.verticalLayout_3.addWidget(self.vulnerabilityGroup)
-        self.groupBox = QtWidgets.QGroupBox(parent=PipPage)
-        self.groupBox.setObjectName("groupBox")
-        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox)
-        self.verticalLayout_2.setObjectName("verticalLayout_2")
-        self.noGlobalsCheckBox = QtWidgets.QCheckBox(parent=self.groupBox)
-        self.noGlobalsCheckBox.setObjectName("noGlobalsCheckBox")
-        self.verticalLayout_2.addWidget(self.noGlobalsCheckBox)
-        self.verticalLayout_3.addWidget(self.groupBox)
         self.groupBox_3 = QtWidgets.QGroupBox(parent=PipPage)
         self.groupBox_3.setObjectName("groupBox_3")
         self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox_3)
@@ -99,8 +91,7 @@
         PipPage.setTabOrder(self.indexEdit, self.vulnerabilityGroup)
         PipPage.setTabOrder(self.vulnerabilityGroup, self.safetyDbMirrorEdit)
         PipPage.setTabOrder(self.safetyDbMirrorEdit, self.validitySpinBox)
-        PipPage.setTabOrder(self.validitySpinBox, self.noGlobalsCheckBox)
-        PipPage.setTabOrder(self.noGlobalsCheckBox, self.searchMarkerColourButton)
+        PipPage.setTabOrder(self.validitySpinBox, self.searchMarkerColourButton)
 
     def retranslateUi(self, PipPage):
         _translate = QtCore.QCoreApplication.translate
@@ -114,9 +105,6 @@
         self.label_2.setText(_translate("PipPage", "Cache Validity:"))
         self.validitySpinBox.setToolTip(_translate("PipPage", "Enter the Safety DB cache validity time in hours (2 hours up to 7 days)"))
         self.validitySpinBox.setSuffix(_translate("PipPage", " hours"))
-        self.groupBox.setTitle(_translate("PipPage", "Environment"))
-        self.noGlobalsCheckBox.setToolTip(_translate("PipPage", "Select to exclude global environments"))
-        self.noGlobalsCheckBox.setText(_translate("PipPage", "Don\'t show global environments"))
         self.groupBox_3.setTitle(_translate("PipPage", "Dependencies List"))
         self.label_3.setText(_translate("PipPage", "Search Marker Background:"))
         self.searchMarkerColourButton.setToolTip(_translate("PipPage", "Select the color for the search highlight of the dependencies list."))
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/VirtualEnv/VirtualenvManagerWidgets.py
--- a/src/eric7/VirtualEnv/VirtualenvManagerWidgets.py	Mon May 05 09:20:18 2025 +0200
+++ b/src/eric7/VirtualEnv/VirtualenvManagerWidgets.py	Mon May 05 10:17:49 2025 +0200
@@ -369,6 +369,8 @@
             except KeyError:
                 # Environment type was not registered or has been deactivated.
                 environmentType = environment.environment_type
+            if environment.is_global:
+                environmentType = self.tr("{0} / Global").format(environmentType)
             itm = QTreeWidgetItem(
                 self.venvList,
                 [environment.name, environmentType, environment.path],
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/icons/breeze-dark/global.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/icons/breeze-dark/global.svg	Mon May 05 10:17:49 2025 +0200
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   viewBox="0 0 22 22"
+   version="1.1"
+   id="svg6"
+   sodipodi:docname="global.svg"
+   inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <sodipodi:namedview
+     id="namedview8"
+     pagecolor="#ffffff"
+     bordercolor="#000000"
+     borderopacity="0.25"
+     inkscape:showpageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     inkscape:deskcolor="#d1d1d1"
+     showgrid="false"
+     inkscape:zoom="46.681818"
+     inkscape:cx="11.010711"
+     inkscape:cy="11.12853"
+     inkscape:window-width="2580"
+     inkscape:window-height="1378"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg6" />
+  <defs
+     id="defs3051">
+    <style
+       type="text/css"
+       id="current-color-scheme">.ColorScheme-Text { color: #fcfcfc; } </style>
+  </defs>
+  <path
+     style="fill:currentColor;fill-opacity:1;stroke:none;stroke-width:1.25011"
+     d="m 11.146507,1.0010361 a 10.001521,10.000248 0 0 0 -7.2178929,2.9297566 10.001521,10.000248 0 0 0 0,14.1409593 10.001521,10.000248 0 0 0 14.1427719,0 10.001521,10.000248 0 0 0 0,-14.1409593 10.001521,10.000248 0 0 0 -6.924879,-2.9297566 z M 10.873028,2.2510656 A 8.7513281,8.7502068 0 0 1 16.723525,4.394671 L 14.967887,6.1500834 A 10.000877,6.2505481 44.991623 0 0 8.1870728,2.7222681 8.7513281,8.7502068 0 0 1 10.873028,2.2510656 Z M 7.0882733,3.8844049 a 8.7507675,5.0004385 44.992769 0 1 6.9932497,3.15193 L 11,10.117463 5.3106598,4.4288514 A 8.7507675,5.0004385 44.992769 0 1 7.0882733,3.8844049 Z M 17.614774,5.2711565 A 8.7513281,8.7502068 0 0 1 19.284949,13.784541 10.000877,6.2505481 44.991623 0 0 15.846927,7.0387763 Z M 4.4242948,5.3102199 10.116077,11.001272 7.0321124,14.084841 A 8.7507675,5.0004385 44.992769 0 1 4.4242948,5.3102199 Z M 14.967887,7.9177033 a 8.7507675,5.0004385 44.992769 0 1 2.607818,8.7746207 L 11.883923,11.001272 Z M 2.715051,8.2180034 A 10.000877,6.2505481 44.991623 0 0 6.1530728,14.963769 L 4.3852264,16.731388 A 8.7513281,8.7502068 0 0 1 2.715051,8.2180034 Z M 11,11.885082 16.68934,17.573693 A 8.7507675,5.0004385 44.992769 0 1 7.9184773,14.96621 Z m -3.9678876,3.967379 a 10.000877,6.2505481 44.991623 0 0 6.7808146,3.427816 8.7513281,8.7502068 0 0 1 -8.5364521,-1.672403 z"
+     class="ColorScheme-Text"
+     id="path4" />
+</svg>
diff -r 141060a924a6 -r 07d9cc8d773c src/eric7/icons/breeze-light/global.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/icons/breeze-light/global.svg	Mon May 05 10:17:49 2025 +0200
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   viewBox="0 0 22 22"
+   version="1.1"
+   id="svg6"
+   sodipodi:docname="global.svg"
+   inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <sodipodi:namedview
+     id="namedview8"
+     pagecolor="#ffffff"
+     bordercolor="#000000"
+     borderopacity="0.25"
+     inkscape:showpageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     inkscape:deskcolor="#d1d1d1"
+     showgrid="false"
+     inkscape:zoom="46.681818"
+     inkscape:cx="11.010711"
+     inkscape:cy="11.374878"
+     inkscape:window-width="2580"
+     inkscape:window-height="1289"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg6" />
+  <defs
+     id="defs3051">
+    <style
+       type="text/css"
+       id="current-color-scheme">
+      .ColorScheme-Text {
+        color:#232629;
+      }
+      </style>
+  </defs>
+  <path
+     style="fill:currentColor;fill-opacity:1;stroke:none;stroke-width:1.25011"
+     d="m 11.146507,1.001036 a 10.001521,10.000248 0 0 0 -7.2178929,2.9297568 10.001521,10.000248 0 0 0 0,14.1409592 10.001521,10.000248 0 0 0 14.1427719,0 10.001521,10.000248 0 0 0 0,-14.1409592 A 10.001521,10.000248 0 0 0 11.146507,1.001036 Z M 10.873028,2.2510656 A 8.7513281,8.7502068 0 0 1 16.723525,4.394671 L 14.967887,6.1500835 A 10.000877,6.2505481 44.991624 0 0 8.1870728,2.7222681 8.7513281,8.7502068 0 0 1 10.873028,2.2510656 Z M 7.0882733,3.8844049 a 8.7507675,5.0004385 44.99277 0 1 6.9932497,3.15193 L 11,10.117463 5.3106598,4.4288514 A 8.7507675,5.0004385 44.99277 0 1 7.0882733,3.8844049 Z M 17.614774,5.2711565 A 8.7513281,8.7502068 0 0 1 19.284949,13.784541 10.000877,6.2505481 44.991624 0 0 15.846927,7.0387764 Z M 4.4242948,5.3102199 10.116077,11.001272 7.0321124,14.084842 A 8.7507675,5.0004385 44.99277 0 1 4.4242948,5.3102199 Z M 14.967887,7.9177034 a 8.7507675,5.0004385 44.99277 0 1 2.607818,8.7746216 L 11.883923,11.001272 Z M 2.715051,8.2180035 A 10.000877,6.2505481 44.991624 0 0 6.1530728,14.963769 L 4.3852264,16.731388 A 8.7513281,8.7502068 0 0 1 2.715051,8.2180035 Z M 11,11.885082 16.68934,17.573693 A 8.7507675,5.0004385 44.99277 0 1 7.9184773,14.96621 Z m -3.9678876,3.967379 a 10.000877,6.2505481 44.991624 0 0 6.7808146,3.427816 8.7513281,8.7502068 0 0 1 -8.5364521,-1.672403 z"
+     class="ColorScheme-Text"
+     id="path4" />
+</svg>

eric ide

mercurial