Restore splitter state

This commit is contained in:
Kovid Goyal 2022-06-15 19:07:17 +05:30
parent 7d8fe94078
commit 43a99da50b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,7 @@ from calibre.gui2.widgets2 import Dialog
class FTSDialog(Dialog):
def __init__(self, parent=None):
super().__init__(_('Search the text of all books in the library'), 'library-fts-dialog-2',
super().__init__(_('Search the text of all books in the library'), 'library-fts-dialog',
default_buttons=QDialogButtonBox.StandardButton.Close)
self.setWindowIcon(QIcon.ic('fts.png'))

View File

@ -731,6 +731,9 @@ class ResultsPanel(QWidget):
rv.search_started.connect(d.clear)
rv.result_with_context_found.connect(d.result_with_context_found)
s.addWidget(d)
st = gprefs.get('fts_search_splitter_state')
if st is not None:
s.restoreState(st)
def request_stop_search(self):
if question_dialog(self, _('Are you sure?'), _('Abort the current search?')):
@ -745,6 +748,8 @@ class ResultsPanel(QWidget):
self.results_view.m.clear_results()
def shutdown(self):
b = self.splitter.saveState()
gprefs['fts_search_splitter_state'] = bytearray(b)
self.clear_results()
def on_show(self):