From c6c14e967d59abe9111f2cd6c0f1e0894707331a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Aug 2015 23:33:58 +0200 Subject: [PATCH] Change Position conftypes to top/bottom/left/right. --- doc/help/settings.asciidoc | 16 ++++++++-------- qutebrowser/config/config.py | 16 ++++++++++++++++ qutebrowser/config/configdata.py | 4 ++-- qutebrowser/config/configtypes.py | 12 ++++++------ qutebrowser/mainwindow/mainwindow.py | 4 ++-- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index cd11988b8..3cb7f400f 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -473,10 +473,10 @@ Where to show the downloaded files. Valid values: - * +north+ - * +south+ + * +top+ + * +bottom+ -Default: +pass:[north]+ +Default: +pass:[top]+ [[ui-message-timeout]] === message-timeout @@ -1020,12 +1020,12 @@ The position of the tab bar. Valid values: - * +north+ - * +south+ - * +east+ - * +west+ + * +top+ + * +bottom+ + * +left+ + * +right+ -Default: +pass:[north]+ +Default: +pass:[top]+ [[tabs-show-favicons]] === show-favicons diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index e88ec93fd..46eb45a7b 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -271,6 +271,20 @@ def _get_value_transformer(old, new): return transformer +def _transform_position(val): + """Transformer for position values.""" + mapping = { + 'north': 'top', + 'south': 'bottom', + 'west': 'left', + 'east': 'right', + } + try: + return mapping[val] + except KeyError: + return val + + class ConfigManager(QObject): """Configuration manager for qutebrowser. @@ -334,6 +348,8 @@ class ConfigManager(QObject): CHANGED_OPTIONS = { ('content', 'cookies-accept'): _get_value_transformer('default', 'no-3rdparty'), + ('tabbar', 'position'): _transform_position, + ('ui', 'downloads-position'): _transform_position, } changed = pyqtSignal(str, str) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 75fd1b6ad..c20781d99 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -240,7 +240,7 @@ def data(readonly=False): "The default zoom level."), ('downloads-position', - SettingValue(typ.VerticalPosition(), 'north'), + SettingValue(typ.VerticalPosition(), 'top'), "Where to show the downloaded files."), ('message-timeout', @@ -501,7 +501,7 @@ def data(readonly=False): "On which mouse button to close tabs."), ('position', - SettingValue(typ.Position(), 'north'), + SettingValue(typ.Position(), 'top'), "The position of the tab bar."), ('show-favicons', diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index e6e2ab0af..dd4f19d79 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1243,13 +1243,13 @@ class Position(MappingType): """The position of the tab bar.""" - valid_values = ValidValues('north', 'south', 'east', 'west') + valid_values = ValidValues('top', 'bottom', 'left', 'right') MAPPING = { - 'north': QTabWidget.North, - 'south': QTabWidget.South, - 'west': QTabWidget.West, - 'east': QTabWidget.East, + 'top': QTabWidget.North, + 'bottom': QTabWidget.South, + 'left': QTabWidget.West, + 'right': QTabWidget.East, } @@ -1257,7 +1257,7 @@ class VerticalPosition(BaseType): """The position of the download bar.""" - valid_values = ValidValues('north', 'south') + valid_values = ValidValues('top', 'bottom') class UrlList(List): diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index d9e58802a..51f73a868 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -198,10 +198,10 @@ class MainWindow(QWidget): self._vbox.removeWidget(self._downloadview) self._vbox.removeWidget(self.status) position = config.get('ui', 'downloads-position') - if position == 'north': + if position == 'top': self._vbox.addWidget(self._downloadview) self._vbox.addWidget(self.tabbed_browser) - elif position == 'south': + elif position == 'bottom': self._vbox.addWidget(self.tabbed_browser) self._vbox.addWidget(self._downloadview) else: