Rename openurl to load_url
We still call the :open command openurl, but in the tab API and in TabbedBrowser it's now called load_url.
This commit is contained in:
parent
5bf0dffa95
commit
f6c36ccbee
@ -1049,7 +1049,7 @@ class AbstractTab(QWidget):
|
||||
if predict:
|
||||
self.predicted_navigation.emit(url)
|
||||
|
||||
def openurl(self, url: QUrl, *, predict: bool = True) -> None:
|
||||
def load_url(self, url: QUrl, *, predict: bool = True) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
def reload(self, *, force: bool = False) -> None:
|
||||
|
@ -138,7 +138,7 @@ class CommandDispatcher:
|
||||
tabbed_browser.tabopen(url, background=True, related=related)
|
||||
else:
|
||||
widget = self._current_widget()
|
||||
widget.openurl(url)
|
||||
widget.load_url(url)
|
||||
|
||||
def _cntwidget(self, count=None):
|
||||
"""Return a widget based on a count/idx.
|
||||
@ -321,7 +321,7 @@ class CommandDispatcher:
|
||||
elif curtab.data.pinned:
|
||||
message.info("Tab is pinned!")
|
||||
else:
|
||||
curtab.openurl(cur_url)
|
||||
curtab.load_url(cur_url)
|
||||
|
||||
def _parse_url(self, url, *, force_search=False):
|
||||
"""Parse a URL or quickmark or search query.
|
||||
@ -1247,7 +1247,7 @@ class CommandDispatcher:
|
||||
if output:
|
||||
tb = objreg.get('tabbed-browser', scope='window',
|
||||
window='last-focused')
|
||||
tb.openurl(QUrl('qute://spawn-output'), newtab=True)
|
||||
tb.load_url(QUrl('qute://spawn-output'), newtab=True)
|
||||
|
||||
if userscript:
|
||||
def _selection_callback(s):
|
||||
|
@ -141,7 +141,7 @@ def prevnext(*, browsertab, win_id, baseurl, prev=False,
|
||||
elif tab:
|
||||
cur_tabbed_browser.tabopen(url, background=background)
|
||||
else:
|
||||
browsertab.openurl(url)
|
||||
browsertab.load_url(url)
|
||||
|
||||
try:
|
||||
link_selector = webelem.css_selector('links', baseurl)
|
||||
|
@ -478,7 +478,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
||||
def to_anchor(self, name):
|
||||
url = self._tab.url()
|
||||
url.setFragment(name)
|
||||
self._tab.openurl(url)
|
||||
self._tab.load_url(url)
|
||||
|
||||
def delta(self, x=0, y=0):
|
||||
self._tab.run_js_async(javascript.assemble('window', 'scrollBy', x, y))
|
||||
@ -1134,11 +1134,11 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
self.zoom.set_factor(self._saved_zoom)
|
||||
self._saved_zoom = None
|
||||
|
||||
def openurl(self, url, *, predict=True):
|
||||
"""Open the given URL in this tab.
|
||||
def load_url(self, url, *, predict=True):
|
||||
"""Load the given URL in this tab.
|
||||
|
||||
Arguments:
|
||||
url: The QUrl to open.
|
||||
url: The QUrl to load.
|
||||
predict: If set to False, predicted_navigation is not emitted.
|
||||
"""
|
||||
if sip.isdeleted(self._widget):
|
||||
|
@ -391,7 +391,7 @@ class WebKitCaret(browsertab.AbstractCaret):
|
||||
if tab:
|
||||
self._tab.new_tab_requested.emit(url)
|
||||
else:
|
||||
self._tab.openurl(url)
|
||||
self._tab.load_url(url)
|
||||
|
||||
def follow_selected(self, *, tab=False):
|
||||
try:
|
||||
@ -722,9 +722,9 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
settings = widget.settings()
|
||||
settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True)
|
||||
|
||||
def openurl(self, url, *, predict=True):
|
||||
def load_url(self, url, *, predict=True):
|
||||
self._openurl_prepare(url, predict=predict)
|
||||
self._widget.openurl(url)
|
||||
self._widget.load(url)
|
||||
|
||||
def url(self, requested=False):
|
||||
frame = self._widget.page().mainFrame()
|
||||
@ -829,7 +829,7 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
if (navigation.navigation_type == navigation.Type.link_clicked and
|
||||
target != usertypes.ClickTarget.normal):
|
||||
tab = shared.get_tab(self.win_id, target)
|
||||
tab.openurl(navigation.url)
|
||||
tab.load_url(navigation.url)
|
||||
self.data.open_target = usertypes.ClickTarget.normal
|
||||
navigation.accepted = False
|
||||
|
||||
|
@ -118,14 +118,6 @@ class WebView(QWebView):
|
||||
self.stop()
|
||||
self.page().shutdown()
|
||||
|
||||
def openurl(self, url):
|
||||
"""Open a URL in the browser.
|
||||
|
||||
Args:
|
||||
url: The URL to load as QUrl
|
||||
"""
|
||||
self.load(url)
|
||||
|
||||
def createWindow(self, wintype):
|
||||
"""Called by Qt when a page wants to create a new window.
|
||||
|
||||
|
@ -101,7 +101,7 @@ class ConfigCommands:
|
||||
if option is None:
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window=win_id)
|
||||
tabbed_browser.openurl(QUrl('qute://settings'), newtab=False)
|
||||
tabbed_browser.load_url(QUrl('qute://settings'), newtab=False)
|
||||
return
|
||||
|
||||
if option.endswith('!'):
|
||||
@ -147,7 +147,7 @@ class ConfigCommands:
|
||||
if key is None:
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window=win_id)
|
||||
tabbed_browser.openurl(QUrl('qute://bindings'), newtab=True)
|
||||
tabbed_browser.load_url(QUrl('qute://bindings'), newtab=True)
|
||||
return
|
||||
|
||||
seq = self._parse_key(key)
|
||||
|
@ -303,12 +303,12 @@ class TabbedBrowser(QWidget):
|
||||
if last_close == 'close':
|
||||
self.close_window.emit()
|
||||
elif last_close == 'blank':
|
||||
self.openurl(QUrl('about:blank'), newtab=True)
|
||||
self.load_url(QUrl('about:blank'), newtab=True)
|
||||
elif last_close == 'startpage':
|
||||
for url in config.val.url.start_pages:
|
||||
self.openurl(url, newtab=True)
|
||||
self.load_url(url, newtab=True)
|
||||
elif last_close == 'default-page':
|
||||
self.openurl(config.val.url.default_page, newtab=True)
|
||||
self.load_url(config.val.url.default_page, newtab=True)
|
||||
|
||||
def _remove_tab(self, tab, *, add_undo=True, new_undo=True, crashed=False):
|
||||
"""Remove a tab from the tab list and delete it properly.
|
||||
@ -395,7 +395,7 @@ class TabbedBrowser(QWidget):
|
||||
self.widget.set_tab_pinned(newtab, entry.pinned)
|
||||
|
||||
@pyqtSlot('QUrl', bool)
|
||||
def openurl(self, url, newtab):
|
||||
def load_url(self, url, newtab):
|
||||
"""Open a URL, used as a slot.
|
||||
|
||||
Args:
|
||||
@ -406,7 +406,7 @@ class TabbedBrowser(QWidget):
|
||||
if newtab or self.widget.currentWidget() is None:
|
||||
self.tabopen(url, background=False)
|
||||
else:
|
||||
self.widget.currentWidget().openurl(url)
|
||||
self.widget.currentWidget().load_url(url)
|
||||
|
||||
@pyqtSlot(int)
|
||||
def on_tab_close_requested(self, idx):
|
||||
@ -483,7 +483,7 @@ class TabbedBrowser(QWidget):
|
||||
self.widget.insertTab(idx, tab, "")
|
||||
|
||||
if url is not None:
|
||||
tab.openurl(url)
|
||||
tab.load_url(url)
|
||||
|
||||
if background is None:
|
||||
background = config.val.tabs.background
|
||||
@ -879,7 +879,7 @@ class TabbedBrowser(QWidget):
|
||||
self.cur_load_finished.disconnect(callback)
|
||||
tab.scroller.to_point(point)
|
||||
|
||||
self.openurl(url, newtab=False)
|
||||
self.load_url(url, newtab=False)
|
||||
self.cur_load_finished.connect(callback)
|
||||
else:
|
||||
message.error("Mark {} is not set".format(key))
|
||||
|
@ -271,7 +271,7 @@ def debug_pyeval(s, file=False, quiet=False):
|
||||
else:
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window='last-focused')
|
||||
tabbed_browser.openurl(QUrl('qute://pyeval'), newtab=True)
|
||||
tabbed_browser.load_url(QUrl('qute://pyeval'), newtab=True)
|
||||
|
||||
|
||||
@cmdutils.register(debug=True)
|
||||
@ -386,7 +386,7 @@ def version(win_id, paste=False):
|
||||
"""
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window=win_id)
|
||||
tabbed_browser.openurl(QUrl('qute://version'), newtab=True)
|
||||
tabbed_browser.load_url(QUrl('qute://version'), newtab=True)
|
||||
|
||||
if paste:
|
||||
pastebin_version()
|
||||
|
@ -492,7 +492,7 @@ class TabbedBrowserStub(QObject):
|
||||
super().__init__(parent)
|
||||
self.widget = TabWidgetStub()
|
||||
self.shutting_down = False
|
||||
self.opened_url = None
|
||||
self.loaded_url = None
|
||||
self.cur_url = None
|
||||
|
||||
def on_tab_close_requested(self, idx):
|
||||
@ -502,10 +502,10 @@ class TabbedBrowserStub(QObject):
|
||||
return self.widget.tabs
|
||||
|
||||
def tabopen(self, url):
|
||||
self.opened_url = url
|
||||
self.loaded_url = url
|
||||
|
||||
def openurl(self, url, *, newtab):
|
||||
self.opened_url = url
|
||||
def load_url(self, url, *, newtab):
|
||||
self.loaded_url = url
|
||||
|
||||
def current_url(self):
|
||||
if self.current_url is None:
|
||||
|
@ -30,7 +30,7 @@ from qutebrowser.utils import usertypes, qtutils
|
||||
@pytest.fixture
|
||||
def caret(web_tab, qtbot, mode_manager):
|
||||
with qtbot.wait_signal(web_tab.load_finished):
|
||||
web_tab.openurl(QUrl('qute://testdata/data/caret.html'))
|
||||
web_tab.load_url(QUrl('qute://testdata/data/caret.html'))
|
||||
|
||||
mode_manager.enter(usertypes.KeyMode.caret)
|
||||
|
||||
|
@ -56,7 +56,7 @@ def test_show_benchmark(benchmark, tabbed_browser, qtbot, message_bridge,
|
||||
tab = tabbed_browser.widget.tabs[0]
|
||||
|
||||
with qtbot.wait_signal(tab.load_finished):
|
||||
tab.openurl(QUrl('qute://testdata/data/hints/benchmark.html'))
|
||||
tab.load_url(QUrl('qute://testdata/data/hints/benchmark.html'))
|
||||
|
||||
manager = qutebrowser.browser.hints.HintManager(0, 0)
|
||||
|
||||
@ -76,7 +76,7 @@ def test_match_benchmark(benchmark, tabbed_browser, qtbot, message_bridge,
|
||||
tab = tabbed_browser.widget.tabs[0]
|
||||
|
||||
with qtbot.wait_signal(tab.load_finished):
|
||||
tab.openurl(QUrl('qute://testdata/data/hints/benchmark.html'))
|
||||
tab.load_url(QUrl('qute://testdata/data/hints/benchmark.html'))
|
||||
|
||||
manager = qutebrowser.browser.hints.HintManager(0, 0)
|
||||
|
||||
|
@ -60,7 +60,7 @@ class TestArgumentParser:
|
||||
parser.parse_args(['--help'])
|
||||
|
||||
expected_url = QUrl('qute://help/commands.html#foo')
|
||||
assert tabbed_browser_stubs[1].opened_url == expected_url
|
||||
assert tabbed_browser_stubs[1].loaded_url == expected_url
|
||||
|
||||
|
||||
@pytest.mark.parametrize('types, value, expected', [
|
||||
|
@ -59,7 +59,7 @@ class TestSet:
|
||||
|
||||
Should open qute://settings."""
|
||||
commands.set(win_id=0)
|
||||
assert tabbed_browser_stubs[0].opened_url == QUrl('qute://settings')
|
||||
assert tabbed_browser_stubs[0].loaded_url == QUrl('qute://settings')
|
||||
|
||||
@pytest.mark.parametrize('option', ['url.auto_search?', 'url.auto_search'])
|
||||
def test_get(self, config_stub, commands, message_mock, option):
|
||||
@ -620,7 +620,7 @@ class TestBind:
|
||||
config_stub.val.bindings.default = no_bindings
|
||||
config_stub.val.bindings.commands = no_bindings
|
||||
commands.bind(win_id=0)
|
||||
assert tabbed_browser_stubs[0].opened_url == QUrl('qute://bindings')
|
||||
assert tabbed_browser_stubs[0].loaded_url == QUrl('qute://bindings')
|
||||
|
||||
@pytest.mark.parametrize('command', ['nop', 'nope'])
|
||||
def test_bind(self, commands, config_stub, no_bindings, key_config_stub,
|
||||
|
@ -86,7 +86,7 @@ class JSTester:
|
||||
"""
|
||||
with self.qtbot.waitSignal(self.tab.load_finished,
|
||||
timeout=2000) as blocker:
|
||||
self.tab.openurl(url)
|
||||
self.tab.load_url(url)
|
||||
if not force:
|
||||
assert blocker.args == [True]
|
||||
|
||||
|
@ -155,4 +155,4 @@ def tabbed_browser(stubs, win_registry):
|
||||
|
||||
def test_version(tabbed_browser, qapp):
|
||||
utilcmds.version(win_id=0)
|
||||
assert tabbed_browser.opened_url == QUrl('qute://version')
|
||||
assert tabbed_browser.loaded_url == QUrl('qute://version')
|
||||
|
Loading…
Reference in New Issue
Block a user