from PySide6.QtWidgets import * from PySide6.QtCore import * from PySide6.QtGui import * from PySide6.QtWidgets import * from PySide6.QtCore import * from PySide6.QtMultimedia import * import settings import os import threading import concurrent.futures from functools import partial # 统一封装 class MineQWidget(QWidget): def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowStaysOnTopHint) def checkLogin(self): """检查是否登录""" if not settings.IsLogin: # self.PlayErrorAudio() QMessageBox.critical(self, "警告", "请先登录账号", QMessageBox.Ok) return False return True def WaringMessage(self, message): """警告弹窗""" # self.PlayErrorAudio() return QMessageBox.critical(self, "警告", message, QMessageBox.Ok) def PlayErrorAudio(self): current_path = os.getcwd() effect = QSoundEffect(self) # print("current_path", current_path) effect.setSource( QUrl.fromLocalFile(r"{}\resources\ttl\error_audio.wav".format(current_path)) ) effect.setVolume(1) effect.setLoopCount(1) effect.play() return def comfirmMessage(self, message): questResult = QMessageBox.question( self, "确认", message, QMessageBox.Yes | QMessageBox.No ) return questResult