Fix VerticalPosition and NewTabPosition

Make them string so they have to_py() defined.
This commit is contained in:
Florian Bruhin 2017-06-13 14:00:18 +02:00
parent a3d4822b9f
commit e2b0fdf8aa
2 changed files with 9 additions and 8 deletions

View File

@ -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."),

View File

@ -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