Remove value from on_config_changed signal again.

Turns out this causes more trouble than it's worth, and it's unintuitive
from which layer we get the value.
This commit is contained in:
Florian Bruhin 2014-04-17 11:39:25 +02:00
parent 7c64e8846a
commit 72340575af
9 changed files with 27 additions and 25 deletions

View File

@ -230,8 +230,9 @@ class KeyParser(QObject):
self.set_cmd_text.emit(':{} '.format(cmdstr))
return
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
# pylint: disable=unused-argument
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
if section == 'keybind':
self.read_config()

View File

@ -94,7 +94,7 @@ class Config(QObject):
Args: the changed section and option.
"""
changed = pyqtSignal(str, str, object)
changed = pyqtSignal(str, str)
style_changed = pyqtSignal(str, str)
def __init__(self, configdir, fname, parent=None):
@ -327,7 +327,7 @@ class Config(QObject):
else:
if section in ['colors', 'fonts']:
self.style_changed.emit(section, option)
self.changed.emit(section, option, self.get(section, option))
self.changed.emit(section, option)
@cmdutils.register(instance='config')
def save(self):

View File

@ -20,6 +20,7 @@
import os
import os.path
import logging
from PyQt5.QtCore import pyqtSlot
@ -73,7 +74,7 @@ class LineConfigParser:
if not self.data:
logging.debug("No data to save.")
return
import qutebrowser.config.config as config
import qutebrowser.config.config as config # FIXME
limit = -1 if self._limit is None else config.config.get(*self._limit)
if limit == 0:
return
@ -83,11 +84,13 @@ class LineConfigParser:
with open(self._configfile, 'w') as f:
self.write(f, limit)
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Delete the file if the limit was changed to 0."""
if self._limit is None:
return
import qutebrowser.config.config as config # FIXME
value = config.config.get(section, option)
if (section, option) == self._limit and value == 0:
if os.path.exists(self._configfile):
os.remove(self._configfile)

View File

@ -68,8 +68,9 @@ def init():
settings.setAttribute(item, config.config.get('webkit', name))
@pyqtSlot(str, str, object)
def on_config_changed(section, option, value):
@pyqtSlot(str, str)
def on_config_changed(section, option):
"""Update global settings when qwebsettings changed."""
if section == 'webkit':
value = config.config.get(section, option)
settings.setAttribute(MAPPING[option], value)

View File

@ -176,9 +176,8 @@ class BrowserTab(QWebView):
netman.deleteLater()
logging.debug("Tab shutdown scheduled")
# pylint: disable=unused-argument
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update tab config when config was changed."""
if section == 'general' and option in ['zoomlevels', 'defaultzoom']:
self._init_neighborlist()

View File

@ -211,11 +211,11 @@ class CompletionView(QTreeView):
self.expandAll()
self.resizeColumnToContents(0)
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update self._enabled when the config changed."""
if section == 'general' and option == 'show_completion':
self._enabled = value
self._enabled = config.config.get('general', 'show_completion')
@pyqtSlot(str)
def on_cmd_text_changed(self, text):

View File

@ -106,9 +106,8 @@ class MainWindow(QWidget):
#self.tabWidget.setCurrentIndex(0)
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
# pylint: disable=unused-argument
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Resize completion if config changed."""
if section == 'general' and option == 'completion_height':
self.resize_completion()

View File

@ -141,12 +141,12 @@ class TabbedBrowser(TabWidget):
else:
return None
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update tab config when config was changed."""
super().on_config_changed(section, option, value)
super().on_config_changed(section, option)
for tab in self._tabs:
tab.on_config_changed(section, option, value)
tab.on_config_changed(section, option)
def _titleChanged_handler(self, text):
"""Set the title of a tab.

View File

@ -99,9 +99,8 @@ class TabWidget(QTabWidget):
except KeyError:
pass
# pylint: disable=unused-argument
@pyqtSlot(str, str, object)
def on_config_changed(self, section, option, value):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update attributes when config changed."""
if section == 'tabbar':
self._init_config()