diff options
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -12,10 +12,30 @@ import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from PyQt6.QtWidgets import QApplication +from PyQt6.QtCore import qInstallMessageHandler, QtMsgType from ui.main_window import MainWindow +def _qt_message_handler(msg_type, context, message): + """Silence one specific, harmless Qt warning: the native windowsvista + style's combo-box/menu popup code calls QFont::setPointSize() on a + pixel-sized font (our QSS uses px font-size, so pointSize() is -1 by + design) — cosmetic console noise only, doesn't affect rendering. + Everything else still prints normally.""" + if "QFont::setPointSize" in message: + return + if msg_type == QtMsgType.QtWarningMsg: + print(f"Warning: {message}", file=sys.stderr) + elif msg_type == QtMsgType.QtCriticalMsg: + print(f"Critical: {message}", file=sys.stderr) + elif msg_type == QtMsgType.QtFatalMsg: + print(f"Fatal: {message}", file=sys.stderr) + else: + print(message, file=sys.stderr) + + def main(): + qInstallMessageHandler(_qt_message_handler) app = QApplication(sys.argv) app.setApplicationName("LabUI") |
