73 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from PySide6.QtWidgets import QMessageBox
 | 
						|
from .theme import theme_manager, set_dark_title_bar
 | 
						|
 | 
						|
def show_themed_messagebox(parent, icon, title, text, buttons=QMessageBox.Ok):
 | 
						|
    msg = QMessageBox(parent)
 | 
						|
    msg.setIcon(icon)
 | 
						|
    msg.setWindowTitle(title)
 | 
						|
    msg.setText(text)
 | 
						|
    msg.setStandardButtons(buttons)
 | 
						|
 | 
						|
    if theme_manager.is_dark():
 | 
						|
        msg.setStyleSheet("""
 | 
						|
            QMessageBox {
 | 
						|
                background-color: #2e2e2e;
 | 
						|
                color: white;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
            }
 | 
						|
            QMessageBox QLabel {
 | 
						|
                color: white;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
            }
 | 
						|
            QMessageBox QPushButton {
 | 
						|
                background-color: #444;
 | 
						|
                color: white;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
                border-radius: 6px;
 | 
						|
                padding: 6px 12px;
 | 
						|
            }
 | 
						|
            QMessageBox QPushButton:hover {
 | 
						|
                background-color: #666;
 | 
						|
            }
 | 
						|
        """)
 | 
						|
    else:
 | 
						|
        msg.setStyleSheet("""
 | 
						|
            QMessageBox {
 | 
						|
                background-color: white;
 | 
						|
                color: black;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
            }
 | 
						|
            QMessageBox QLabel {
 | 
						|
                color: black;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
                background: transparent;
 | 
						|
            }
 | 
						|
            QMessageBox QPushButton {
 | 
						|
                background-color: #e0e0e0;
 | 
						|
                color: black;
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
                border-radius: 6px;
 | 
						|
                padding: 6px 12px;
 | 
						|
            }
 | 
						|
            QMessageBox QPushButton:focus,
 | 
						|
            QMessageBox QPushButton:pressed {
 | 
						|
                border: none;
 | 
						|
                outline: none;
 | 
						|
            }
 | 
						|
            QMessageBox QPushButton:hover {
 | 
						|
                background-color: #d0d0d0;
 | 
						|
            }
 | 
						|
        """)
 | 
						|
 | 
						|
 | 
						|
    hwnd = int(msg.winId())
 | 
						|
    set_dark_title_bar(hwnd, theme_manager.is_dark())
 | 
						|
 | 
						|
    return msg.exec()
 |