Fix standalone editor launch not working

This commit is contained in:
Kovid Goyal 2013-11-09 14:44:04 +05:30
parent c7ff021541
commit 6cda45e42f

View File

@ -76,10 +76,16 @@ class Editor(QMainWindow):
self.action_bar = b = self.addToolBar(_('File actions tool bar')) self.action_bar = b = self.addToolBar(_('File actions tool bar'))
b.setObjectName('action_bar') # Needed for saveState b.setObjectName('action_bar') # Needed for saveState
for x in ('save', 'undo', 'redo'): 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')) self.edit_bar = b = self.addToolBar(_('Edit actions tool bar'))
for x in ('cut', 'copy', 'paste'): 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): def break_cycles(self):
self.modification_state_changed.disconnect() self.modification_state_changed.disconnect()
@ -136,7 +142,7 @@ def launch_editor(path_to_edit, path_is_raw=False, syntax='html'):
syntax = 'css' syntax = 'css'
app = QApplication([]) app = QApplication([])
t = Editor(syntax) t = Editor(syntax)
t.load_text(raw, syntax=syntax) t.data = raw
t.show() t.show()
app.exec_() app.exec_()