def set_editor(self, editor):
        try:
            self.setHtml(editor.to_html())
        except (TypeError, __HOLE__):
            self.setHtml('<center>No preview available...</center>')
            self._editor = None
            self.hide_requested.emit()
        else:
            if self._editor is not None and editor != self._editor:
                try:
                    self._editor.textChanged.disconnect(self._on_text_changed)
                except TypeError:
                    pass
            editor.textChanged.connect(self._on_text_changed)
            self._editor = proxy(editor)
            self.show_requested.emit()
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/preview.py/HtmlPreviewWidget.set_editor