Change Position conftypes to top/bottom/left/right.

This commit is contained in:
Florian Bruhin 2015-08-05 23:33:58 +02:00
parent 4314b96512
commit c6c14e967d
5 changed files with 34 additions and 18 deletions

View File

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

View File

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

View File

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

View File

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

View File

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