src/eric7/PipInterface/PipPackagesWidget.py

branch
eric7
changeset 9623
9c1f429cb56b
parent 9583
b1951dd240e0
child 9653
e67609152c5e
equal deleted inserted replaced
9622:9a5a3ed7bd68 9623:9c1f429cb56b
481 @type str 481 @type str
482 """ 482 """
483 if name != self.__selectedEnvironment: 483 if name != self.__selectedEnvironment:
484 if not name: 484 if not name:
485 self.environmentPathLabel.setPath("") 485 self.environmentPathLabel.setPath("")
486 self.searchNameEdit.clear()
487 self.searchNameEdit.setEnabled(False)
486 else: 488 else:
487 self.environmentPathLabel.setPath( 489 self.environmentPathLabel.setPath(
488 self.__pip.getVirtualenvInterpreter(name) 490 self.__pip.getVirtualenvInterpreter(name)
489 ) 491 )
492 self.searchNameEdit.setEnabled(True)
490 493
491 if self.viewToggleButton.isChecked(): 494 if self.viewToggleButton.isChecked():
492 self.__refreshDependencyTree() 495 self.__refreshDependencyTree()
493 else: 496 else:
494 self.__refreshPackagesList() 497 self.__refreshPackagesList()
790 def __updateSearchButton(self): 793 def __updateSearchButton(self):
791 """ 794 """
792 Private method to update the state of the search button. 795 Private method to update the state of the search button.
793 """ 796 """
794 self.searchButton.setEnabled( 797 self.searchButton.setEnabled(
795 bool(self.searchEditName.text()) and self.__isPipAvailable() 798 bool(self.searchNameEdit.text()) and self.__isPipAvailable()
796 ) 799 )
797 800
798 def __updateSearchMoreButton(self, enable): 801 def __updateSearchMoreButton(self, enable):
799 """ 802 """
800 Private method to update the state of the search more button. 803 Private method to update the state of the search more button.
801 804
802 @param enable flag indicating the desired enable state 805 @param enable flag indicating the desired enable state
803 @type bool 806 @type bool
804 """ 807 """
805 self.searchMoreButton.setEnabled( 808 self.searchMoreButton.setEnabled(
806 enable and bool(self.searchEditName.text()) and self.__isPipAvailable() 809 enable and bool(self.searchNameEdit.text()) and self.__isPipAvailable()
807 ) 810 )
808 811
809 @pyqtSlot(bool) 812 @pyqtSlot(bool)
810 def on_searchToggleButton_1_toggled(self, checked): 813 def on_searchToggleButton_1_toggled(self, checked):
811 """ 814 """
816 """ 819 """
817 self.searchWidget.setVisible(checked) 820 self.searchWidget.setVisible(checked)
818 self.searchToggleButton_2.setChecked(checked) 821 self.searchToggleButton_2.setChecked(checked)
819 822
820 if checked: 823 if checked:
821 self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason) 824 self.searchNameEdit.setFocus(Qt.FocusReason.OtherFocusReason)
822 self.searchEditName.selectAll() 825 self.searchNameEdit.selectAll()
823 826
824 self.__updateSearchActionButtons() 827 self.__updateSearchActionButtons()
825 self.__updateSearchButton() 828 self.__updateSearchButton()
826 self.__updateSearchMoreButton(False) 829 self.__updateSearchMoreButton(False)
827 830
834 @type bool 837 @type bool
835 """ 838 """
836 self.searchToggleButton_1.setChecked(checked) 839 self.searchToggleButton_1.setChecked(checked)
837 840
838 @pyqtSlot(str) 841 @pyqtSlot(str)
839 def on_searchEditName_textChanged(self, txt): 842 def on_searchNameEdit_textChanged(self, txt):
840 """ 843 """
841 Private slot handling a change of the search term. 844 Private slot handling a change of the search term.
842 845
843 @param txt search term 846 @param txt search term
844 @type str 847 @type str
845 """ 848 """
846 self.__updateSearchButton() 849 self.__updateSearchButton()
847 850
848 @pyqtSlot() 851 @pyqtSlot()
849 def on_searchEditName_returnPressed(self): 852 def on_searchNameEdit_returnPressed(self):
850 """ 853 """
851 Private slot initiating a search via a press of the Return key. 854 Private slot initiating a search via a press of the Return key.
852 """ 855 """
853 if bool(self.searchEditName.text()) and self.__isPipAvailable(): 856 if bool(self.searchNameEdit.text()) and self.__isPipAvailable():
854 self.__searchFirst() 857 self.__searchFirst()
855 858
856 @pyqtSlot() 859 @pyqtSlot()
857 def on_searchButton_clicked(self): 860 def on_searchButton_clicked(self):
858 """ 861 """
894 """ 897 """
895 self.__lastSearchPage = page 898 self.__lastSearchPage = page
896 899
897 self.searchButton.setEnabled(False) 900 self.searchButton.setEnabled(False)
898 901
899 searchTerm = self.searchEditName.text().strip() 902 searchTerm = self.searchNameEdit.text().strip()
900 searchTerm = bytes(QUrl.toPercentEncoding(searchTerm)).decode() 903 searchTerm = bytes(QUrl.toPercentEncoding(searchTerm)).decode()
901 urlQuery = QUrlQuery() 904 urlQuery = QUrlQuery()
902 urlQuery.addQueryItem("q", searchTerm) 905 urlQuery.addQueryItem("q", searchTerm)
903 urlQuery.addQueryItem("page", str(page)) 906 urlQuery.addQueryItem("page", str(page))
904 url = QUrl(self.__pip.getIndexUrlSearch()) 907 url = QUrl(self.__pip.getIndexUrlSearch())
1029 Private slot performing the search finishing actions. 1032 Private slot performing the search finishing actions.
1030 """ 1033 """
1031 self.__updateSearchActionButtons() 1034 self.__updateSearchActionButtons()
1032 self.__updateSearchButton() 1035 self.__updateSearchButton()
1033 1036
1034 self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason) 1037 self.searchNameEdit.setFocus(Qt.FocusReason.OtherFocusReason)
1035 1038
1036 @pyqtSlot() 1039 @pyqtSlot()
1037 def on_installButton_clicked(self): 1040 def on_installButton_clicked(self):
1038 """ 1041 """
1039 Private slot to handle pressing the Install button.. 1042 Private slot to handle pressing the Install button..

eric ide

mercurial