Fix most config changed handlers

This commit is contained in:
Florian Bruhin 2017-06-13 16:15:41 +02:00
parent c25022f549
commit e828f5b812
5 changed files with 20 additions and 27 deletions

View File

@ -260,9 +260,9 @@ class AbstractZoom(QObject):
# self.destroyed.connect(functools.partial(
# cfg.changed.disconnect, self.init_neighborlist))
@pyqtSlot(str, str)
def _on_config_changed(self, section, option):
if section == 'ui' and option in ['zoom-levels', 'default-zoom']:
@pyqtSlot(str)
def _on_config_changed(self, option):
if option in ['zoom.levels', 'zoom.default']:
if not self._default_zoom_changed:
factor = float(config.val.zoom.default) / 100
self._set_factor_internal(factor)

View File

@ -141,11 +141,9 @@ class CompletionView(QTreeView):
def __repr__(self):
return utils.get_repr(self)
@pyqtSlot(str, str)
def _on_config_changed(self, section, option):
if section != 'completion':
return
if option in ['height', 'shrink']:
@pyqtSlot(str)
def _on_config_changed(self, option):
if option in ['completion.height', 'completion.shrink']:
self.update_geometry.emit()
def _resize_columns(self):

View File

@ -323,16 +323,14 @@ class MainWindow(QWidget):
def __repr__(self):
return utils.get_repr(self)
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
@pyqtSlot(str)
def on_config_changed(self, option):
"""Resize the completion if related config options changed."""
if section != 'ui':
return
if option == 'statusbar-padding':
if option == 'statusbar.padding':
self._update_overlay_geometries()
elif option == 'downloads-position':
elif option == 'downloads.position':
self._add_widgets()
elif option == 'status-position':
elif option == 'statusbar.position':
self._add_widgets()
self._update_overlay_geometries()

View File

@ -199,13 +199,11 @@ class StatusBar(QWidget):
def __repr__(self):
return utils.get_repr(self)
@pyqtSlot(str, str)
def _on_config_changed(self, section, option):
if section != 'ui':
return
if option == 'hide-statusbar':
@pyqtSlot(str)
def _on_config_changed(self, option):
if option == 'statusbar.hide':
self.maybe_hide()
elif option == 'statusbar-pdading':
elif option == 'statusbar.padding':
self._set_hbox_padding()
@pyqtSlot()

View File

@ -189,10 +189,9 @@ class TabWidget(QTabWidget):
fields['scroll_pos'] = scroll_pos
return fields
def update_tab_titles(self, section='tabs', option='title-format'):
def update_tab_titles(self, option='tabs.title.format'):
"""Update all texts."""
if section == 'tabs' and option in ['title-format',
'title-format-pinned']:
if option in ['tabs.title.format', 'tabs.title.format_pinned']:
for idx in range(self.count()):
self.update_tab_title(idx)
@ -426,10 +425,10 @@ class TabBar(QTabBar):
p.setColor(QPalette.Window, config.val.colors.tabs.bar.bg)
self.setPalette(p)
@pyqtSlot(str, str)
def on_tab_colors_changed(self, section, option):
@pyqtSlot(str)
def on_tab_colors_changed(self, option):
"""Set the tab colors."""
if section == 'colors' and option.startswith('tabs.'):
if option.startswith('colors.tabs.'):
self.update()
def mousePressEvent(self, e):