'Convert an IPython notebook to a Python script in editor'

def convert_notebook(self, fname):

    try:
        script = nbexporter().from_filename(fname)[0]
    except Exception as e:
        QMessageBox.critical(self, _('Conversion    error'), (_('It    was    not    possible    to    convert    this    notebook.    The    error    is:\n\n') + to_text_string(e)))
        return
    self.sig_new_file.emit(script)
