Fixed a variable name typo and corrected the enabled state handling of the search edit. eric7

Sun, 18 Dec 2022 14:19:10 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 18 Dec 2022 14:19:10 +0100
branch
eric7
changeset 9623
9c1f429cb56b
parent 9622
9a5a3ed7bd68
child 9624
b47dfa7a137d

Fixed a variable name typo and corrected the enabled state handling of the search edit.

src/eric7/PipInterface/PipPackagesWidget.py file | annotate | diff | comparison | revisions
src/eric7/PipInterface/PipPackagesWidget.ui file | annotate | diff | comparison | revisions
--- a/src/eric7/PipInterface/PipPackagesWidget.py	Sun Dec 18 14:06:16 2022 +0100
+++ b/src/eric7/PipInterface/PipPackagesWidget.py	Sun Dec 18 14:19:10 2022 +0100
@@ -483,10 +483,13 @@
         if name != self.__selectedEnvironment:
             if not name:
                 self.environmentPathLabel.setPath("")
+                self.searchNameEdit.clear()
+                self.searchNameEdit.setEnabled(False)
             else:
                 self.environmentPathLabel.setPath(
                     self.__pip.getVirtualenvInterpreter(name)
                 )
+                self.searchNameEdit.setEnabled(True)
 
             if self.viewToggleButton.isChecked():
                 self.__refreshDependencyTree()
@@ -792,7 +795,7 @@
         Private method to update the state of the search button.
         """
         self.searchButton.setEnabled(
-            bool(self.searchEditName.text()) and self.__isPipAvailable()
+            bool(self.searchNameEdit.text()) and self.__isPipAvailable()
         )
 
     def __updateSearchMoreButton(self, enable):
@@ -803,7 +806,7 @@
         @type bool
         """
         self.searchMoreButton.setEnabled(
-            enable and bool(self.searchEditName.text()) and self.__isPipAvailable()
+            enable and bool(self.searchNameEdit.text()) and self.__isPipAvailable()
         )
 
     @pyqtSlot(bool)
@@ -818,8 +821,8 @@
         self.searchToggleButton_2.setChecked(checked)
 
         if checked:
-            self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason)
-            self.searchEditName.selectAll()
+            self.searchNameEdit.setFocus(Qt.FocusReason.OtherFocusReason)
+            self.searchNameEdit.selectAll()
 
             self.__updateSearchActionButtons()
             self.__updateSearchButton()
@@ -836,7 +839,7 @@
         self.searchToggleButton_1.setChecked(checked)
 
     @pyqtSlot(str)
-    def on_searchEditName_textChanged(self, txt):
+    def on_searchNameEdit_textChanged(self, txt):
         """
         Private slot handling a change of the search term.
 
@@ -846,11 +849,11 @@
         self.__updateSearchButton()
 
     @pyqtSlot()
-    def on_searchEditName_returnPressed(self):
+    def on_searchNameEdit_returnPressed(self):
         """
         Private slot initiating a search via a press of the Return key.
         """
-        if bool(self.searchEditName.text()) and self.__isPipAvailable():
+        if bool(self.searchNameEdit.text()) and self.__isPipAvailable():
             self.__searchFirst()
 
     @pyqtSlot()
@@ -896,7 +899,7 @@
 
         self.searchButton.setEnabled(False)
 
-        searchTerm = self.searchEditName.text().strip()
+        searchTerm = self.searchNameEdit.text().strip()
         searchTerm = bytes(QUrl.toPercentEncoding(searchTerm)).decode()
         urlQuery = QUrlQuery()
         urlQuery.addQueryItem("q", searchTerm)
@@ -1031,7 +1034,7 @@
         self.__updateSearchActionButtons()
         self.__updateSearchButton()
 
-        self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason)
+        self.searchNameEdit.setFocus(Qt.FocusReason.OtherFocusReason)
 
     @pyqtSlot()
     def on_installButton_clicked(self):
--- a/src/eric7/PipInterface/PipPackagesWidget.ui	Sun Dec 18 14:06:16 2022 +0100
+++ b/src/eric7/PipInterface/PipPackagesWidget.ui	Sun Dec 18 14:19:10 2022 +0100
@@ -150,7 +150,7 @@
              </widget>
             </item>
             <item>
-             <widget class="QLineEdit" name="searchEditName">
+             <widget class="QLineEdit" name="searchNameEdit">
               <property name="toolTip">
                <string>Enter the search term for the package name</string>
               </property>
@@ -799,7 +799,7 @@
   <tabstop>installUserSiteButton</tabstop>
   <tabstop>showDetailsButton</tabstop>
   <tabstop>searchToggleButton_2</tabstop>
-  <tabstop>searchEditName</tabstop>
+  <tabstop>searchNameEdit</tabstop>
   <tabstop>searchButton</tabstop>
   <tabstop>searchMoreButton</tabstop>
   <tabstop>searchResultList</tabstop>

eric ide

mercurial