Replace page_ by page()
This commit is contained in:
parent
0976f95db7
commit
1ff193e4dd
@ -82,7 +82,7 @@ class CommandDispatcher:
|
|||||||
else:
|
else:
|
||||||
perc = float(perc)
|
perc = float(perc)
|
||||||
perc = check_overflow(perc, 'int', fatal=False)
|
perc = check_overflow(perc, 'int', fatal=False)
|
||||||
frame = self._tabs.currentWidget().page_.currentFrame()
|
frame = self._tabs.currentWidget().page().currentFrame()
|
||||||
m = frame.scrollBarMaximum(orientation)
|
m = frame.scrollBarMaximum(orientation)
|
||||||
if m == 0:
|
if m == 0:
|
||||||
return
|
return
|
||||||
@ -91,7 +91,7 @@ class CommandDispatcher:
|
|||||||
def _prevnext(self, prev, newtab):
|
def _prevnext(self, prev, newtab):
|
||||||
"""Inner logic for {tab,}{prev,next}page."""
|
"""Inner logic for {tab,}{prev,next}page."""
|
||||||
widget = self._tabs.currentWidget()
|
widget = self._tabs.currentWidget()
|
||||||
frame = widget.page_.currentFrame()
|
frame = widget.page().currentFrame()
|
||||||
if frame is None:
|
if frame is None:
|
||||||
raise CommandError("No frame focused!")
|
raise CommandError("No frame focused!")
|
||||||
widget.hintmanager.follow_prevnext(frame, widget.url(), prev, newtab)
|
widget.hintmanager.follow_prevnext(frame, widget.url(), prev, newtab)
|
||||||
@ -247,7 +247,7 @@ class CommandDispatcher:
|
|||||||
targetstr: Where to open the links.
|
targetstr: Where to open the links.
|
||||||
"""
|
"""
|
||||||
widget = self._tabs.currentWidget()
|
widget = self._tabs.currentWidget()
|
||||||
frame = widget.page_.mainFrame()
|
frame = widget.page().mainFrame()
|
||||||
if frame is None:
|
if frame is None:
|
||||||
raise CommandError("No frame focused!")
|
raise CommandError("No frame focused!")
|
||||||
try:
|
try:
|
||||||
@ -298,7 +298,7 @@ class CommandDispatcher:
|
|||||||
dy = int(int(count) * float(dy))
|
dy = int(int(count) * float(dy))
|
||||||
cmdutils.check_overflow(dx, 'int')
|
cmdutils.check_overflow(dx, 'int')
|
||||||
cmdutils.check_overflow(dy, 'int')
|
cmdutils.check_overflow(dy, 'int')
|
||||||
self._tabs.currentWidget().page_.currentFrame().scroll(dx, dy)
|
self._tabs.currentWidget().page().currentFrame().scroll(dx, dy)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
||||||
def scroll_perc_x(self, perc=None, count=None):
|
def scroll_perc_x(self, perc=None, count=None):
|
||||||
@ -329,7 +329,7 @@ class CommandDispatcher:
|
|||||||
my: How many pages to scroll down.
|
my: How many pages to scroll down.
|
||||||
count: multiplier
|
count: multiplier
|
||||||
"""
|
"""
|
||||||
frame = self._tabs.currentWidget().page_.currentFrame()
|
frame = self._tabs.currentWidget().page().currentFrame()
|
||||||
size = frame.geometry()
|
size = frame.geometry()
|
||||||
dx = int(count) * float(mx) * size.width()
|
dx = int(count) * float(mx) * size.width()
|
||||||
dy = int(count) * float(my) * size.height()
|
dy = int(count) * float(my) * size.height()
|
||||||
@ -635,7 +635,7 @@ class CommandDispatcher:
|
|||||||
"the webinspector!")
|
"the webinspector!")
|
||||||
return
|
return
|
||||||
cur.inspector = QWebInspector()
|
cur.inspector = QWebInspector()
|
||||||
cur.inspector.setPage(cur.page_)
|
cur.inspector.setPage(cur.page())
|
||||||
cur.inspector.show()
|
cur.inspector.show()
|
||||||
elif cur.inspector.isVisible():
|
elif cur.inspector.isVisible():
|
||||||
cur.inspector.hide()
|
cur.inspector.hide()
|
||||||
@ -657,7 +657,7 @@ class CommandDispatcher:
|
|||||||
easier to execute some code as soon as the process has been finished
|
easier to execute some code as soon as the process has been finished
|
||||||
and do everything async.
|
and do everything async.
|
||||||
"""
|
"""
|
||||||
frame = self._tabs.currentWidget().page_.currentFrame()
|
frame = self._tabs.currentWidget().page().currentFrame()
|
||||||
elem = frame.findFirstElement(webelem.SELECTORS[
|
elem = frame.findFirstElement(webelem.SELECTORS[
|
||||||
webelem.Group.editable_focused])
|
webelem.Group.editable_focused])
|
||||||
if elem.isNull():
|
if elem.isNull():
|
||||||
|
@ -48,7 +48,6 @@ class WebView(QWebView):
|
|||||||
Our own subclass of a QWebView with some added bells and whistles.
|
Our own subclass of a QWebView with some added bells and whistles.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
page_: The QWebPage behind the view
|
|
||||||
hintmanager: The HintManager instance for this view.
|
hintmanager: The HintManager instance for this view.
|
||||||
tabbedbrowser: The TabbedBrowser this WebView is part of.
|
tabbedbrowser: The TabbedBrowser this WebView is part of.
|
||||||
We need this rather than signals to make createWindow
|
We need this rather than signals to make createWindow
|
||||||
@ -56,6 +55,7 @@ class WebView(QWebView):
|
|||||||
progress: loading progress of this page.
|
progress: loading progress of this page.
|
||||||
scroll_pos: The current scroll position as (x%, y%) tuple.
|
scroll_pos: The current scroll position as (x%, y%) tuple.
|
||||||
inspector: The QWebInspector used for this webview.
|
inspector: The QWebInspector used for this webview.
|
||||||
|
_page: The QWebPage behind the view
|
||||||
_url_text: The current URL as string.
|
_url_text: The current URL as string.
|
||||||
Accessed via url_text property.
|
Accessed via url_text property.
|
||||||
_load_status: loading status of this page (index into LoadStatus)
|
_load_status: loading status of this page (index into LoadStatus)
|
||||||
@ -99,19 +99,19 @@ class WebView(QWebView):
|
|||||||
self._init_neighborlist()
|
self._init_neighborlist()
|
||||||
self._url_text = ''
|
self._url_text = ''
|
||||||
self.progress = 0
|
self.progress = 0
|
||||||
self.page_ = BrowserPage(self)
|
self._page = BrowserPage(self)
|
||||||
self.setPage(self.page_)
|
self.setPage(self._page)
|
||||||
self.hintmanager = HintManager(self)
|
self.hintmanager = HintManager(self)
|
||||||
self.hintmanager.mouse_event.connect(self.on_mouse_event)
|
self.hintmanager.mouse_event.connect(self.on_mouse_event)
|
||||||
self.hintmanager.set_open_target.connect(self.set_force_open_target)
|
self.hintmanager.set_open_target.connect(self.set_force_open_target)
|
||||||
self.page_.setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
|
self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
|
||||||
self.page_.linkHovered.connect(self.linkHovered)
|
self.page().linkHovered.connect(self.linkHovered)
|
||||||
self.linkClicked.connect(self.on_link_clicked)
|
self.linkClicked.connect(self.on_link_clicked)
|
||||||
self.page_.mainFrame().loadStarted.connect(self.on_load_started)
|
self.page().mainFrame().loadStarted.connect(self.on_load_started)
|
||||||
self.urlChanged.connect(self.on_url_changed)
|
self.urlChanged.connect(self.on_url_changed)
|
||||||
self.loadFinished.connect(self.on_load_finished)
|
self.loadFinished.connect(self.on_load_finished)
|
||||||
self.loadProgress.connect(lambda p: setattr(self, 'progress', p))
|
self.loadProgress.connect(lambda p: setattr(self, 'progress', p))
|
||||||
self.page_.networkAccessManager().sslErrors.connect(
|
self.page().networkAccessManager().sslErrors.connect(
|
||||||
lambda *args: setattr(self, '_has_ssl_errors', True))
|
lambda *args: setattr(self, '_has_ssl_errors', True))
|
||||||
# FIXME find some way to hide scrollbars without setScrollBarPolicy
|
# FIXME find some way to hide scrollbars without setScrollBarPolicy
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ class WebView(QWebView):
|
|||||||
e: The QMouseEvent.
|
e: The QMouseEvent.
|
||||||
"""
|
"""
|
||||||
pos = e.pos()
|
pos = e.pos()
|
||||||
frame = self.page_.frameAt(pos)
|
frame = self.page().frameAt(pos)
|
||||||
if frame is None:
|
if frame is None:
|
||||||
# This happens when we click inside the webview, but not actually
|
# This happens when we click inside the webview, but not actually
|
||||||
# on the QWebPage - for example when clicking the scrollbar
|
# on the QWebPage - for example when clicking the scrollbar
|
||||||
@ -330,14 +330,14 @@ class WebView(QWebView):
|
|||||||
|
|
||||||
def go_back(self):
|
def go_back(self):
|
||||||
"""Go back a page in the history."""
|
"""Go back a page in the history."""
|
||||||
if self.page_.history().canGoBack():
|
if self.page().history().canGoBack():
|
||||||
self.back()
|
self.back()
|
||||||
else:
|
else:
|
||||||
raise CommandError("At beginning of history.")
|
raise CommandError("At beginning of history.")
|
||||||
|
|
||||||
def go_forward(self):
|
def go_forward(self):
|
||||||
"""Go forward a page in the history."""
|
"""Go forward a page in the history."""
|
||||||
if self.page_.history().canGoForward():
|
if self.page().history().canGoForward():
|
||||||
self.forward()
|
self.forward()
|
||||||
else:
|
else:
|
||||||
raise CommandError("At end of history.")
|
raise CommandError("At end of history.")
|
||||||
@ -362,10 +362,10 @@ class WebView(QWebView):
|
|||||||
self.close()
|
self.close()
|
||||||
self.settings().setAttribute(QWebSettings.JavascriptEnabled, False)
|
self.settings().setAttribute(QWebSettings.JavascriptEnabled, False)
|
||||||
|
|
||||||
self._destroyed[self.page_] = False
|
self._destroyed[self.page()] = False
|
||||||
self.page_.destroyed.connect(functools.partial(self._on_destroyed,
|
self.page().destroyed.connect(functools.partial(self._on_destroyed,
|
||||||
self.page_))
|
self.page()))
|
||||||
self.page_.deleteLater()
|
self.page().deleteLater()
|
||||||
|
|
||||||
self._destroyed[self] = False
|
self._destroyed[self] = False
|
||||||
self.destroyed.connect(functools.partial(self._on_destroyed, self))
|
self.destroyed.connect(functools.partial(self._on_destroyed, self))
|
||||||
@ -428,7 +428,7 @@ class WebView(QWebView):
|
|||||||
return
|
return
|
||||||
if modeman.instance().mode == 'insert' or not ok:
|
if modeman.instance().mode == 'insert' or not ok:
|
||||||
return
|
return
|
||||||
frame = self.page_.currentFrame()
|
frame = self.page().currentFrame()
|
||||||
elem = frame.findFirstElement(
|
elem = frame.findFirstElement(
|
||||||
webelem.SELECTORS[webelem.Group.editable_focused])
|
webelem.SELECTORS[webelem.Group.editable_focused])
|
||||||
log.modes.debug("focus element: {}".format(not elem.isNull()))
|
log.modes.debug("focus element: {}".format(not elem.isNull()))
|
||||||
@ -491,7 +491,7 @@ class WebView(QWebView):
|
|||||||
Return:
|
Return:
|
||||||
The superclass event return value.
|
The superclass event return value.
|
||||||
"""
|
"""
|
||||||
frame = self.page_.mainFrame()
|
frame = self.page().mainFrame()
|
||||||
new_pos = (frame.scrollBarValue(Qt.Horizontal),
|
new_pos = (frame.scrollBarValue(Qt.Horizontal),
|
||||||
frame.scrollBarValue(Qt.Vertical))
|
frame.scrollBarValue(Qt.Vertical))
|
||||||
if self._old_scroll_pos != new_pos:
|
if self._old_scroll_pos != new_pos:
|
||||||
|
Loading…
Reference in New Issue
Block a user