From 1b901535ab5d4c91df1fe193dd927ae9046da9b9 Mon Sep 17 00:00:00 2001 From: zhoushuaikang <863909694@qq.com> Date: Thu, 29 Feb 2024 16:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=AF=8D=E6=96=87=E4=BB=B6=E5=86=99=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/mainview.py | 15 ++------------ app/ui/tool/pc_decrypt/pc_decrypt.py | 31 +++++++--------------------- app/ui/tool/setting/setting.py | 4 ++-- 3 files changed, 12 insertions(+), 38 deletions(-) diff --git a/app/ui/mainview.py b/app/ui/mainview.py index 5dfd830..7c5e11e 100644 --- a/app/ui/mainview.py +++ b/app/ui/mainview.py @@ -350,18 +350,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif): def set_my_info(self, wxid): self.avatar = QPixmap() - try: - img_bytes = misc_db.get_avatar_buffer(wxid) - except: - logger.error(f'数据库错误:\n{traceback.format_exc()}') - QMessageBox.critical(self, "数据库错误", "请重启电脑后重试") - close_db() - import shutil - try: - shutil.rmtree(DB_DIR) - except: - pass - return + img_bytes = misc_db.get_avatar_buffer(wxid) if not img_bytes: return if img_bytes[:4] == b'\x89PNG': @@ -377,7 +366,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif): shutil.rmtree(DB_DIR) except: pass - QMessageBox.critical(self, "数据库错误", "请重启电脑后重试") + QMessageBox.critical(self, "数据库错误", "数据库错误,请删除app文件夹后重启电脑再运行软件") return me = Me() me.set_avatar(img_bytes) diff --git a/app/ui/tool/pc_decrypt/pc_decrypt.py b/app/ui/tool/pc_decrypt/pc_decrypt.py index 4ee5ab3..b0fb6de 100644 --- a/app/ui/tool/pc_decrypt/pc_decrypt.py +++ b/app/ui/tool/pc_decrypt/pc_decrypt.py @@ -229,11 +229,11 @@ class DecryptThread(QThread): tasks.append([self.key, inpath, output_path]) else: try: - name,suffix = file.split('.') + name, suffix = file.split('.') if suffix.startswith('db_SQLITE'): inpath = os.path.join(root, file) # print(inpath) - output_path = os.path.join(output_dir, name+'.db') + output_path = os.path.join(output_dir, name + '.db') tasks.append([self.key, inpath, output_path]) except: continue @@ -250,17 +250,9 @@ class DecryptThread(QThread): import shutil if os.path.exists(target_database): os.remove(target_database) - try: - shutil.copy2(os.path.join(DB_DIR, 'MSG0.db'), target_database) # 使用一个数据库文件作为模板 - except FileNotFoundError: - logger.error(traceback.format_exc()) - self.errorSignal.emit(True) + shutil.copy2(os.path.join(DB_DIR, 'MSG0.db'), target_database) # 使用一个数据库文件作为模板 # 合并数据库 - try: - merge_databases(source_databases, target_database) - except FileNotFoundError: - logger.error(traceback.format_exc()) - QMessageBox.critical("错误", "数据库不存在\n请检查微信版本是否为最新") + merge_databases(source_databases, target_database) # 音频数据库文件 target_database = os.path.join(DB_DIR, 'MediaMSG.db') @@ -268,17 +260,10 @@ class DecryptThread(QThread): if os.path.exists(target_database): os.remove(target_database) source_databases = [os.path.join(DB_DIR, f"MediaMSG{i}.db") for i in range(1, 50)] - try: - shutil.copy2(os.path.join(DB_DIR, 'MediaMSG0.db'), target_database) # 使用一个数据库文件作为模板 - except FileNotFoundError: - logger.error(traceback.format_exc()) - self.errorSignal.emit(True) + shutil.copy2(os.path.join(DB_DIR, 'MediaMSG0.db'), target_database) # 使用一个数据库文件作为模板 + # 合并数据库 - try: - merge_MediaMSG_databases(source_databases, target_database) - except FileNotFoundError: - logger.error(traceback.format_exc()) - QMessageBox.critical("错误", "数据库不存在\n请检查微信版本是否为最新") + merge_MediaMSG_databases(source_databases, target_database) self.okSignal.emit('ok') # self.signal.emit('100') @@ -294,7 +279,7 @@ class MyThread(QThread): pass def get_bias_add(self, version): - url = urljoin(SERVER_API_URL,'wxBiasAddr') + url = urljoin(SERVER_API_URL, 'wxBiasAddr') data = { 'version': version } diff --git a/app/ui/tool/setting/setting.py b/app/ui/tool/setting/setting.py index 028b938..26a7e59 100644 --- a/app/ui/tool/setting/setting.py +++ b/app/ui/tool/setting/setting.py @@ -122,11 +122,11 @@ class SettingControl(QWidget, Ui_Form): f.write(stopwords) if os.path.exists('./app/data/new_words.txt'): with open('./app/data/new_words.txt', 'r', encoding='utf-8') as f: - stopwords = set(f.read().splitlines()) + new_words = set(f.read().splitlines()) self.plainTextEdit_newword.setPlainText(' '.join(new_words)) else: self.plainTextEdit_newword.setPlainText(' '.join(new_words)) - stopwords = '\n'.join(stopwords) + stopwords = '\n'.join(new_words) with open('./app/data/new_words.txt', 'w', encoding='utf-8') as f: f.write(stopwords)