Merge branch 'oed-downloadview-placement'
This commit is contained in:
commit
e33517f592
@ -31,6 +31,7 @@
|
||||
|Setting|Description
|
||||
|<<ui-zoom-levels,zoom-levels>>|The available zoom levels, separated by commas.
|
||||
|<<ui-default-zoom,default-zoom>>|The default zoom level.
|
||||
|<<ui-downloads-position,downloads-position>>|Where to show the downloaded files.
|
||||
|<<ui-message-timeout,message-timeout>>|Time (in ms) to show messages in the statusbar for.
|
||||
|<<ui-message-unfocused,message-unfocused>>|Whether to show messages in unfocused windows.
|
||||
|<<ui-confirm-quit,confirm-quit>>|Whether to confirm quitting the application.
|
||||
@ -441,6 +442,17 @@ The default zoom level.
|
||||
|
||||
Default: +pass:[100%]+
|
||||
|
||||
[[ui-downloads-position]]
|
||||
=== downloads-position
|
||||
Where to show the downloaded files.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +north+
|
||||
* +south+
|
||||
|
||||
Default: +pass:[north]+
|
||||
|
||||
[[ui-message-timeout]]
|
||||
=== message-timeout
|
||||
Time (in ms) to show messages in the statusbar for.
|
||||
|
@ -235,6 +235,10 @@ def data(readonly=False):
|
||||
SettingValue(typ.Perc(), '100%'),
|
||||
"The default zoom level."),
|
||||
|
||||
('downloads-position',
|
||||
SettingValue(typ.VerticalPosition(), 'north'),
|
||||
"Where to show the downloaded files."),
|
||||
|
||||
('message-timeout',
|
||||
SettingValue(typ.Int(), '2000'),
|
||||
"Time (in ms) to show messages in the statusbar for."),
|
||||
|
@ -1264,6 +1264,13 @@ class Position(BaseType):
|
||||
return self.MAPPING[value]
|
||||
|
||||
|
||||
class VerticalPosition(BaseType):
|
||||
|
||||
"""The position of the download bar."""
|
||||
|
||||
valid_values = ValidValues('north', 'south')
|
||||
|
||||
|
||||
class UrlList(List):
|
||||
|
||||
"""A list of URLs."""
|
||||
|
@ -96,19 +96,18 @@ class MainWindow(QWidget):
|
||||
window=self.win_id)
|
||||
|
||||
self._downloadview = downloadview.DownloadView(self.win_id)
|
||||
self._vbox.addWidget(self._downloadview)
|
||||
self._downloadview.show()
|
||||
|
||||
self._tabbed_browser = tabbedbrowser.TabbedBrowser(self.win_id)
|
||||
objreg.register('tabbed-browser', self._tabbed_browser, scope='window',
|
||||
window=self.win_id)
|
||||
self._vbox.addWidget(self._tabbed_browser)
|
||||
|
||||
# We need to set an explicit parent for StatusBar because it does some
|
||||
# show/hide magic immediately which would mean it'd show up as a
|
||||
# window.
|
||||
self.status = bar.StatusBar(self.win_id, parent=self)
|
||||
self._vbox.addWidget(self.status)
|
||||
|
||||
self._add_widgets()
|
||||
|
||||
self._completion = completionwidget.CompletionView(self.win_id, self)
|
||||
|
||||
@ -141,6 +140,24 @@ class MainWindow(QWidget):
|
||||
"""Resize the completion if related config options changed."""
|
||||
if section == 'completion' and option in ('height', 'shrink'):
|
||||
self.resize_completion()
|
||||
elif section == 'ui' and option == 'downloads-position':
|
||||
self._add_widgets()
|
||||
|
||||
def _add_widgets(self):
|
||||
"""Add or readd all widgets to the VBox."""
|
||||
self._vbox.removeWidget(self._tabbed_browser)
|
||||
self._vbox.removeWidget(self._downloadview)
|
||||
self._vbox.removeWidget(self.status)
|
||||
position = config.get('ui', 'downloads-position')
|
||||
if position == 'north':
|
||||
self._vbox.addWidget(self._downloadview)
|
||||
self._vbox.addWidget(self._tabbed_browser)
|
||||
elif position == 'south':
|
||||
self._vbox.addWidget(self._tabbed_browser)
|
||||
self._vbox.addWidget(self._downloadview)
|
||||
else:
|
||||
raise ValueError("Invalid position {}!".format(position))
|
||||
self._vbox.addWidget(self.status)
|
||||
|
||||
def _load_state_geometry(self):
|
||||
"""Load the geometry from the state file."""
|
||||
|
Loading…
Reference in New Issue
Block a user