修改打开路径的初始位置,修复打开404图片闪退问题

This commit is contained in:
shuaikangzhou 2023-11-29 22:57:58 +08:00
parent 94e5064aa3
commit a4987a0af1
3 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import os.path
from PIL import Image
from PyQt5 import QtGui
from PyQt5.QtCore import QSize, pyqtSignal, Qt, QThread
@ -100,8 +102,9 @@ class OpenImageThread(QThread):
self.image_path = image_path
def run(self) -> None:
image = Image.open(self.image_path)
image.show()
if os.path.exists(self.image_path):
image = Image.open(self.image_path)
image.show()
class ImageMessage(QLabel):

View File

@ -137,6 +137,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
label.setAlignment(Qt.AlignCenter)
self.stackedWidget.addWidget(label)
tool_window.load_finish_signal.connect(self.loading)
self.statusbar.showMessage('聊天窗口上划到顶部会加载新的聊天记录\n一次不行那就多来几次')
self.contact_window.load_finish_signal.connect(self.loading)
self.chat_window.load_finish_signal.connect(self.loading)

View File

@ -86,8 +86,9 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
def select_db_dir(self):
directory = QFileDialog.getExistingDirectory(
self, "选取微信安装目录——能看到Msg文件夹",
"C:/") # 起始路径
self, "选取微信文件保存目录——能看到Msg文件夹",
os.path.expanduser('~\Documents')
) # 起始路径
db_dir = os.path.join(directory, 'Msg')
if not os.path.exists(db_dir):
QMessageBox.critical(self, "错误", "文件夹选择错误\n一般以wxid_xxx结尾")