Stop PyQt from using cached JS files.

master
Pacman Ghost 6 years ago
parent 7150529ec0
commit 59b5f8088b
  1. 12
      vasl_templates/main_window.py

@ -1,7 +1,7 @@
""" Main application window. """ """ Main application window. """
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel
from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineProfile, QWebEnginePage
from PyQt5.QtGui import QDesktopServices from PyQt5.QtGui import QDesktopServices
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl
@ -28,9 +28,13 @@ class MainWindow( QWidget ):
layout = QVBoxLayout( self ) layout = QVBoxLayout( self )
if not webapp.config.get( "DISABLE_WEBENGINEVIEW" ): if not webapp.config.get( "DISABLE_WEBENGINEVIEW" ):
# load the webapp # load the webapp
browser = QWebEngineView() # NOTE: We create an off-the-record profile to stop the view from using cached JS files :-/
layout.addWidget( browser ) view = QWebEngineView()
browser.setUrl( QUrl(url) ) layout.addWidget( view )
profile = QWebEngineProfile( None, view )
page = QWebEnginePage( profile, view )
view.setPage( page )
view.load( QUrl(url) )
else: else:
label = QLabel() label = QLabel()
label.setText( "Running the {} application.\n\nClose this window when you're done.".format( APP_NAME ) ) label.setText( "Running the {} application.\n\nClose this window when you're done.".format( APP_NAME ) )

Loading…
Cancel
Save