mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-14 22:01:54 +08:00
修复第一次启动的问题
This commit is contained in:
parent
cb571e937d
commit
df26aaead8
@ -4,16 +4,16 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改文本消息宽度">
|
||||
<change afterPath="$PROJECT_DIR$/app/util/emoji.py" afterDir="false" />
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="支持显示表情包">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/hard_link.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/hard_link.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/components/bubble_message.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/components/bubble_message.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/decrypt/dat2pic.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/util/dat2pic.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/decrypt/decrypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/decrypt/decrypt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/msg.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/msg.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chat_window.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chat_window.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/contact/contact_window.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/contact/contact_window.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/tool/pc_decrypt/pc_decrypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/tool/pc_decrypt/pc_decrypt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/tool/tool_window.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/tool/tool_window.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/util/path.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/util/path.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main_pc.py" beforeDir="false" afterPath="$PROJECT_DIR$/main_pc.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -273,13 +273,6 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1672848140146</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00038" summary="修复部分bug">
|
||||
<created>1698853140384</created>
|
||||
<option name="number" value="00038" />
|
||||
<option name="presentableId" value="LOCAL-00038" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698853140384</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00039" summary="替换chat里的contact">
|
||||
<created>1698940208580</created>
|
||||
<option name="number" value="00039" />
|
||||
@ -616,7 +609,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700828162843</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="87" />
|
||||
<task id="LOCAL-00087" summary="支持显示表情包">
|
||||
<created>1700840978590</created>
|
||||
<option name="number" value="00087" />
|
||||
<option name="presentableId" value="LOCAL-00087" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700840978590</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="88" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -652,7 +652,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="修改UI" />
|
||||
<MESSAGE value="新增联系人头像组件" />
|
||||
<MESSAGE value="头像支持显示二进制" />
|
||||
<MESSAGE value="显示联系人信息" />
|
||||
@ -677,7 +676,8 @@
|
||||
<MESSAGE value="更新wx选择的路径" />
|
||||
<MESSAGE value="添加资源文件" />
|
||||
<MESSAGE value="修改文本消息宽度" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修改文本消息宽度" />
|
||||
<MESSAGE value="支持显示表情包" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="支持显示表情包" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
|
@ -35,7 +35,12 @@ def get_image_by_md5(md5: bytes):
|
||||
'''
|
||||
try:
|
||||
lock.acquire(True)
|
||||
cursor.execute(sql, [md5, ])
|
||||
try:
|
||||
cursor.execute(sql, [md5])
|
||||
except AttributeError:
|
||||
init_database()
|
||||
finally:
|
||||
cursor.execute(sql, [md5])
|
||||
result = cursor.fetchone()
|
||||
return result
|
||||
finally:
|
||||
|
@ -8,6 +8,7 @@ DB = []
|
||||
cursor = []
|
||||
msg_root_path = "./app/Database/Msg/"
|
||||
lock = threading.Lock()
|
||||
|
||||
# misc_path = './Msg/Misc.db'
|
||||
if os.path.exists(msg_root_path):
|
||||
for root, dirs, files in os.walk(msg_root_path):
|
||||
@ -22,9 +23,14 @@ if os.path.exists(msg_root_path):
|
||||
cursor.append(cursor0)
|
||||
|
||||
|
||||
def is_database_exist():
|
||||
return os.path.exists(msg_root_path + 'MSG0.db')
|
||||
|
||||
|
||||
def init_database():
|
||||
global DB
|
||||
global cursor
|
||||
print(DB)
|
||||
if not DB:
|
||||
if os.path.exists(msg_root_path):
|
||||
for root, dirs, files in os.walk(msg_root_path):
|
||||
|
@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QHBoxLayout
|
||||
|
||||
from app.DataBase import msg, hard_link
|
||||
from app.components.bubble_message import BubbleMessage, ChatWidget, Notice
|
||||
from app.person import MePC
|
||||
from app.person_pc import MePC
|
||||
from app.util import get_abs_path
|
||||
from app.util.emoji import get_emoji
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from PyQt5.QtCore import QThread, pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit
|
||||
|
||||
from app.DataBase import micro_msg, misc
|
||||
from app.DataBase import micro_msg, misc, msg
|
||||
from app.components import ContactQListWidgetItem
|
||||
from app.person_pc import ContactPC
|
||||
from app.ui_pc.Icon import Icon
|
||||
@ -72,10 +72,13 @@ class ChatWindow(QWidget, Ui_Form):
|
||||
def show_chats(self):
|
||||
if self.ok_flag:
|
||||
return
|
||||
msg.init_database()
|
||||
micro_msg.init_database()
|
||||
if not micro_msg.is_database_exist():
|
||||
if not msg.is_database_exist():
|
||||
QMessageBox.critical(self, "错误", "数据库不存在\n请先解密数据库")
|
||||
self.load_finish_signal.emit(True)
|
||||
self.show_thread = ShowThread()
|
||||
self.show_thread.load_finish_signal.connect(self.load_finish_signal)
|
||||
self.show_thread.start()
|
||||
return
|
||||
self.show_thread = ShowContactThread()
|
||||
self.show_thread.showSingal.connect(self.show_chat)
|
||||
@ -141,3 +144,16 @@ class ShowContactThread(QThread):
|
||||
self.showSingal.emit(contact)
|
||||
# pprint(contact.__dict__)
|
||||
self.load_finish_signal.emit(True)
|
||||
|
||||
|
||||
class ShowThread(QThread):
|
||||
showSingal = pyqtSignal(ContactPC)
|
||||
load_finish_signal = pyqtSignal(bool)
|
||||
|
||||
# heightSingal = pyqtSignal(int)
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def run(self) -> None:
|
||||
QThread.sleep(1)
|
||||
self.load_finish_signal.emit(True)
|
||||
|
@ -75,7 +75,10 @@ class ContactWindow(QWidget, Ui_Form):
|
||||
micro_msg.init_database()
|
||||
if not micro_msg.is_database_exist():
|
||||
QMessageBox.critical(self, "错误", "数据库不存在\n请先解密数据库")
|
||||
self.load_finish_signal.emit(True)
|
||||
self.show_thread = ShowThread()
|
||||
self.show_thread.showSingal.connect(self.show_contact)
|
||||
self.show_thread.load_finish_signal.connect(self.load_finish_signal)
|
||||
self.show_thread.start()
|
||||
return
|
||||
self.show_thread = ShowContactThread()
|
||||
self.show_thread.showSingal.connect(self.show_contact)
|
||||
@ -130,3 +133,16 @@ class ShowContactThread(QThread):
|
||||
self.showSingal.emit(contact)
|
||||
# pprint(contact.__dict__)
|
||||
self.load_finish_signal.emit(True)
|
||||
|
||||
|
||||
class ShowThread(QThread):
|
||||
showSingal = pyqtSignal(ContactPC)
|
||||
load_finish_signal = pyqtSignal(bool)
|
||||
|
||||
# heightSingal = pyqtSignal(int)
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def run(self) -> None:
|
||||
QThread.sleep(1)
|
||||
self.load_finish_signal.emit(True)
|
||||
|
@ -80,7 +80,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.label.setGeometry((self.width() - 300) // 2, (self.height() - 100) // 2, 300, 100)
|
||||
self.label.setPixmap(QPixmap(':/icons/icons/loading.svg'))
|
||||
|
||||
def load_data(self):
|
||||
def load_data(self, flag=True):
|
||||
if os.path.exists('./app/data/info.json'):
|
||||
with open('./app/data/info.json', 'r', encoding='utf-8') as f:
|
||||
dic = json.loads(f.read())
|
||||
@ -117,6 +117,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
tool_window = ToolWindow()
|
||||
tool_window.get_info_signal.connect(self.set_my_info)
|
||||
tool_window.decrypt_success_signal.connect(self.load_data)
|
||||
tool_window.load_finish_signal.connect(self.loading)
|
||||
self.stackedWidget.addWidget(tool_window)
|
||||
self.listWidget.setCurrentRow(0)
|
||||
|
@ -13,7 +13,7 @@ from . import decryptUi
|
||||
|
||||
|
||||
class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
DecryptSignal = pyqtSignal(str)
|
||||
DecryptSignal = pyqtSignal(bool)
|
||||
get_wxidSignal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
@ -126,7 +126,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
# 中间可以添加处理逻辑
|
||||
# QMessageBox.about(self, "解密成功", "数据库文件存储在app/DataBase/Msg文件夹下")
|
||||
|
||||
self.DecryptSignal.emit('ok')
|
||||
self.DecryptSignal.emit(True)
|
||||
# self.close()
|
||||
|
||||
def setProgressBarMaxNum(self, max_val):
|
||||
@ -156,7 +156,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
except:
|
||||
with open('./info.json', 'w', encoding='utf-8') as f:
|
||||
f.write(json.dumps(dic))
|
||||
self.DecryptSignal.emit('ok')
|
||||
self.DecryptSignal.emit(True)
|
||||
self.close()
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@ HistoryPanel::item:hover {
|
||||
|
||||
class ToolWindow(QWidget, Ui_Dialog):
|
||||
get_info_signal = pyqtSignal(str)
|
||||
decrypt_success_signal = pyqtSignal(bool)
|
||||
load_finish_signal = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
@ -64,6 +65,7 @@ class ToolWindow(QWidget, Ui_Dialog):
|
||||
tool_item = QListWidgetItem(Icon.MyInfo_Icon, 'None', self.listWidget)
|
||||
decrypt_window = DecryptControl()
|
||||
decrypt_window.get_wxidSignal.connect(self.get_info_signal)
|
||||
decrypt_window.DecryptSignal.connect(self.decrypt_success_signal)
|
||||
self.stackedWidget.addWidget(decrypt_window)
|
||||
label = QLabel('我是页面', self)
|
||||
label.setAlignment(Qt.AlignCenter)
|
||||
|
@ -3,6 +3,8 @@ import os
|
||||
from app.person_pc import MePC
|
||||
from app.util import dat2pic
|
||||
|
||||
if not os.path.exists('./data/'):
|
||||
os.mkdir('./data/')
|
||||
if not os.path.exists('./data/image'):
|
||||
os.mkdir('./data/image')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user