Process events before creating BrowserPage.

This commit is contained in:
Florian Bruhin 2014-09-30 08:07:45 +02:00
parent 85f8366028
commit 2df276085c
2 changed files with 8 additions and 7 deletions

View File

@ -32,8 +32,8 @@ import functools
import traceback
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtCore import (pyqtSlot, QTimer, QEventLoop, Qt, QStandardPaths,
qInstallMessageHandler, QObject, QUrl)
from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, Qt, QUrl,
QStandardPaths, QObject)
import qutebrowser
from qutebrowser.commands import userscripts, runners, cmdutils
@ -236,10 +236,6 @@ class Application(QApplication):
URLs to open have no prefix, commands to execute begin with a colon.
"""
# QNetworkAccessManager::createRequest will hang for over a second, so
# we make sure the GUI is refreshed here, so the start seems faster.
self.processEvents(QEventLoop.ExcludeUserInputEvents |
QEventLoop.ExcludeSocketNotifiers)
tabbed_browser = objreg.get('tabbed-browser')
for cmd in self._args.command:
if cmd.startswith(':'):

View File

@ -21,7 +21,7 @@
import itertools
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer, QUrl
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer, QUrl, QEventLoop
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
@ -100,6 +100,11 @@ class WebView(QWebView):
self.registry = objreg.ObjectRegistry()
self.tab_id = next(tab_id_gen)
objreg.register('webview', self, registry=self.registry)
# QNetworkAccessManager init will hang for over a second, so
# we make sure the GUI is refreshed here, so the start seems faster.
app = objreg.get('app')
app.processEvents(QEventLoop.ExcludeUserInputEvents |
QEventLoop.ExcludeSocketNotifiers)
page = webpage.BrowserPage(self)
self.setPage(page)
hintmanager = hints.HintManager(self)