def storeValue(self): # As the HTML returned can be different than the one we set in # showValue() even if the text hasn't been modified by the user # we need to track modifications using QTextDocument property if self.uiText.document().isModified(): html = Common.simplifyHtml( self.uiText.document().toHtml() ) self.record.setValue(self.name, html or False )
def translate(self): if not self.record.id: QMessageBox.information( self, _('Translation dialog'), _('You must save the resource before adding translations')) return html = Common.simplifyHtml( self.uiText.document().toHtml() ) dialog = TranslationDialog( self.record.id, self.record.group.resource, self.attrs['name'], html, TranslationDialog.RichEdit, self ) if dialog.exec_() == QDialog.Accepted: self.record.setValue(self.name, unicode( dialog.result ) or False )