From d34aefcfeeedddd692024d077fca21fae0066465 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 26 Nov 2014 21:16:27 +0100 Subject: [PATCH] Another round of config breakage (sorry!). - Rename colors->tab.* to colors->tabs.* - Rename permission section to content. --- doc/help/settings.asciidoc | 120 +++++++++++++-------------- qutebrowser/browser/adblock.py | 8 +- qutebrowser/browser/cookies.py | 8 +- qutebrowser/config/configdata.py | 28 +++---- qutebrowser/config/websettings.py | 2 +- qutebrowser/widgets/tabbedbrowser.py | 14 ++-- qutebrowser/widgets/tabwidget.py | 18 ++-- 7 files changed, 99 insertions(+), 99 deletions(-) diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 983865a37..17d080d7d 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -107,21 +107,21 @@ |<>|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 -|<>|Whether images are automatically loaded in web pages. -|<>|Enables or disables the running of JavaScript programs. -|<>|Enables or disables plugins in Web pages. -|<>|Whether JavaScript programs can open new windows. -|<>|Whether JavaScript programs can close windows. -|<>|Whether JavaScript programs can read or write to the clipboard. -|<>|Whether locally loaded documents are allowed to access remote urls. -|<>|Whether locally loaded documents are allowed to access other local urls. -|<>|Whether to accept cookies. -|<>|Whether to store cookies. -|<>|List of URLs of lists which contain hosts to block. +|<>|Whether images are automatically loaded in web pages. +|<>|Enables or disables the running of JavaScript programs. +|<>|Enables or disables plugins in Web pages. +|<>|Whether JavaScript programs can open new windows. +|<>|Whether JavaScript programs can close windows. +|<>|Whether JavaScript programs can read or write to the clipboard. +|<>|Whether locally loaded documents are allowed to access remote urls. +|<>|Whether locally loaded documents are allowed to access other local urls. +|<>|Whether to accept cookies. +|<>|Whether to store cookies. +|<>|List of URLs of lists which contain hosts to block. |============== .Quick reference for section ``hints'' @@ -165,18 +165,18 @@ |<>|Foreground color of the URL in the statusbar on error. |<>|Foreground color of the URL in the statusbar when there's a warning. |<>|Foreground color of the URL in the statusbar for hovered links. -|<>|Foreground color of unselected odd tabs. -|<>|Foreground color of unselected even tabs. -|<>|Foreground color of selected tabs. -|<>|Background color of unselected odd tabs. -|<>|Background color of unselected even tabs. -|<>|Background color of selected tabs. -|<>|Background color of the tabbar. -|<>|Color gradient start for the tab indicator. -|<>|Color gradient end for the tab indicator. -|<>|Color for the tab indicator on errors.. -|<>|Color gradient interpolation system for the tab indicator. -|<>|Color for the tab seperator. +|<>|Foreground color of unselected odd tabs. +|<>|Foreground color of unselected even tabs. +|<>|Foreground color of selected tabs. +|<>|Background color of unselected odd tabs. +|<>|Background color of unselected even tabs. +|<>|Background color of selected tabs. +|<>|Background color of the tabbar. +|<>|Color gradient start for the tab indicator. +|<>|Color gradient end for the tab indicator. +|<>|Color for the tab indicator on errors.. +|<>|Color gradient interpolation system for the tab indicator. +|<>|Color for the tab seperator. |<>|Font color for hints. |<>|Font color for the matched part of hints. |<>|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]+ diff --git a/qutebrowser/browser/adblock.py b/qutebrowser/browser/adblock.py index d6eb4cda0..d43efa6ee 100644 --- a/qutebrowser/browser/adblock.py +++ b/qutebrowser/browser/adblock.py @@ -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) diff --git a/qutebrowser/browser/cookies.py b/qutebrowser/browser/cookies.py index a6e929ac4..5fe2bb1bf 100644 --- a/qutebrowser/browser/cookies.py +++ b/qutebrowser/browser/cookies.py @@ -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() diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 99a9f28ee..6ba1eb259 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -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."), diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 804060205..405a5ad84 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -38,7 +38,7 @@ MapType = usertypes.enum('MapType', ['attribute', 'setter', 'static_setter']) MAPPINGS = { - 'permissions': { + 'content': { 'allow-images': (MapType.attribute, QWebSettings.AutoLoadImages), 'allow-javascript': diff --git a/qutebrowser/widgets/tabbedbrowser.py b/qutebrowser/widgets/tabbedbrowser.py index b6f11d63f..66847666f 100644 --- a/qutebrowser/widgets/tabbedbrowser.py +++ b/qutebrowser/widgets/tabbedbrowser.py @@ -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): diff --git a/qutebrowser/widgets/tabwidget.py b/qutebrowser/widgets/tabwidget.py index eb301b992..9a2bb1f08 100644 --- a/qutebrowser/widgets/tabwidget.py +++ b/qutebrowser/widgets/tabwidget.py @@ -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)