I am using QWebViewEngine to load url from socketio-flask app. Here is my code using python:
class WebEnginePage(QWebEnginePage):
def acceptNavigationRequest(self, url, _type, isMainFrame):
if _type == QWebEnginePage.NavigationTypeLinkClicked and not (url.host() in ['localhost','127.0.0.1'] and url.port()=='8000'):
QDesktopServices.openUrl(url);
return False
return True
class MainWindow(QWebEngineView):
#finished = pyqtSignal()
opts=None
def __init__(self, *args, **kwargs):
self.opts = kwargs
super(MainWindow, self).__init__(*args)
self.setPage(WebEnginePage(self))
self.initUI()
def initUI(self):
self.setWindowTitle("Auto Social Media")
self.setWindowIcon(QIcon(cfg.rootdir() + '/static/icon.png'))
self.resize(1200, 800)
self.setZoomFactor(1.2)
self.setMinimumSize(QSize(500, 400))
self.setContextMenuPolicy(Qt.NoContextMenu)
self.load(QUrl('http://localhost:8000'))
However, after running the PyQT application for a while or standby the computer and open the computer again, QWebViewEngine cannot display the web page.
Python console show as bellow:
[8540:4860:0814/133527.432:ERROR:shared_image_manager.cc(141)] SharedImageManager::ProduceGLTexture: Trying to produce a representation from a non-existent mailbox. 76:8F:E2:22:FB:1A:50:08:69:27:CC:7F:79:02:07:7D
[8540:4860:0814/133527.432:ERROR:gles2_cmd_decoder.cc(18938)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoCreateAndTexStorage2DSharedImageINTERNAL: invalid mailbox name
[8540:4860:0814/133527.432:ERROR:gles2_cmd_decoder.cc(18959)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
[8540:4860:0814/133527.432:ERROR:gles2_cmd_decoder.cc(10716)] [.DisplayCompositor]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incompatible texture filtering (maybe)?
[8540:4860:0814/133527.432:ERROR:gles2_cmd_decoder.cc(18988)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image