mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Saved searches window: Remember the last used values for where to search and search direction
This commit is contained in:
parent
2f300b1ae8
commit
6d1139ba2d
@ -753,6 +753,20 @@ class SavedSearches(QWidget):
|
|||||||
|
|
||||||
self.searches.setFocus(Qt.OtherFocusReason)
|
self.searches.setFocus(Qt.OtherFocusReason)
|
||||||
|
|
||||||
|
@dynamic_property
|
||||||
|
def state(self):
|
||||||
|
def fget(self):
|
||||||
|
return {'wrap':self.wrap, 'direction':self.direction, 'where':self.where}
|
||||||
|
def fset(self, val):
|
||||||
|
self.wrap, self.where, self.direction = val['wrap'], val['where'], val['direction']
|
||||||
|
return property(fget=fget, fset=fset)
|
||||||
|
|
||||||
|
def save_state(self):
|
||||||
|
tprefs['saved_seaches_state'] = self.state
|
||||||
|
|
||||||
|
def restore_state(self):
|
||||||
|
self.state = tprefs.get('saved_seaches_state', SearchWidget.DEFAULT_STATE)
|
||||||
|
|
||||||
def has_focus(self):
|
def has_focus(self):
|
||||||
if self.hasFocus():
|
if self.hasFocus():
|
||||||
return True
|
return True
|
||||||
|
@ -703,6 +703,7 @@ class Main(MainWindow):
|
|||||||
tprefs.set('main_window_geometry', bytearray(self.saveGeometry()))
|
tprefs.set('main_window_geometry', bytearray(self.saveGeometry()))
|
||||||
tprefs.set('main_window_state', bytearray(self.saveState(self.STATE_VERSION)))
|
tprefs.set('main_window_state', bytearray(self.saveState(self.STATE_VERSION)))
|
||||||
self.central.save_state()
|
self.central.save_state()
|
||||||
|
self.saved_searches.save_state()
|
||||||
self.check_book.save_state()
|
self.check_book.save_state()
|
||||||
|
|
||||||
def restore_state(self):
|
def restore_state(self):
|
||||||
@ -713,6 +714,7 @@ class Main(MainWindow):
|
|||||||
if state is not None:
|
if state is not None:
|
||||||
self.restoreState(state, self.STATE_VERSION)
|
self.restoreState(state, self.STATE_VERSION)
|
||||||
self.central.restore_state()
|
self.central.restore_state()
|
||||||
|
self.saved_searches.restore_state()
|
||||||
|
|
||||||
def contextMenuEvent(self, ev):
|
def contextMenuEvent(self, ev):
|
||||||
ev.ignore()
|
ev.ignore()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user