From ef11d2692174653671c04a8ab6abb75b6d2cd7cd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 May 2021 08:03:29 +0530 Subject: [PATCH] Fix #1929300 [[Enhancement] Add a Clear button to clear the tab Advanced search of the Advanced search window](https://bugs.launchpad.net/calibre/+bug/1929300) --- .../gui2/store/search/adv_search_builder.py | 7 ++ .../gui2/store/search/adv_search_builder.ui | 55 ++++++++++--- .../stores/mobileread/adv_search_builder.py | 7 ++ .../stores/mobileread/adv_search_builder.ui | 81 +++++++++++-------- 4 files changed, 106 insertions(+), 44 deletions(-) diff --git a/src/calibre/gui2/store/search/adv_search_builder.py b/src/calibre/gui2/store/search/adv_search_builder.py index f984baa8ec..60b1e44e9d 100644 --- a/src/calibre/gui2/store/search/adv_search_builder.py +++ b/src/calibre/gui2/store/search/adv_search_builder.py @@ -30,6 +30,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.tab_2_button_box.accepted.connect(self.accept) self.tab_2_button_box.rejected.connect(self.reject) self.clear_button.clicked.connect(self.clear_button_pushed) + self.advanced_clear_button.clicked.connect(self.clear_advanced) self.adv_search_used = False self.mc = '' @@ -56,6 +57,12 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.download_combo.setCurrentIndex(0) self.affiliate_combo.setCurrentIndex(0) + def clear_advanced(self): + self.all.setText('') + self.phrase.setText('') + self.any.setText('') + self.none.setText('') + def tokens(self, raw): phrases = re.findall(r'\s*".*?"\s*', raw) for f in phrases: diff --git a/src/calibre/gui2/store/search/adv_search_builder.ui b/src/calibre/gui2/store/search/adv_search_builder.ui index 0f9ebccb6e..0ea559f8db 100644 --- a/src/calibre/gui2/store/search/adv_search_builder.ui +++ b/src/calibre/gui2/store/search/adv_search_builder.ui @@ -56,8 +56,8 @@ A&dvanced search - - + + Find entries that have... @@ -117,7 +117,7 @@ - + But don't show entries that have... @@ -159,15 +159,52 @@ - - + + - Qt::Horizontal + Qt::Vertical - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + 20 + 40 + - + + + + + + + + &Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + diff --git a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py index 883f0c34f2..dbabd496eb 100644 --- a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py +++ b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.py @@ -24,6 +24,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.tab_2_button_box.accepted.connect(self.accept) self.tab_2_button_box.rejected.connect(self.reject) self.clear_button.clicked.connect(self.clear_button_pushed) + self.advanced_clear_button.clicked.connect(self.clear_advanced) self.adv_search_used = False self.mc = '' @@ -46,6 +47,12 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog): self.author_box.setText('') self.format_box.setText('') + def clear_advanced(self): + self.all.setText('') + self.phrase.setText('') + self.any.setText('') + self.none.setText('') + def tokens(self, raw): phrases = re.findall(r'\s*".*?"\s*', raw) for f in phrases: diff --git a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.ui b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.ui index 1bd5619ecf..c63709e814 100644 --- a/src/calibre/gui2/store/stores/mobileread/adv_search_builder.ui +++ b/src/calibre/gui2/store/stores/mobileread/adv_search_builder.ui @@ -14,7 +14,7 @@ Advanced search - + :/images/search.png:/images/search.png @@ -47,7 +47,7 @@ - + 0 @@ -56,8 +56,8 @@ A&dvanced search - - + + Find entries that have... @@ -117,10 +117,10 @@ - + - But don't show entries that have... + But don't show entries that have... @@ -149,7 +149,7 @@ - See the <a href="https://manual.calibre-ebook.com/gui.html#the-search-interface">User Manual</a> for more help + See the <a href="https://manual.calibre-ebook.com/gui.html#the-search-interface">User Manual</a> for more help true @@ -159,7 +159,7 @@ - + Qt::Vertical @@ -172,15 +172,39 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + + &Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + @@ -274,19 +298,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -311,7 +322,7 @@ matchkind - + @@ -321,8 +332,8 @@ accept() - 248 - 254 + 259 + 451 157 @@ -337,8 +348,8 @@ reject() - 316 - 260 + 327 + 451 286