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. settings: The global QWebSettings singleton instance.
""" """
# pylint: disable=unnecessary-lambda
from PyQt5.QtCore import pyqtSlot from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
@ -98,6 +100,7 @@ STATIC_SETTERS = {
lambda v: QWebSettings.setOfflineWebApplicationCacheQuota(v), lambda v: QWebSettings.setOfflineWebApplicationCacheQuota(v),
} }
settings = None settings = None
@ -126,7 +129,6 @@ def init(cachedir):
def on_config_changed(section, option): def on_config_changed(section, option):
"""Update global settings when qwebsettings changed.""" """Update global settings when qwebsettings changed."""
if section == 'webkit': if section == 'webkit':
settings = QWebSettings.globalSettings()
value = config.get(section, option) value = config.get(section, option)
if option in ATTRIBUTES: if option in ATTRIBUTES:
settings.setAttribute(ATTRIBUTES[option], value) settings.setAttribute(ATTRIBUTES[option], value)

View File

@ -134,7 +134,6 @@ def fuzzy_url(url):
Return: Return:
A target QUrl to a searchpage or the original URL. A target QUrl to a searchpage or the original URL.
""" """
u = qurl(url)
urlstr = urlstring(url) urlstr = urlstring(url)
if is_url(urlstr): if is_url(urlstr):
# probably an address # probably an address

View File

@ -326,18 +326,23 @@ class TabbedBrowser(TabWidget):
self.paste(sel, True) self.paste(sel, True)
@cmdutils.register(instance='mainwindow.tabs') @cmdutils.register(instance='mainwindow.tabs')
def focus_tab(self, arg=None, count=None): def focus_tab(self, idx=None, count=None):
if ((arg is None and count is None) or """Focus the tab given as argument or in count.
(arg is not None and count is not None)):
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!") message.error("Either argument or count must be given!")
return return
try: try:
idx = int(arg) if arg is not None else count i = int(idx) if idx is not None else count
except ValueError: except ValueError:
message.error("Invalid argument: {}".format(arg)) message.error("Invalid argument: {}".format(idx))
return return
if 1 <= idx <= self.count(): if 1 <= i <= self.count():
self.setCurrentIndex(idx - 1) self.setCurrentIndex(i - 1)
else: else:
message.error("Index out of bounds!") message.error("Index out of bounds!")
return return