Fix checks

This commit is contained in:
Florian Bruhin 2014-05-04 01:33:01 +02:00
parent ec6066c7ba
commit 4ff5431436
3 changed files with 15 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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