def action_save_handler(self): if self._code_from_file and self._is_dirty: content = CodeComposer.compose(self.ui.txtGlobalExp.toPlainText(), self.ui.txtFieldExp.toPlainText()) with codecs.open(self._code_from_file, 'w', encoding='utf-8') as content_file: content_file.write(content) self._is_dirty = False self.update_btn_status()
def action_save_as_handler(self): file_name = QFileDialog.getSaveFileName(self, self.tr('Save code to file...'), filter=self._filter) if file_name: content = CodeComposer.compose(self.ui.txtGlobalExp.toPlainText(), self.ui.txtFieldExp.toPlainText()) with codecs.open(file_name, 'w', encoding='utf-8') as content_file: content_file.write(content) self._code_from_file = file_name self._is_dirty = False self.update_btn_status()
def action_save_as_handler(self): file_name = QFileDialog.getSaveFileName( self, self.tr('Save code to file...'), filter=self._filter) if file_name: content = CodeComposer.compose(self.ui.txtGlobalExp.toPlainText(), self.ui.txtFieldExp.toPlainText()) with codecs.open(file_name, 'w', encoding='utf-8') as content_file: content_file.write(content) self._code_from_file = file_name self._is_dirty = False self.update_btn_status()