def decrypt_text(self, widget): text_path_obj = self.gui.get_object("txt_CTPath") text_pass_obj = self.gui.get_object("txt_CTPass") text_content = self.gui.get_object("txt_CTContent") path = text_path_obj.get_text() passw = text_pass_obj.get_text() tbuffer = text_content.get_buffer() content = tbuffer.get_text( tbuffer.get_start_iter(), tbuffer.get_end_iter(), True ) if (path or content): if passw: if path: trg = TurangaTextCryp(path, passw) elif content: f = open(".temp-file", "w") f.write(self.CTdata["TXT_REAL_CHARS"]) f.close() trg = TurangaTextCryp(".temp-file", passw) result = trg.decryp() if result: self.CTdata["TXT_REAL_CHARS"] = result txt_buf = Gtk.TextBuffer() txt_buf.set_text(unicode(result, errors='replace')) text_content.set_buffer(txt_buf) else: self.msg( self.CryptTextWindow, "El archivo no es un cifrado turanga!" ) else: self.msg( self.CryptTextWindow, "Password!?" ) else: self.msg( self.CryptTextWindow, "Nothing to decrypt!" )