Skip to content
Permalink
Browse files
Edit Book: Saved searches window: Remember the last used values for w…
…here to search and search direction
  • Loading branch information
kovidgoyal committed Oct 7, 2014
1 parent 2f300b1 commit 6d1139ba2dd601cda21581be81d284f60023ce10
Showing with 16 additions and 0 deletions.
  1. +14 −0 src/calibre/gui2/tweak_book/search.py
  2. +2 −0 src/calibre/gui2/tweak_book/ui.py
@@ -753,6 +753,20 @@ def pb(text, tooltip=None):

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):
if self.hasFocus():
return True
@@ -703,6 +703,7 @@ def save_state(self):
tprefs.set('main_window_geometry', bytearray(self.saveGeometry()))
tprefs.set('main_window_state', bytearray(self.saveState(self.STATE_VERSION)))
self.central.save_state()
self.saved_searches.save_state()
self.check_book.save_state()

def restore_state(self):
@@ -713,6 +714,7 @@ def restore_state(self):
if state is not None:
self.restoreState(state, self.STATE_VERSION)
self.central.restore_state()
self.saved_searches.restore_state()

def contextMenuEvent(self, ev):
ev.ignore()

0 comments on commit 6d1139b

Please sign in to comment.