From 0c8044e7b6ce8625f35d7e22fb5b221a51d50be2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 6 Aug 2014 20:35:26 +0530 Subject: [PATCH] Edit Book: In the right click menu, do not show cut/copy/undo/redo items if they are disabled --- src/calibre/gui2/tweak_book/editor/widget.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 081dba6a01..6fcccb0a75 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -477,10 +477,14 @@ class Editor(QMainWindow): m.addAction(_('Show help for: %s') % word, partial(open_url, url)) for x in ('undo', 'redo'): - a(actions['editor-%s' % x]) + ac = actions['editor-%s' % x] + if ac.isEnabled(): + a(ac) m.addSeparator() for x in ('cut', 'copy', 'paste'): - a(actions['editor-' + x]) + ac = actions['editor-' + x] + if ac.isEnabled(): + a(ac) m.addSeparator() m.addAction(_('&Select all'), self.editor.select_all) m.addAction(actions['mark-selected-text'])