def crypto_double_img_show(self, img_path, next_img_path, order_option): img_file_like = io.BytesIO( ByteCrypto(self.password.get()).decrypt(img_path)) next_img_file_like = io.BytesIO( ByteCrypto(self.password.get()).decrypt(next_img_path)) self.imgCanvas.default_double_img_show(img_file_like, next_img_file_like, order_option, self.rotate_angle, self.zoom_width)
def file_show(self): if not os.path.isfile(self.current_file_path): logging.error("Text Path Error!!!") tkmessagebox.showerror("错误", "文件路径错误!") return self.filePath.set(self.current_file_path) crypto_option = self.cryptoOption.get() self.fileShowText.delete(0.0, 'end') self.fileSaveStatus.set("") if crypto_option == "解密文件": try: file_str = ByteCrypto(self.password.get()).decrypt( self.current_file_path) self.str_ecoding = chardet.detect(file_str)['encoding'] self.file_text = file_str.decode(self.str_ecoding) self.fileCryptoStatus.set("[已文件加密]") except Exception as e: self.file_text = "" self.filePath.set("") self.fileCryptoStatus.set("") self.fileSaveStatus.set("") logging.error("Text Decrypt Error!!!") tkmessagebox.showerror("错误", "文本格式或密码错误!") else: with open(self.current_file_path, "r") as f: self.file_text = f.read() if crypto_option == "解密文本": password = self.password.get() try: self.file_text = StringCrypto(password).decrypt( self.file_text) self.fileCryptoStatus.set("[已加密]") except Exception as e: self.file_text = "" self.filePath.set("") self.fileCryptoStatus.set("") self.fileSaveStatus.set("") logging.error("Text Decrypt Error!!!") tkmessagebox.showerror("错误", "文本格式或密码错误!") elif crypto_option == "普通文本": self.fileCryptoStatus.set("") self.set_text_size() self.set_text_wrap() self.fileShowText.insert('end', self.file_text)
def crypto_gif_show(self, img_path): img_file_like = io.BytesIO( ByteCrypto(self.password.get()).decrypt(img_path)) self.imgCanvas.default_gif_show(img_file_like, self.rotate_angle, self.zoom_width)
def crypto_gif_show(self, img_path): img_file_like = io.BytesIO( ByteCrypto(self.__dict__["password"].get()).decrypt(img_path)) self.default_gif_show(img_file_like)