From 79b304baee78b2b694e9adc111422ac5352ab10f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Nov 2013 14:09:01 +0530 Subject: [PATCH] Change global save action when editor is modified --- src/calibre/gui2/tweak_book/boss.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 62569986d0..3c8884fe6f 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -219,10 +219,10 @@ class Boss(QObject): if editor is None: editor = self.editors[name] = editor_from_syntax(syntax, self.gui.editor_tabs) editor.undo_redo_state_changed.connect(self.editor_undo_redo_state_changed) - editor.modification_state_changed.connect(self.editor_modification_state_changed) self.gui.central.add_editor(name, editor) c = current_container() editor.load_text(c.decode(c.open(name).read())) + editor.modification_state_changed.connect(self.editor_modification_state_changed) self.gui.central.show_editor(editor) def edit_file_requested(self, name, syntax, mime): @@ -249,8 +249,10 @@ class Boss(QObject): def editor_undo_redo_state_changed(self, *args): self.apply_current_editor_state(update_keymap=False) - def editor_modification_state_changed(self, *args): + def editor_modification_state_changed(self, is_modified): self.apply_current_editor_state(update_keymap=False) + if is_modified: + actions['save-book'].setEnabled(True) def apply_current_editor_state(self, update_keymap=True): ed = self.gui.central.current_editor