Leave hint mode when page loading started.

This commit is contained in:
Florian Bruhin 2014-05-13 11:17:36 +02:00
parent abe183f024
commit c52caa1427

View File

@ -91,8 +91,7 @@ class WebView(QWebView):
self.page_.linkHovered.connect(self.linkHovered)
self.page_.networkAccessManager().sslErrors.connect(self.ssl_errors)
self.linkClicked.connect(self.on_link_clicked)
self.page_.mainFrame().loadStarted.connect(
lambda: modeman.maybe_leave('insert', 'load started'))
self.page_.mainFrame().loadStarted.connect(self.on_load_started)
self.loadFinished.connect(self.on_load_finished)
# FIXME find some way to hide scrollbars without setScrollBarPolicy
@ -279,6 +278,12 @@ class WebView(QWebView):
self.setFocus()
QApplication.postEvent(self, evt)
@pyqtSlot()
def on_load_started(self):
"""Leave insert/hint mode when a new page is loading."""
for mode in ['insert', 'hint']:
modeman.maybe_leave(mode, 'load started')
@pyqtSlot(bool)
def on_load_finished(self, ok):
"""Handle auto-insert-mode after loading finished."""