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:
parent
7c64e8846a
commit
72340575af
@ -230,8 +230,9 @@ class KeyParser(QObject):
|
|||||||
self.set_cmd_text.emit(':{} '.format(cmdstr))
|
self.set_cmd_text.emit(':{} '.format(cmdstr))
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(str, str, object)
|
# pylint: disable=unused-argument
|
||||||
def on_config_changed(self, section, option, value):
|
@pyqtSlot(str, str)
|
||||||
|
def on_config_changed(self, section, option):
|
||||||
if section == 'keybind':
|
if section == 'keybind':
|
||||||
self.read_config()
|
self.read_config()
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class Config(QObject):
|
|||||||
Args: the changed section and option.
|
Args: the changed section and option.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
changed = pyqtSignal(str, str, object)
|
changed = pyqtSignal(str, str)
|
||||||
style_changed = pyqtSignal(str, str)
|
style_changed = pyqtSignal(str, str)
|
||||||
|
|
||||||
def __init__(self, configdir, fname, parent=None):
|
def __init__(self, configdir, fname, parent=None):
|
||||||
@ -327,7 +327,7 @@ class Config(QObject):
|
|||||||
else:
|
else:
|
||||||
if section in ['colors', 'fonts']:
|
if section in ['colors', 'fonts']:
|
||||||
self.style_changed.emit(section, option)
|
self.style_changed.emit(section, option)
|
||||||
self.changed.emit(section, option, self.get(section, option))
|
self.changed.emit(section, option)
|
||||||
|
|
||||||
@cmdutils.register(instance='config')
|
@cmdutils.register(instance='config')
|
||||||
def save(self):
|
def save(self):
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot
|
from PyQt5.QtCore import pyqtSlot
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ class LineConfigParser:
|
|||||||
if not self.data:
|
if not self.data:
|
||||||
logging.debug("No data to save.")
|
logging.debug("No data to save.")
|
||||||
return
|
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)
|
limit = -1 if self._limit is None else config.config.get(*self._limit)
|
||||||
if limit == 0:
|
if limit == 0:
|
||||||
return
|
return
|
||||||
@ -83,11 +84,13 @@ class LineConfigParser:
|
|||||||
with open(self._configfile, 'w') as f:
|
with open(self._configfile, 'w') as f:
|
||||||
self.write(f, limit)
|
self.write(f, limit)
|
||||||
|
|
||||||
@pyqtSlot(str, str, object)
|
@pyqtSlot(str, str)
|
||||||
def on_config_changed(self, section, option, value):
|
def on_config_changed(self, section, option):
|
||||||
"""Delete the file if the limit was changed to 0."""
|
"""Delete the file if the limit was changed to 0."""
|
||||||
if self._limit is None:
|
if self._limit is None:
|
||||||
return
|
return
|
||||||
|
import qutebrowser.config.config as config # FIXME
|
||||||
|
value = config.config.get(section, option)
|
||||||
if (section, option) == self._limit and value == 0:
|
if (section, option) == self._limit and value == 0:
|
||||||
if os.path.exists(self._configfile):
|
if os.path.exists(self._configfile):
|
||||||
os.remove(self._configfile)
|
os.remove(self._configfile)
|
||||||
|
@ -68,8 +68,9 @@ def init():
|
|||||||
settings.setAttribute(item, config.config.get('webkit', name))
|
settings.setAttribute(item, config.config.get('webkit', name))
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(str, str, object)
|
@pyqtSlot(str, str)
|
||||||
def on_config_changed(section, option, value):
|
def on_config_changed(section, option):
|
||||||
"""Update global settings when qwebsettings changed."""
|
"""Update global settings when qwebsettings changed."""
|
||||||
if section == 'webkit':
|
if section == 'webkit':
|
||||||
|
value = config.config.get(section, option)
|
||||||
settings.setAttribute(MAPPING[option], value)
|
settings.setAttribute(MAPPING[option], value)
|
||||||
|
@ -176,9 +176,8 @@ class BrowserTab(QWebView):
|
|||||||
netman.deleteLater()
|
netman.deleteLater()
|
||||||
logging.debug("Tab shutdown scheduled")
|
logging.debug("Tab shutdown scheduled")
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
@pyqtSlot(str, str)
|
||||||
@pyqtSlot(str, str, object)
|
def on_config_changed(self, section, option):
|
||||||
def on_config_changed(self, section, option, value):
|
|
||||||
"""Update tab config when config was changed."""
|
"""Update tab config when config was changed."""
|
||||||
if section == 'general' and option in ['zoomlevels', 'defaultzoom']:
|
if section == 'general' and option in ['zoomlevels', 'defaultzoom']:
|
||||||
self._init_neighborlist()
|
self._init_neighborlist()
|
||||||
|
@ -211,11 +211,11 @@ class CompletionView(QTreeView):
|
|||||||
self.expandAll()
|
self.expandAll()
|
||||||
self.resizeColumnToContents(0)
|
self.resizeColumnToContents(0)
|
||||||
|
|
||||||
@pyqtSlot(str, str, object)
|
@pyqtSlot(str, str)
|
||||||
def on_config_changed(self, section, option, value):
|
def on_config_changed(self, section, option):
|
||||||
"""Update self._enabled when the config changed."""
|
"""Update self._enabled when the config changed."""
|
||||||
if section == 'general' and option == 'show_completion':
|
if section == 'general' and option == 'show_completion':
|
||||||
self._enabled = value
|
self._enabled = config.config.get('general', 'show_completion')
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def on_cmd_text_changed(self, text):
|
def on_cmd_text_changed(self, text):
|
||||||
|
@ -106,9 +106,8 @@ class MainWindow(QWidget):
|
|||||||
#self.tabWidget.setCurrentIndex(0)
|
#self.tabWidget.setCurrentIndex(0)
|
||||||
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
@pyqtSlot(str, str)
|
||||||
@pyqtSlot(str, str, object)
|
def on_config_changed(self, section, option):
|
||||||
def on_config_changed(self, section, option, value):
|
|
||||||
"""Resize completion if config changed."""
|
"""Resize completion if config changed."""
|
||||||
if section == 'general' and option == 'completion_height':
|
if section == 'general' and option == 'completion_height':
|
||||||
self.resize_completion()
|
self.resize_completion()
|
||||||
|
@ -141,12 +141,12 @@ class TabbedBrowser(TabWidget):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@pyqtSlot(str, str, object)
|
@pyqtSlot(str, str)
|
||||||
def on_config_changed(self, section, option, value):
|
def on_config_changed(self, section, option):
|
||||||
"""Update tab config when config was changed."""
|
"""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:
|
for tab in self._tabs:
|
||||||
tab.on_config_changed(section, option, value)
|
tab.on_config_changed(section, option)
|
||||||
|
|
||||||
def _titleChanged_handler(self, text):
|
def _titleChanged_handler(self, text):
|
||||||
"""Set the title of a tab.
|
"""Set the title of a tab.
|
||||||
|
@ -99,9 +99,8 @@ class TabWidget(QTabWidget):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
@pyqtSlot(str, str)
|
||||||
@pyqtSlot(str, str, object)
|
def on_config_changed(self, section, option):
|
||||||
def on_config_changed(self, section, option, value):
|
|
||||||
"""Update attributes when config changed."""
|
"""Update attributes when config changed."""
|
||||||
if section == 'tabbar':
|
if section == 'tabbar':
|
||||||
self._init_config()
|
self._init_config()
|
||||||
|
Loading…
Reference in New Issue
Block a user