Move refresh timer control into Preview class

This commit is contained in:
Kovid Goyal 2013-11-09 08:34:15 +05:30
parent d9fa433025
commit f77fc9493e
2 changed files with 8 additions and 3 deletions

View File

@ -330,7 +330,7 @@ class Boss(QObject):
ed.paste()
def editor_data_changed(self, editor):
self.gui.preview.refresh_timer.start(tprefs['preview_refresh_time'] * 1000)
self.gui.preview.start_refresh_timer()
def editor_undo_redo_state_changed(self, *args):
self.apply_current_editor_state(update_keymap=False)
@ -472,7 +472,7 @@ class Boss(QObject):
QApplication.instance().quit()
def shutdown(self):
self.gui.preview.refresh_timer.stop()
self.gui.preview.stop_refresh_timer()
self.save_state()
self.save_manager.shutdown()
parse_worker.shutdown()

View File

@ -20,7 +20,7 @@ from calibre.constants import iswindows
from calibre.ebooks.oeb.polish.parsing import parse
from calibre.ebooks.oeb.base import serialize, OEB_DOCS
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.gui2.tweak_book import current_container, editors
from calibre.gui2.tweak_book import current_container, editors, tprefs
from calibre.gui2.viewer.documentview import apply_settings
from calibre.gui2.viewer.config import config
from calibre.utils.ipc.simple_worker import offload_worker
@ -300,3 +300,8 @@ class Preview(QWidget):
def clear(self):
self.view.clear()
def start_refresh_timer(self):
self.refresh_timer.start(tprefs['preview_refresh_time'] * 1000)
def stop_refresh_timer(self):
self.refresh_timer.stop()