'Removes all ouput in the ipynb format (Json only)'

@Slot()
def clear_all_output(self):

    try:
        nb = nbformat.reads(self.toPlainText(), as_version=4)
        if nb.cells:
            for cell in nb.cells:
                if ('outputs' in cell):
                    cell['outputs'] = []
                if ('prompt_number' in cell):
                    cell['prompt_number'] = None
        self.selectAll()
        self.insertPlainText(nbformat.writes(nb))
    except Exception as e:
        QMessageBox.critical(self, _('Removal    error'), (_('It    was    not    possible    to    remove    outputs    from    this    notebook.    The    error    is:\n\n') + to_text_string(e)))
        return
