Add value to config.changed signal
This commit is contained in:
parent
a410d56a78
commit
4ca8cc9537
@ -88,12 +88,12 @@ class Config(QObject):
|
||||
|
||||
Signals:
|
||||
changed: Gets emitted when the config has changed.
|
||||
Args: the changed section and option.
|
||||
Args: the changed section, option and new value.
|
||||
style_changed: When style caches need to be invalidated.
|
||||
Args: the changed section and option.
|
||||
"""
|
||||
|
||||
changed = pyqtSignal(str, str)
|
||||
changed = pyqtSignal(str, str, object)
|
||||
style_changed = pyqtSignal(str, str)
|
||||
|
||||
def __init__(self, configdir, fname, parent=None):
|
||||
@ -326,7 +326,7 @@ class Config(QObject):
|
||||
else:
|
||||
if section in ['colors', 'fonts']:
|
||||
self.style_changed.emit(section, option)
|
||||
self.changed.emit(section, option)
|
||||
self.changed.emit(section, option, self.get(section, option))
|
||||
|
||||
@cmdutils.register(instance='config')
|
||||
def save(self):
|
||||
@ -459,12 +459,12 @@ class LineConfigParser:
|
||||
with open(self._configfile, 'w') as f:
|
||||
self.write(f, limit)
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def on_config_changed(self, section, option):
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Delete the file if the limit was changed to 0."""
|
||||
if self._limit is None:
|
||||
return
|
||||
if (section, option) == self._limit and config.get(*self._limit) == 0:
|
||||
if (section, option) == self._limit and value == 0:
|
||||
if os.path.exists(self._configfile):
|
||||
os.remove(self._configfile)
|
||||
|
||||
|
@ -176,7 +176,9 @@ class BrowserTab(QWebView):
|
||||
netman.deleteLater()
|
||||
logging.debug("Tab shutdown scheduled")
|
||||
|
||||
def on_config_changed(self, section, option):
|
||||
# pylint: disable=unused-argument
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Update tab config when config was changed."""
|
||||
if section == 'general' and option in ['zoomlevels', 'defaultzoom']:
|
||||
self._init_neighborlist()
|
||||
|
@ -211,11 +211,11 @@ class CompletionView(QTreeView):
|
||||
self.expandAll()
|
||||
self.resizeColumnToContents(0)
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def on_config_changed(self, section, option):
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Update self._enabled when the config changed."""
|
||||
if section == 'general' and option == 'show_completion':
|
||||
self._enabled = config.config.get('general', 'show_completion')
|
||||
self._enabled = value
|
||||
|
||||
@pyqtSlot(str)
|
||||
def on_cmd_text_changed(self, text):
|
||||
|
@ -20,7 +20,7 @@
|
||||
import binascii
|
||||
from base64 import b64decode
|
||||
|
||||
from PyQt5.QtCore import QRect, QPoint
|
||||
from PyQt5.QtCore import pyqtSlot, QRect, QPoint
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout
|
||||
|
||||
from qutebrowser.widgets.statusbar import StatusBar
|
||||
@ -99,7 +99,9 @@ class MainWindow(QWidget):
|
||||
#self.tabWidget.setCurrentIndex(0)
|
||||
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def on_config_changed(self, section, option):
|
||||
# pylint: disable=unused-argument
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Resize completion if config changed."""
|
||||
if section == 'general' and option == 'completion_height':
|
||||
self.resize_completion()
|
||||
|
@ -99,8 +99,9 @@ class TabWidget(QTabWidget):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def on_config_changed(self, section, option):
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Update attributes when config changed."""
|
||||
# pylint: disable=unused-argument
|
||||
if section == 'tabbar':
|
||||
self._init_config()
|
||||
|
@ -139,12 +139,12 @@ class TabbedBrowser(TabWidget):
|
||||
else:
|
||||
return None
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def on_config_changed(self, section, option):
|
||||
@pyqtSlot(str, str, object)
|
||||
def on_config_changed(self, section, option, value):
|
||||
"""Update tab config when config was changed."""
|
||||
super().on_config_changed(section, option)
|
||||
super().on_config_changed(section, option, value)
|
||||
for tab in self._tabs:
|
||||
tab.on_config_changed(section, option)
|
||||
tab.on_config_changed(section, option, value)
|
||||
|
||||
def _titleChanged_handler(self, text):
|
||||
"""Set the title of a tab.
|
||||
|
Loading…
Reference in New Issue
Block a user