""" main.py — LabUI entry point. Run: python main.py Requirements: pip install PyQt6 pyqtgraph numpy pyserial """ 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") qss = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ui", "style_dark.qss") if os.path.exists(qss): with open(qss) as f: app.setStyleSheet(f.read()) win = MainWindow() win.show() sys.exit(app.exec()) if __name__ == "__main__": main()