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: Valid values:
* +north+ * +top+
* +south+ * +bottom+
Default: +pass:[north]+ Default: +pass:[top]+
[[ui-message-timeout]] [[ui-message-timeout]]
=== message-timeout === message-timeout
@ -1020,12 +1020,12 @@ The position of the tab bar.
Valid values: Valid values:
* +north+ * +top+
* +south+ * +bottom+
* +east+ * +left+
* +west+ * +right+
Default: +pass:[north]+ Default: +pass:[top]+
[[tabs-show-favicons]] [[tabs-show-favicons]]
=== show-favicons === show-favicons

View File

@ -271,6 +271,20 @@ def _get_value_transformer(old, new):
return transformer 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): class ConfigManager(QObject):
"""Configuration manager for qutebrowser. """Configuration manager for qutebrowser.
@ -334,6 +348,8 @@ class ConfigManager(QObject):
CHANGED_OPTIONS = { CHANGED_OPTIONS = {
('content', 'cookies-accept'): ('content', 'cookies-accept'):
_get_value_transformer('default', 'no-3rdparty'), _get_value_transformer('default', 'no-3rdparty'),
('tabbar', 'position'): _transform_position,
('ui', 'downloads-position'): _transform_position,
} }
changed = pyqtSignal(str, str) changed = pyqtSignal(str, str)

View File

@ -240,7 +240,7 @@ def data(readonly=False):
"The default zoom level."), "The default zoom level."),
('downloads-position', ('downloads-position',
SettingValue(typ.VerticalPosition(), 'north'), SettingValue(typ.VerticalPosition(), 'top'),
"Where to show the downloaded files."), "Where to show the downloaded files."),
('message-timeout', ('message-timeout',
@ -501,7 +501,7 @@ def data(readonly=False):
"On which mouse button to close tabs."), "On which mouse button to close tabs."),
('position', ('position',
SettingValue(typ.Position(), 'north'), SettingValue(typ.Position(), 'top'),
"The position of the tab bar."), "The position of the tab bar."),
('show-favicons', ('show-favicons',

View File

@ -1243,13 +1243,13 @@ class Position(MappingType):
"""The position of the tab bar.""" """The position of the tab bar."""
valid_values = ValidValues('north', 'south', 'east', 'west') valid_values = ValidValues('top', 'bottom', 'left', 'right')
MAPPING = { MAPPING = {
'north': QTabWidget.North, 'top': QTabWidget.North,
'south': QTabWidget.South, 'bottom': QTabWidget.South,
'west': QTabWidget.West, 'left': QTabWidget.West,
'east': QTabWidget.East, 'right': QTabWidget.East,
} }
@ -1257,7 +1257,7 @@ class VerticalPosition(BaseType):
"""The position of the download bar.""" """The position of the download bar."""
valid_values = ValidValues('north', 'south') valid_values = ValidValues('top', 'bottom')
class UrlList(List): class UrlList(List):

View File

@ -198,10 +198,10 @@ class MainWindow(QWidget):
self._vbox.removeWidget(self._downloadview) self._vbox.removeWidget(self._downloadview)
self._vbox.removeWidget(self.status) self._vbox.removeWidget(self.status)
position = config.get('ui', 'downloads-position') position = config.get('ui', 'downloads-position')
if position == 'north': if position == 'top':
self._vbox.addWidget(self._downloadview) self._vbox.addWidget(self._downloadview)
self._vbox.addWidget(self.tabbed_browser) self._vbox.addWidget(self.tabbed_browser)
elif position == 'south': elif position == 'bottom':
self._vbox.addWidget(self.tabbed_browser) self._vbox.addWidget(self.tabbed_browser)
self._vbox.addWidget(self._downloadview) self._vbox.addWidget(self._downloadview)
else: else: