Another round of config breakage (sorry!).

- Rename colors->tab.* to colors->tabs.*
- Rename permission section to content.
This commit is contained in:
Florian Bruhin 2014-11-26 21:16:27 +01:00
parent e8966ec7bb
commit d34aefcfee
7 changed files with 99 additions and 99 deletions

View File

@ -107,21 +107,21 @@
|<<storage-cache-size,cache-size>>|Size of the HTTP network cache.
|==============
.Quick reference for section ``permissions''
.Quick reference for section ``content''
[options="header",width="75%",cols="25%,75%"]
|==============
|Setting|Description
|<<permissions-allow-images,allow-images>>|Whether images are automatically loaded in web pages.
|<<permissions-allow-javascript,allow-javascript>>|Enables or disables the running of JavaScript programs.
|<<permissions-allow-plugins,allow-plugins>>|Enables or disables plugins in Web pages.
|<<permissions-javascript-can-open-windows,javascript-can-open-windows>>|Whether JavaScript programs can open new windows.
|<<permissions-javascript-can-close-windows,javascript-can-close-windows>>|Whether JavaScript programs can close windows.
|<<permissions-javascript-can-access-clipboard,javascript-can-access-clipboard>>|Whether JavaScript programs can read or write to the clipboard.
|<<permissions-local-content-can-access-remote-urls,local-content-can-access-remote-urls>>|Whether locally loaded documents are allowed to access remote urls.
|<<permissions-local-content-can-access-file-urls,local-content-can-access-file-urls>>|Whether locally loaded documents are allowed to access other local urls.
|<<permissions-cookies-accept,cookies-accept>>|Whether to accept cookies.
|<<permissions-cookies-store,cookies-store>>|Whether to store cookies.
|<<permissions-host-block-lists,host-block-lists>>|List of URLs of lists which contain hosts to block.
|<<content-allow-images,allow-images>>|Whether images are automatically loaded in web pages.
|<<content-allow-javascript,allow-javascript>>|Enables or disables the running of JavaScript programs.
|<<content-allow-plugins,allow-plugins>>|Enables or disables plugins in Web pages.
|<<content-javascript-can-open-windows,javascript-can-open-windows>>|Whether JavaScript programs can open new windows.
|<<content-javascript-can-close-windows,javascript-can-close-windows>>|Whether JavaScript programs can close windows.
|<<content-javascript-can-access-clipboard,javascript-can-access-clipboard>>|Whether JavaScript programs can read or write to the clipboard.
|<<content-local-content-can-access-remote-urls,local-content-can-access-remote-urls>>|Whether locally loaded documents are allowed to access remote urls.
|<<content-local-content-can-access-file-urls,local-content-can-access-file-urls>>|Whether locally loaded documents are allowed to access other local urls.
|<<content-cookies-accept,cookies-accept>>|Whether to accept cookies.
|<<content-cookies-store,cookies-store>>|Whether to store cookies.
|<<content-host-block-lists,host-block-lists>>|List of URLs of lists which contain hosts to block.
|==============
.Quick reference for section ``hints''
@ -165,18 +165,18 @@
|<<colors-statusbar.url.fg.error,statusbar.url.fg.error>>|Foreground color of the URL in the statusbar on error.
|<<colors-statusbar.url.fg.warn,statusbar.url.fg.warn>>|Foreground color of the URL in the statusbar when there's a warning.
|<<colors-statusbar.url.fg.hover,statusbar.url.fg.hover>>|Foreground color of the URL in the statusbar for hovered links.
|<<colors-tab.fg.odd,tab.fg.odd>>|Foreground color of unselected odd tabs.
|<<colors-tab.fg.even,tab.fg.even>>|Foreground color of unselected even tabs.
|<<colors-tab.fg.selected,tab.fg.selected>>|Foreground color of selected tabs.
|<<colors-tab.bg.odd,tab.bg.odd>>|Background color of unselected odd tabs.
|<<colors-tab.bg.even,tab.bg.even>>|Background color of unselected even tabs.
|<<colors-tab.bg.selected,tab.bg.selected>>|Background color of selected tabs.
|<<colors-tab.bg.bar,tab.bg.bar>>|Background color of the tabbar.
|<<colors-tab.indicator.start,tab.indicator.start>>|Color gradient start for the tab indicator.
|<<colors-tab.indicator.stop,tab.indicator.stop>>|Color gradient end for the tab indicator.
|<<colors-tab.indicator.error,tab.indicator.error>>|Color for the tab indicator on errors..
|<<colors-tab.indicator.system,tab.indicator.system>>|Color gradient interpolation system for the tab indicator.
|<<colors-tab.seperator,tab.seperator>>|Color for the tab seperator.
|<<colors-tabs.fg.odd,tabs.fg.odd>>|Foreground color of unselected odd tabs.
|<<colors-tabs.fg.even,tabs.fg.even>>|Foreground color of unselected even tabs.
|<<colors-tabs.fg.selected,tabs.fg.selected>>|Foreground color of selected tabs.
|<<colors-tabs.bg.odd,tabs.bg.odd>>|Background color of unselected odd tabs.
|<<colors-tabs.bg.even,tabs.bg.even>>|Background color of unselected even tabs.
|<<colors-tabs.bg.selected,tabs.bg.selected>>|Background color of selected tabs.
|<<colors-tabs.bg.bar,tabs.bg.bar>>|Background color of the tabbar.
|<<colors-tabs.indicator.start,tabs.indicator.start>>|Color gradient start for the tab indicator.
|<<colors-tabs.indicator.stop,tabs.indicator.stop>>|Color gradient end for the tab indicator.
|<<colors-tabs.indicator.error,tabs.indicator.error>>|Color for the tab indicator on errors..
|<<colors-tabs.indicator.system,tabs.indicator.system>>|Color gradient interpolation system for the tab indicator.
|<<colors-tabs.seperator,tabs.seperator>>|Color for the tab seperator.
|<<colors-hints.fg,hints.fg>>|Font color for hints.
|<<colors-hints.fg.match,hints.fg.match>>|Font color for the matched part of hints.
|<<colors-hints.bg,hints.bg>>|Background color for hints.
@ -720,22 +720,22 @@ Size of the HTTP network cache.
Default: +pass:[52428800]+
== permissions
== content
Loaded plugins/scripts and allowed actions.
[[permissions-allow-images]]
[[content-allow-images]]
=== allow-images
Whether images are automatically loaded in web pages.
Default: +pass:[true]+
[[permissions-allow-javascript]]
[[content-allow-javascript]]
=== allow-javascript
Enables or disables the running of JavaScript programs.
Default: +pass:[true]+
[[permissions-allow-plugins]]
[[content-allow-plugins]]
=== allow-plugins
Enables or disables plugins in Web pages.
@ -743,37 +743,37 @@ Qt plugins with a mimetype such as "application/x-qt-plugin" are not affected by
Default: +pass:[false]+
[[permissions-javascript-can-open-windows]]
[[content-javascript-can-open-windows]]
=== javascript-can-open-windows
Whether JavaScript programs can open new windows.
Default: +pass:[false]+
[[permissions-javascript-can-close-windows]]
[[content-javascript-can-close-windows]]
=== javascript-can-close-windows
Whether JavaScript programs can close windows.
Default: +pass:[false]+
[[permissions-javascript-can-access-clipboard]]
[[content-javascript-can-access-clipboard]]
=== javascript-can-access-clipboard
Whether JavaScript programs can read or write to the clipboard.
Default: +pass:[false]+
[[permissions-local-content-can-access-remote-urls]]
[[content-local-content-can-access-remote-urls]]
=== local-content-can-access-remote-urls
Whether locally loaded documents are allowed to access remote urls.
Default: +pass:[false]+
[[permissions-local-content-can-access-file-urls]]
[[content-local-content-can-access-file-urls]]
=== local-content-can-access-file-urls
Whether locally loaded documents are allowed to access other local urls.
Default: +pass:[true]+
[[permissions-cookies-accept]]
[[content-cookies-accept]]
=== cookies-accept
Whether to accept cookies.
@ -784,13 +784,13 @@ Valid values:
Default: +pass:[default]+
[[permissions-cookies-store]]
[[content-cookies-store]]
=== cookies-store
Whether to store cookies.
Default: +pass:[true]+
[[permissions-host-block-lists]]
[[content-host-block-lists]]
=== host-block-lists
List of URLs of lists which contain hosts to block.
@ -1019,68 +1019,68 @@ Foreground color of the URL in the statusbar for hovered links.
Default: +pass:[aqua]+
[[colors-tab.fg.odd]]
=== tab.fg.odd
[[colors-tabs.fg.odd]]
=== tabs.fg.odd
Foreground color of unselected odd tabs.
Default: +pass:[white]+
[[colors-tab.fg.even]]
=== tab.fg.even
[[colors-tabs.fg.even]]
=== tabs.fg.even
Foreground color of unselected even tabs.
Default: +pass:[white]+
[[colors-tab.fg.selected]]
=== tab.fg.selected
[[colors-tabs.fg.selected]]
=== tabs.fg.selected
Foreground color of selected tabs.
Default: +pass:[white]+
[[colors-tab.bg.odd]]
=== tab.bg.odd
[[colors-tabs.bg.odd]]
=== tabs.bg.odd
Background color of unselected odd tabs.
Default: +pass:[grey]+
[[colors-tab.bg.even]]
=== tab.bg.even
[[colors-tabs.bg.even]]
=== tabs.bg.even
Background color of unselected even tabs.
Default: +pass:[darkgrey]+
[[colors-tab.bg.selected]]
=== tab.bg.selected
[[colors-tabs.bg.selected]]
=== tabs.bg.selected
Background color of selected tabs.
Default: +pass:[black]+
[[colors-tab.bg.bar]]
=== tab.bg.bar
[[colors-tabs.bg.bar]]
=== tabs.bg.bar
Background color of the tabbar.
Default: +pass:[#555555]+
[[colors-tab.indicator.start]]
=== tab.indicator.start
[[colors-tabs.indicator.start]]
=== tabs.indicator.start
Color gradient start for the tab indicator.
Default: +pass:[#0000aa]+
[[colors-tab.indicator.stop]]
=== tab.indicator.stop
[[colors-tabs.indicator.stop]]
=== tabs.indicator.stop
Color gradient end for the tab indicator.
Default: +pass:[#00aa00]+
[[colors-tab.indicator.error]]
=== tab.indicator.error
[[colors-tabs.indicator.error]]
=== tabs.indicator.error
Color for the tab indicator on errors..
Default: +pass:[#ff0000]+
[[colors-tab.indicator.system]]
=== tab.indicator.system
[[colors-tabs.indicator.system]]
=== tabs.indicator.system
Color gradient interpolation system for the tab indicator.
Valid values:
@ -1091,8 +1091,8 @@ Valid values:
Default: +pass:[rgb]+
[[colors-tab.seperator]]
=== tab.seperator
[[colors-tabs.seperator]]
=== tabs.seperator
Color for the tab seperator.
Default: +pass:[#555555]+

View File

@ -75,7 +75,7 @@ class HostBlocker:
for line in f:
self.blocked_hosts.add(line.strip())
else:
if config.get('permissions', 'host-block-lists') is not None:
if config.get('content', 'host-block-lists') is not None:
message.info('last-focused',
"Run :adblock-update to get adblock lists.")
@ -84,7 +84,7 @@ class HostBlocker:
"""Update the adblock block lists."""
self.blocked_hosts = set()
self._done_count = 0
urls = config.get('permissions', 'host-block-lists')
urls = config.get('content', 'host-block-lists')
download_manager = objreg.get('download-manager', scope='window',
window='last-focused')
if urls is None:
@ -187,10 +187,10 @@ class HostBlocker:
"sources.".format(len(self.blocked_hosts),
self._done_count))
@config.change_filter('permissions', 'host-block-lists')
@config.change_filter('content', 'host-block-lists')
def on_config_changed(self):
"""Update files when the config changed."""
urls = config.get('permissions', 'host-block-lists')
urls = config.get('content', 'host-block-lists')
if urls is None:
try:
os.remove(self._hosts_file)

View File

@ -63,14 +63,14 @@ class CookieJar(QNetworkCookieJar):
Return:
True if one or more cookies are set for 'url', otherwise False.
"""
if config.get('permissions', 'cookies-accept') == 'never':
if config.get('content', 'cookies-accept') == 'never':
return False
else:
return super().setCookiesFromUrl(cookies, url)
def save(self):
"""Save cookies to disk."""
if not config.get('permissions', 'cookies-store'):
if not config.get('content', 'cookies-store'):
return
self.purge_old_cookies()
lines = []
@ -80,9 +80,9 @@ class CookieJar(QNetworkCookieJar):
self._linecp.data = lines
self._linecp.save()
@config.change_filter('permissions', 'cookies-store')
@config.change_filter('content', 'cookies-store')
def cookies_store_changed(self):
"""Delete stored cookies if cookies-store changed."""
if not config.get('permissions', 'cookies-store'):
if not config.get('content', 'cookies-store'):
self._linecp.data = []
self._linecp.save()

View File

@ -70,7 +70,7 @@ SECTION_DESC = {
'completion': "Options related to completion and command history.",
'tabs': "Configuration of the tab bar.",
'storage': "Settings related to cache and storage.",
'permissions': "Loaded plugins/scripts and allowed actions.",
'content': "Loaded plugins/scripts and allowed actions.",
'hints': "Hinting settings.",
'searchengines': (
"Definitions of search engines which can be used via the address "
@ -448,7 +448,7 @@ DATA = collections.OrderedDict([
"Size of the HTTP network cache."),
)),
('permissions', sect.KeyValue(
('content', sect.KeyValue(
('allow-images',
SettingValue(typ.Bool(), 'true'),
"Whether images are automatically loaded in web pages."),
@ -665,51 +665,51 @@ DATA = collections.OrderedDict([
SettingValue(typ.QssColor(), 'aqua'),
"Foreground color of the URL in the statusbar for hovered links."),
('tab.fg.odd',
('tabs.fg.odd',
SettingValue(typ.QtColor(), 'white'),
"Foreground color of unselected odd tabs."),
('tab.fg.even',
('tabs.fg.even',
SettingValue(typ.QtColor(), 'white'),
"Foreground color of unselected even tabs."),
('tab.fg.selected',
('tabs.fg.selected',
SettingValue(typ.QtColor(), 'white'),
"Foreground color of selected tabs."),
('tab.bg.odd',
('tabs.bg.odd',
SettingValue(typ.QtColor(), 'grey'),
"Background color of unselected odd tabs."),
('tab.bg.even',
('tabs.bg.even',
SettingValue(typ.QtColor(), 'darkgrey'),
"Background color of unselected even tabs."),
('tab.bg.selected',
('tabs.bg.selected',
SettingValue(typ.QtColor(), 'black'),
"Background color of selected tabs."),
('tab.bg.bar',
('tabs.bg.bar',
SettingValue(typ.QtColor(), '#555555'),
"Background color of the tabbar."),
('tab.indicator.start',
('tabs.indicator.start',
SettingValue(typ.QtColor(), '#0000aa'),
"Color gradient start for the tab indicator."),
('tab.indicator.stop',
('tabs.indicator.stop',
SettingValue(typ.QtColor(), '#00aa00'),
"Color gradient end for the tab indicator."),
('tab.indicator.error',
('tabs.indicator.error',
SettingValue(typ.QtColor(), '#ff0000'),
"Color for the tab indicator on errors.."),
('tab.indicator.system',
('tabs.indicator.system',
SettingValue(typ.ColorSystem(), 'rgb'),
"Color gradient interpolation system for the tab indicator."),
('tab.seperator',
('tabs.seperator',
SettingValue(typ.QssColor(), '#555555'),
"Color for the tab seperator."),

View File

@ -38,7 +38,7 @@ MapType = usertypes.enum('MapType', ['attribute', 'setter', 'static_setter'])
MAPPINGS = {
'permissions': {
'content': {
'allow-images':
(MapType.attribute, QWebSettings.AutoLoadImages),
'allow-javascript':

View File

@ -552,9 +552,9 @@ class TabbedBrowser(tabwidget.TabWidget):
except RuntimeError:
# We can get signals for tabs we already deleted...
return
start = config.get('colors', 'tab.indicator.start')
stop = config.get('colors', 'tab.indicator.stop')
system = config.get('colors', 'tab.indicator.system')
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, perc, system)
self.tabBar().set_tab_indicator_color(idx, color)
@ -566,12 +566,12 @@ class TabbedBrowser(tabwidget.TabWidget):
# We can get signals for tabs we already deleted...
return
if ok:
start = config.get('colors', 'tab.indicator.start')
stop = config.get('colors', 'tab.indicator.stop')
system = config.get('colors', 'tab.indicator.system')
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, 100, system)
else:
color = config.get('colors', 'tab.indicator.error')
color = config.get('colors', 'tabs.indicator.error')
self.tabBar().set_tab_indicator_color(idx, color)
def resizeEvent(self, e):

View File

@ -132,17 +132,17 @@ class TabBar(QTabBar):
"""Set the tabbar font."""
self.setFont(config.get('fonts', 'tabbar'))
@config.change_filter('colors', 'tab.bg.bar')
@config.change_filter('colors', 'tabs.bg.bar')
def set_colors(self):
"""Set the tabbar colors."""
p = self.palette()
p.setColor(QPalette.Window, config.get('colors', 'tab.bg.bar'))
p.setColor(QPalette.Window, config.get('colors', 'tabs.bg.bar'))
self.setPalette(p)
@pyqtSlot(str, str)
def on_tab_colors_changed(self, section, option):
"""Set the tab colors."""
if section == 'colors' and option.startswith('tab.fg.'):
if section == 'colors' and option.startswith('tabs.fg.'):
self.update()
def mousePressEvent(self, e):
@ -235,14 +235,14 @@ class TabBar(QTabBar):
for idx in range(self.count()):
self.initStyleOption(tab, idx)
if idx == selected:
bg_color = config.get('colors', 'tab.bg.selected')
fg_color = config.get('colors', 'tab.fg.selected')
bg_color = config.get('colors', 'tabs.bg.selected')
fg_color = config.get('colors', 'tabs.fg.selected')
elif idx % 2:
bg_color = config.get('colors', 'tab.bg.odd')
fg_color = config.get('colors', 'tab.fg.odd')
bg_color = config.get('colors', 'tabs.bg.odd')
fg_color = config.get('colors', 'tabs.fg.odd')
else:
bg_color = config.get('colors', 'tab.bg.even')
fg_color = config.get('colors', 'tab.fg.even')
bg_color = config.get('colors', 'tabs.bg.even')
fg_color = config.get('colors', 'tabs.fg.even')
tab.palette.setColor(QPalette.Window, bg_color)
tab.palette.setColor(QPalette.WindowText, fg_color)
indicator_color = self.tabData(idx)