From f77fc9493eefe0092e27f0202d8d0f7926bc7313 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Nov 2013 08:34:15 +0530 Subject: [PATCH] Move refresh timer control into Preview class --- src/calibre/gui2/tweak_book/boss.py | 4 ++-- src/calibre/gui2/tweak_book/preview.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index a749e65f54..556dd90c7f 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -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() diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 883fa2ba7f..f4a68b287b 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -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()