From 6cda45e42f4bf508f6206e23d29a4d82ada708f5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Nov 2013 14:44:04 +0530 Subject: [PATCH] Fix standalone editor launch not working --- src/calibre/gui2/tweak_book/editor/widget.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index f59c6de608..088794b4f0 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -76,10 +76,16 @@ class Editor(QMainWindow): self.action_bar = b = self.addToolBar(_('File actions tool bar')) b.setObjectName('action_bar') # Needed for saveState for x in ('save', 'undo', 'redo'): - b.addAction(actions['editor-%s' % x]) + try: + b.addAction(actions['editor-%s' % x]) + except KeyError: + pass self.edit_bar = b = self.addToolBar(_('Edit actions tool bar')) for x in ('cut', 'copy', 'paste'): - b.addAction(actions['editor-%s' % x]) + try: + b.addAction(actions['editor-%s' % x]) + except KeyError: + pass def break_cycles(self): self.modification_state_changed.disconnect() @@ -136,7 +142,7 @@ def launch_editor(path_to_edit, path_is_raw=False, syntax='html'): syntax = 'css' app = QApplication([]) t = Editor(syntax) - t.load_text(raw, syntax=syntax) + t.data = raw t.show() app.exec_()