Save the current text to file

def saveToFile(self):
        """
        Save the current text to file
        """
        filename = self.codeEditor.dialog.getSaveFileName()
        if filename and filename != '.':
            with open(filename, 'w') as f:
                f.write(self.toPlainText())
            print('saved script under %s' % filename)