From 30a7a8e9968211b7b67a86804d8327fc9f61e1c4 Mon Sep 17 00:00:00 2001
From: KenanZhu <3471685733@qq.com>
Date: Thu, 9 Jul 2026 09:29:45 +0800
Subject: [PATCH] =?UTF-8?q?fix(settings):=20=E4=BF=AE=E5=A4=8D=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E5=85=AC=E5=91=8A=E6=A0=8F=E8=BF=9E=E6=8E=A5=E6=97=B6?=
=?UTF-8?q?=20QThread=20=E6=9C=AA=E7=AD=89=E5=BE=85=E5=AF=BC=E8=87=B4?=
=?UTF-8?q?=E9=97=AA=E9=80=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/gui/ALCheckUpdateDialog.py | 29 +++++++++++++++++++++++------
src/gui/ALSettingsWidget.py | 20 ++++++++++++--------
2 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/src/gui/ALCheckUpdateDialog.py b/src/gui/ALCheckUpdateDialog.py
index 99494e1..17ba6a3 100644
--- a/src/gui/ALCheckUpdateDialog.py
+++ b/src/gui/ALCheckUpdateDialog.py
@@ -73,9 +73,9 @@ class ALCheckUpdateDialog(QDialog):
)
TitleLabel.setTextFormat(Qt.TextFormat.RichText)
TitleLabel.setText(
- f"检测到最新版本: "
- f"{self.__current_version}"
- f" > "
+ f"检测到新版本: "
+ f"{self.__current_version} "
+ f"> "
f"{self.__latest_version}"
)
layout.addWidget(TitleLabel)
@@ -83,8 +83,7 @@ class ALCheckUpdateDialog(QDialog):
InfoLabel.setTextFormat(Qt.TextFormat.RichText)
InfoLabel.setWordWrap(True)
InfoLabel.setText(
- f"发布版本: {self.__tag_name}
"
- f"发布页面: {self.__html_url}"
+ f"最新版本: {self.__tag_name}
"
)
InfoLabel.setOpenExternalLinks(True)
layout.addWidget(InfoLabel)
@@ -94,14 +93,26 @@ class ALCheckUpdateDialog(QDialog):
"前往 GitHub",
QDialogButtonBox.ButtonRole.AcceptRole
)
+ self.__btn_github.setMinimumWidth(100)
+ self.__btn_github.setMaximumWidth(100)
+ self.__btn_github.setMinimumHeight(25)
+ self.__btn_github.setMaximumHeight(25)
self.__btn_download = self.__button_box.addButton(
"官网下载",
QDialogButtonBox.ButtonRole.ActionRole
)
+ self.__btn_download.setMinimumWidth(80)
+ self.__btn_download.setMaximumWidth(80)
+ self.__btn_download.setMinimumHeight(25)
+ self.__btn_download.setMaximumHeight(25)
self.__btn_cancel = self.__button_box.addButton(
"取消",
QDialogButtonBox.ButtonRole.RejectRole
)
+ self.__btn_cancel.setMinimumWidth(80)
+ self.__btn_cancel.setMaximumWidth(80)
+ self.__btn_cancel.setMinimumHeight(25)
+ self.__btn_cancel.setMaximumHeight(25)
layout.addWidget(self.__button_box)
def buildUpToDateUi(
@@ -117,7 +128,9 @@ class ALCheckUpdateDialog(QDialog):
TitleLabel.setText(f"已是最新版本 !")
layout.addWidget(TitleLabel)
InfoLabel = QLabel()
- InfoLabel.setText(f"当前版本: {self.__current_version}")
+ InfoLabel.setText(
+ f"当前版本: {self.__current_version}
"
+ )
layout.addWidget(InfoLabel)
layout.addStretch()
self.__button_box = QDialogButtonBox()
@@ -125,6 +138,10 @@ class ALCheckUpdateDialog(QDialog):
"确定",
QDialogButtonBox.ButtonRole.AcceptRole
)
+ self.__btn_close.setMinimumWidth(80)
+ self.__btn_close.setMaximumWidth(80)
+ self.__btn_close.setMinimumHeight(25)
+ self.__btn_close.setMaximumHeight(25)
layout.addWidget(self.__button_box)
def connectSignals(
diff --git a/src/gui/ALSettingsWidget.py b/src/gui/ALSettingsWidget.py
index 60cee65..b3db6bd 100644
--- a/src/gui/ALSettingsWidget.py
+++ b/src/gui/ALSettingsWidget.py
@@ -116,6 +116,8 @@ class ALSettingsWidget(CenterOnParentMixin, QWidget, Ui_ALSettingsWidget):
event: QCloseEvent
):
+ if hasattr(self, '__bulletin_test_worker') and self.__bulletin_test_worker is not None:
+ self.__bulletin_test_worker.wait(3000)
self.settingsWidgetIsClosed.emit()
super().closeEvent(event)
@@ -485,25 +487,26 @@ class ALSettingsWidget(CenterOnParentMixin, QWidget, Ui_ALSettingsWidget):
self, api_url, {"date": "", "time": "", "range_hour": "1"}
)
self.__bulletin_test_worker.fetchWorkerIsFinished.connect(
- self.onBulletinTestFetched
+ self.onBulletinTestIsFinished
)
self.__bulletin_test_worker.fetchWorkerFinishedWithError.connect(
- self.onBulletinTestError
+ self.onBulletinTestFinishedWithError
)
self.__bulletin_test_worker.start()
@Slot(dict)
- def onBulletinTestFetched(
+ def onBulletinTestIsFinished(
self,
data: dict
):
self.__bulletin_test_worker.fetchWorkerIsFinished.disconnect(
- self.onBulletinTestFetched
+ self.onBulletinTestIsFinished
)
self.__bulletin_test_worker.fetchWorkerFinishedWithError.disconnect(
- self.onBulletinTestError
+ self.onBulletinTestFinishedWithError
)
+ self.__bulletin_test_worker.wait(3000)
self.__bulletin_test_worker.deleteLater()
self.__bulletin_test_worker = None
elapsed_ms = (time.monotonic() - self.__bulletin_test_t0) * 1000
@@ -515,17 +518,18 @@ class ALSettingsWidget(CenterOnParentMixin, QWidget, Ui_ALSettingsWidget):
QTimer.singleShot(3000, self, self.clearBulletinTestStatus)
@Slot(str)
- def onBulletinTestError(
+ def onBulletinTestFinishedWithError(
self,
error_message: str
):
self.__bulletin_test_worker.fetchWorkerIsFinished.disconnect(
- self.onBulletinTestFetched
+ self.onBulletinTestIsFinished
)
self.__bulletin_test_worker.fetchWorkerFinishedWithError.disconnect(
- self.onBulletinTestError
+ self.onBulletinTestFinishedWithError
)
+ self.__bulletin_test_worker.wait(3000)
self.__bulletin_test_worker.deleteLater()
self.__bulletin_test_worker = None
self.BulletinTestStatusLabel.setText(f"连接失败:{error_message}")