Skip to content

Commit 2f93b95

Browse files
authored
Revert "fix 無法使用KeyboardInterrupt退出程式 " (#274)
Revert "feat: 添加信号处理器以优雅地处理应用退出" This reverts commit 09ff31b.
1 parent 09ff31b commit 2f93b95

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

Ghost-Downloader-3.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import getpass
33
import os
44
import sys
5-
import signal
65

76
from qfluentwidgets import qconfig
87

@@ -26,14 +25,6 @@
2625

2726
app = SingletonApplication(sys.argv, "Ghost Downloader")
2827

29-
# 添加信号处理器
30-
def signal_handler(signum, frame):
31-
"""处理 SIGINT 信号(Ctrl+C)"""
32-
print("\n接收到退出信号,正在关闭应用...")
33-
app.quit()
34-
35-
signal.signal(signal.SIGINT, signal_handler)
36-
3728
# Starting Program
3829
import time
3930
import warnings
@@ -100,17 +91,10 @@ def signal_handler(signum, frame):
10091
speedLimiter.timeout.connect(cfg.resetGlobalSpeed) # 刷新 globalSpeed为 0
10192
speedLimiter.start()
10293

103-
try:
104-
w = MainWindow(silence=True if "--silence" in sys.argv else False)
105-
106-
# loading plugins
107-
pluginsPath=os.path.join(cfg.appPath, "plugins")
108-
loadPlugins(w, pluginsPath)
94+
w = MainWindow(silence=True if "--silence" in sys.argv else False)
10995

110-
sys.exit(app.exec())
96+
# loading plugins
97+
pluginsPath=os.path.join(cfg.appPath, "plugins")
98+
loadPlugins(w, pluginsPath)
11199

112-
except KeyboardInterrupt:
113-
print("\n用户中断,正在退出...")
114-
speedLimiter.stop()
115-
app.quit()
116-
sys.exit(0)
100+
sys.exit(app.exec())

0 commit comments

Comments
 (0)