1

我正在使用 QWebViewEngine 从 socketio-flask 应用程序加载 url。这是我使用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'))

但是,在运行 PyQT 应用程序一段时间后或将计算机待机并再次打开计算机后,QWebViewEngine 无法显示网页。 在此处输入图像描述

Python 控制台显示如下:

[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
4

0 回答 0