From 3b7c0e9ac602db569de1c1ddb7f5e2e2ddeb5ead Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 Dec 2013 15:35:06 +0530 Subject: [PATCH] Handle check items being activated that are not editable --- src/calibre/gui2/tweak_book/boss.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index fd4d3e44fb..9f948702b4 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -690,9 +690,8 @@ class Boss(QObject): editor = editors[name] self.gui.central.show_editor(editor) else: - syntax = syntax_from_mime(name, current_container().mime_map[name]) - editor = self.edit_file(name, syntax) - if editor.has_line_numbers: + editor = self.edit_file_requested(name, None, current_container().mime_map[name]) + if getattr(editor, 'has_line_numbers', False): editor.go_to_line(item.line, item.col) editor.set_focus() @@ -812,7 +811,7 @@ class Boss(QObject): return error_dialog( self.gui, _('Unsupported file format'), _('Editing files of type %s is not supported' % mime), show=True) - self.edit_file(name, syntax) + return self.edit_file(name, syntax) # Editor basic controls {{{ def do_editor_undo(self):