|
|
@@ -163,6 +163,16 @@ class MainWindow(QMainWindow, Ui_menu):
|
|
|
# 检查 Redis 是否安装
|
|
|
self.check_redis_installation()
|
|
|
|
|
|
+ def closeEvent(self, event):
|
|
|
+ """重写 closeEvent 方法,在窗口关闭时终止程序"""
|
|
|
+ reply = QMessageBox.question(self, '退出', "确定要退出吗?",
|
|
|
+ QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
|
|
|
+ if reply == QMessageBox.Yes:
|
|
|
+ event.accept() # 接受关闭事件
|
|
|
+ QApplication.quit() # 退出应用程序
|
|
|
+ else:
|
|
|
+ event.ignore() # 忽略关闭事件
|
|
|
+
|
|
|
def on_label_click(self, file_path):
|
|
|
if os.path.exists(file_path):
|
|
|
try:
|