Fix checks
This commit is contained in:
parent
ec6066c7ba
commit
4ff5431436
@ -24,6 +24,8 @@ Module attributes:
|
||||
settings: The global QWebSettings singleton instance.
|
||||
"""
|
||||
|
||||
# pylint: disable=unnecessary-lambda
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot
|
||||
from PyQt5.QtWebKit import QWebSettings
|
||||
|
||||
@ -98,6 +100,7 @@ STATIC_SETTERS = {
|
||||
lambda v: QWebSettings.setOfflineWebApplicationCacheQuota(v),
|
||||
}
|
||||
|
||||
|
||||
settings = None
|
||||
|
||||
|
||||
@ -126,7 +129,6 @@ def init(cachedir):
|
||||
def on_config_changed(section, option):
|
||||
"""Update global settings when qwebsettings changed."""
|
||||
if section == 'webkit':
|
||||
settings = QWebSettings.globalSettings()
|
||||
value = config.get(section, option)
|
||||
if option in ATTRIBUTES:
|
||||
settings.setAttribute(ATTRIBUTES[option], value)
|
||||
|
@ -134,7 +134,6 @@ def fuzzy_url(url):
|
||||
Return:
|
||||
A target QUrl to a searchpage or the original URL.
|
||||
"""
|
||||
u = qurl(url)
|
||||
urlstr = urlstring(url)
|
||||
if is_url(urlstr):
|
||||
# probably an address
|
||||
|
@ -326,18 +326,23 @@ class TabbedBrowser(TabWidget):
|
||||
self.paste(sel, True)
|
||||
|
||||
@cmdutils.register(instance='mainwindow.tabs')
|
||||
def focus_tab(self, arg=None, count=None):
|
||||
if ((arg is None and count is None) or
|
||||
(arg is not None and count is not None)):
|
||||
def focus_tab(self, idx=None, count=None):
|
||||
"""Focus the tab given as argument or in count.
|
||||
|
||||
Args:
|
||||
idx: The tab index to focus, starting with 1.
|
||||
"""
|
||||
if ((idx is None and count is None) or
|
||||
(idx is not None and count is not None)):
|
||||
message.error("Either argument or count must be given!")
|
||||
return
|
||||
try:
|
||||
idx = int(arg) if arg is not None else count
|
||||
i = int(idx) if idx is not None else count
|
||||
except ValueError:
|
||||
message.error("Invalid argument: {}".format(arg))
|
||||
message.error("Invalid argument: {}".format(idx))
|
||||
return
|
||||
if 1 <= idx <= self.count():
|
||||
self.setCurrentIndex(idx - 1)
|
||||
if 1 <= i <= self.count():
|
||||
self.setCurrentIndex(i - 1)
|
||||
else:
|
||||
message.error("Index out of bounds!")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user