Edit Book: Clear the Check Book panel when opening a new book

This commit is contained in:
Kovid Goyal 2014-07-31 08:49:11 +05:30
parent cf7887dd61
commit 609609e688
2 changed files with 9 additions and 2 deletions

View File

@ -285,6 +285,7 @@ class Boss(QObject):
det_msg=job.traceback, show=True)
if cn:
self.save_manager.clear_notify_data()
self.gui.check_book.clear()
dictionaries.clear_ignored(), dictionaries.clear_caches()
parse_worker.clear()
container = job.result

View File

@ -100,7 +100,9 @@ class Check(QSplitter):
def save_state(self):
tprefs.set('check-book-splitter-state', bytearray(self.saveState()))
def clear_help(self, msg):
def clear_help(self, msg=None):
if msg is None:
msg = _('No problems found')
self.help.setText('<h2>%s</h2><p><a style="text-decoration:none" title="%s" href="run:check">%s</a></p>' % (
msg, _('Click to run a check on the book'), _('Run check')))
@ -207,7 +209,7 @@ class Check(QSplitter):
self.current_item_changed()
self.items.setFocus(Qt.OtherFocusReason)
else:
self.clear_help(_('No problems found'))
self.clear_help()
def fix_errors(self, container, errors):
with BusyCursor():
@ -230,6 +232,10 @@ class Check(QSplitter):
self.current_item_activated()
return super(Check, self).keyPressEvent(ev)
def clear(self):
self.items.clear()
self.clear_help()
def main():
from calibre.gui2 import Application
from calibre.gui2.tweak_book.boss import get_container