def editor_from_syntax(syntax, parent=None): if syntax in {'text', 'html', 'css', 'xml'}: from calibre.gui2.tweak_book.editor.widget import Editor return Editor(syntax, parent=parent) elif syntax == 'raster_image': from calibre.gui2.tweak_book.editor.image import Editor return Editor(syntax, parent=parent)
def editor_from_syntax(syntax, parent=None): if syntax in all_text_syntaxes: from calibre.gui2.tweak_book.editor.widget import Editor return Editor(syntax, parent=parent) elif syntax == 'raster_image': from calibre.gui2.tweak_book.editor.image import Editor return Editor(syntax, parent=parent)
def editor_from_syntax(syntax, parent=None): if syntax not in {'text', 'html', 'css', 'xml'}: return None from calibre.gui2.tweak_book.editor.widget import Editor return Editor(syntax, parent=parent)