From 20e0781b80e4bf7a8e3a4b4c5e02a2bff4c75098 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Nov 2013 12:41:04 +0530 Subject: [PATCH] Prevent double syncing when clicking in preview panel --- src/calibre/gui2/tweak_book/boss.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index a2618f4ebe..12660743c8 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -44,6 +44,7 @@ class Boss(QObject): self.save_manager = SaveManager(parent) self.save_manager.report_error.connect(self.report_save_error) self.doing_terminal_save = False + self.ignore_preview_to_editor_sync = False def __call__(self, gui): self.gui = gui @@ -503,9 +504,15 @@ class Boss(QObject): def sync_editor_to_preview(self, name, lnum): editor = self.edit_file(name, 'html') - editor.current_line = lnum + self.ignore_preview_to_editor_sync = True + try: + editor.current_line = lnum + finally: + self.ignore_preview_to_editor_sync = False def sync_preview_to_editor(self): + if self.ignore_preview_to_editor_sync: + return ed = self.gui.central.current_editor if ed is not None: name = None