From e2b0fdf8aa16531c7eef6068e251040d34c1d528 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 13 Jun 2017 14:00:18 +0200 Subject: [PATCH] Fix VerticalPosition and NewTabPosition Make them string so they have to_py() defined. --- qutebrowser/config/configtypes.py | 13 +++++++------ qutebrowser/mainwindow/tabbedbrowser.py | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index ff7a64807..d114904a3 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -252,8 +252,9 @@ class String(BaseType): completions: completions to be used, or None """ - def __init__(self, minlen=None, maxlen=None, forbidden=None, encoding=None, - none_ok=False, completions=None, valid_values=None): + def __init__(self, *, minlen=None, maxlen=None, forbidden=None, + encoding=None, none_ok=False, completions=None, + valid_values=None): super().__init__(none_ok) self.valid_values = valid_values @@ -1181,12 +1182,12 @@ class TextAlignment(MappingType): valid_values=ValidValues('left', 'right', 'center')) -class VerticalPosition(BaseType): +class VerticalPosition(String): """The position of the download bar.""" def __init__(self, none_ok=False): - super().__init__(none_ok) + super().__init__(none_ok=none_ok) self.valid_values = ValidValues('top', 'bottom') @@ -1282,12 +1283,12 @@ class ConfirmQuit(FlagList): return values -class NewTabPosition(BaseType): +class NewTabPosition(String): """How new tabs are positioned.""" def __init__(self, none_ok=False): - super().__init__(none_ok) + super().__init__(none_ok=none_ok) self.valid_values = ValidValues( ('prev', "Before the current tab."), ('next', "After the current tab."), diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 4a1f5a921..bfc402e3b 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -460,9 +460,9 @@ class TabbedBrowser(tabwidget.TabWidget): The index of the new tab. """ if explicit: - pos = config.val.tabs.new_tab_position_explicit + pos = config.val.tabs.new_position_explicit else: - pos = config.val.tabs.new_tab_position + pos = config.val.tabs.new_position if pos == 'prev': idx = self._tab_insert_idx_left # On first sight, we'd think we have to decrement