<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)