src/eric7/PipInterface/PipPackagesWidget.py

branch
eric7
changeset 9623
9c1f429cb56b
parent 9583
b1951dd240e0
child 9653
e67609152c5e
--- 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):

eric ide

mercurial