mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 01:23:43 +02:00
Fix not being able to reset a collapsed tag browser with the X in the find box.
This commit is contained in:
parent
b2e108042b
commit
dbf596e421
1 changed files with 14 additions and 3 deletions
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
from PyQt5.Qt import (
|
||||
Qt, QIcon, QWidget, QHBoxLayout, QVBoxLayout, QToolButton, QLabel, QFrame,
|
||||
QTimer, QMenu, QActionGroup, QAction, QSizePolicy)
|
||||
QTimer, QMenu, QActionGroup, QAction, QSizePolicy, pyqtSignal)
|
||||
|
||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||
from calibre.gui2.widgets import HistoryLineEdit
|
||||
|
|
@ -406,9 +406,12 @@ def keyPressEvent(self, event):
|
|||
|
||||
class TagBrowserBar(QWidget): # {{{
|
||||
|
||||
def __init__(self, parent):
|
||||
clear_find = pyqtSignal()
|
||||
|
||||
def __init__(self, parent, reset_find):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
|
||||
self.clear_find.connect(reset_find)
|
||||
parent = parent.parent()
|
||||
self.l = l = QHBoxLayout(self)
|
||||
l.setContentsMargins(0, 0, 0, 0)
|
||||
|
|
@ -477,6 +480,7 @@ def close_find_box(self):
|
|||
self.item_search.setCurrentIndex(0)
|
||||
self.item_search.setCurrentText('')
|
||||
self.toggle_search_button.click()
|
||||
self.clear_find.emit()
|
||||
|
||||
def set_focus_to_find_box(self):
|
||||
self.toggle_search_button.setChecked(True)
|
||||
|
|
@ -521,7 +525,7 @@ def __init__(self, parent):
|
|||
self._layout.setContentsMargins(0,0,0,0)
|
||||
|
||||
# Set up the find box & button
|
||||
self.tb_bar = tbb = TagBrowserBar(self)
|
||||
self.tb_bar = tbb = TagBrowserBar(self, self.reset_find)
|
||||
self.alter_tb, self.item_search, self.search_button = tbb.alter_tb, tbb.item_search, tbb.search_button
|
||||
self.toggle_search_button = tbb.toggle_search_button
|
||||
self._layout.addWidget(tbb)
|
||||
|
|
@ -641,6 +645,13 @@ def do_find(self, str=None):
|
|||
def find_text(self):
|
||||
return unicode_type(self.item_search.currentText()).strip()
|
||||
|
||||
def reset_find(self):
|
||||
model = self.tags_view.model()
|
||||
if model.get_categories_filter():
|
||||
model.set_categories_filter(None)
|
||||
self.tags_view.recount()
|
||||
self.current_find_position = None
|
||||
|
||||
def find(self):
|
||||
model = self.tags_view.model()
|
||||
model.clear_boxed()
|
||||
|
|
|
|||
Loading…
Reference in a new issue