Mycar_Browser/main.py

30 lines
1.1 KiB
Python

import sys
import os
from PySide6.QtWidgets import QApplication
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWebEngineCore import QWebEngineProfile, QWebEngineSettings
from modules.ui.main_window import MainWindow
def main():
# GPU 가속 비활성화 환경 변수 설정
os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--disable-gpu --no-sandbox --disable-extensions --disable-background-networking --disable-sync --disable-translate --enable-features=NetworkService,NetworkServiceInProcess"
app = QApplication(sys.argv)
# Qt WebEngine 초기화
QWebEngineView()
# 소프트웨어 렌더링 설정
profile = QWebEngineProfile.defaultProfile()
settings = profile.settings()
settings.setAttribute(QWebEngineSettings.Accelerated2dCanvasEnabled, False)
settings.setAttribute(QWebEngineSettings.WebGLEnabled, False)
settings.setAttribute(QWebEngineSettings.JavascriptEnabled, True)
settings.setAttribute(QWebEngineSettings.JavascriptCanOpenWindows, True)
window = MainWindow()
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()