Rename and reorder config options

This commit is contained in:
Florian Bruhin 2014-04-27 21:21:14 +02:00
parent 4692414255
commit 8474bbdf6a
13 changed files with 114 additions and 107 deletions

View File

@ -461,7 +461,7 @@ class QuteBrowser(QApplication):
return return
self._shutting_down = True self._shutting_down = True
logging.debug("Shutting down... (do_quit={})".format(do_quit)) logging.debug("Shutting down... (do_quit={})".format(do_quit))
if config.get('general', 'autosave'): if config.get('general', 'auto-save-config'):
try: try:
config.instance.save() config.instance.save()
except AttributeError: except AttributeError:

View File

@ -81,9 +81,9 @@ class SearchManager(QObject):
self.do_search.emit('', 0) self.do_search.emit('', 0)
self._text = text self._text = text
self._flags = 0 self._flags = 0
if config.get('general', 'ignorecase'): if config.get('general', 'ignore-case'):
self._flags |= QWebPage.FindCaseSensitively self._flags |= QWebPage.FindCaseSensitively
if config.get('general', 'wrapsearch'): if config.get('general', 'wrap-search'):
self._flags |= QWebPage.FindWrapsAroundDocument self._flags |= QWebPage.FindWrapsAroundDocument
if rev: if rev:
self._flags |= QWebPage.FindBackward self._flags |= QWebPage.FindBackward

View File

@ -61,7 +61,7 @@ def init(configdir):
instance = ConfigManager(configdir, 'qutebrowser.conf') instance = ConfigManager(configdir, 'qutebrowser.conf')
state = ReadWriteConfigParser(configdir, 'state') state = ReadWriteConfigParser(configdir, 'state')
cmd_history = LineConfigParser(configdir, 'cmd_history', cmd_history = LineConfigParser(configdir, 'cmd_history',
('general', 'cmd_histlen')) ('completion', 'history-length'))
def get(*args, **kwargs): def get(*args, **kwargs):

View File

@ -54,13 +54,15 @@ FIRST_COMMENT = """
SECTION_DESC = { SECTION_DESC = {
'general': "General/misc. options", 'general': "General/misc. options",
'input': "Options related to input modes.",
'completion': "Options related to completion and command history .",
'tabbar': "Configuration of the tab bar.", 'tabbar': "Configuration of the tab bar.",
'webkit': "Webkit settings.", 'webkit': "Webkit settings.",
'hints': "Hinting settings.", 'hints': "Hinting settings.",
'searchengines': ( 'searchengines': (
"Definitions of search engines which can be used via the address " "Definitions of search engines which can be used via the address "
"bar.\n" "bar.\n"
"The searchengine named DEFAULT is used when general.auto_search " "The searchengine named DEFAULT is used when general.auto-search "
"is true and something else than an URL was entered to be opened. " "is true and something else than an URL was entered to be opened. "
"Other search engines can be used via the bang-syntax, e.g. " "Other search engines can be used via the bang-syntax, e.g. "
"\"qutebrowser !google\". The string \"{}\" will be replaced by the " "\"qutebrowser !google\". The string \"{}\" will be replaced by the "
@ -139,21 +141,11 @@ SECTION_DESC = {
DATA = OrderedDict([ DATA = OrderedDict([
('general', sect.KeyValue( ('general', sect.KeyValue(
('show_completion', ('ignore-case',
SettingValue(types.Bool(), 'true'),
"Whether to show the autocompletion window or not."),
('completion_height',
SettingValue(types.PercOrInt(minperc=0, maxperc=100, minint=1),
'50%'),
"The height of the completion, in px or as percentage of the "
"window."),
('ignorecase',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether to do case-insensitive searching."), "Whether to do case-insensitive searching."),
('wrapsearch', ('wrap-search',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether to wrap search to the top when arriving at the end."), "Whether to wrap search to the top when arriving at the end."),
@ -161,49 +153,64 @@ DATA = OrderedDict([
SettingValue(types.List(), 'http://www.duckduckgo.com'), SettingValue(types.List(), 'http://www.duckduckgo.com'),
"The default page(s) to open at the start, separated with commas."), "The default page(s) to open at the start, separated with commas."),
('auto_search', ('auto-search',
SettingValue(types.AutoSearch(), 'naive'), SettingValue(types.AutoSearch(), 'naive'),
"Whether to start a search when something else than an URL is " "Whether to start a search when something else than an URL is "
"entered."), "entered."),
('zoomlevels', ('zoom-levels',
SettingValue(types.PercList(minval=0), SettingValue(types.PercList(minval=0),
'25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,' '25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,'
'250%,300%,400%,500%'), '250%,300%,400%,500%'),
"The available zoom levels, separated by commas."), "The available zoom levels, separated by commas."),
('defaultzoom', ('default-zoom',
SettingValue(types.ZoomPerc(), '100%'), SettingValue(types.ZoomPerc(), '100%'),
"The default zoom level."), "The default zoom level."),
('autosave', ('auto-save-config',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether to save the config automatically on quit."), "Whether to save the config automatically on quit."),
('cmd_histlen', ('background-tabs',
SettingValue(types.Bool(), 'false'),
"Whether to open new tabs (middleclick/ctrl+click) in background"),
)),
('completion', sect.KeyValue(
('show',
SettingValue(types.Bool(), 'true'),
"Whether to show the autocompletion window or not."),
('height',
SettingValue(types.PercOrInt(minperc=0, maxperc=100, minint=1),
'50%'),
"The height of the completion, in px or as percentage of the "
"window."),
('history-length',
SettingValue(types.Int(minval=-1), '100'), SettingValue(types.Int(minval=-1), '100'),
"How many commands to save in the history. 0: no history / -1: " "How many commands to save in the history. 0: no history / -1: "
"unlimited"), "unlimited"),
('background_tabs', )),
SettingValue(types.Bool(), 'false'),
"Whether to open new tabs (middleclick/ctrl+click) in background"),
('cmd_timeout', ('input', sect.KeyValue(
('timeout',
SettingValue(types.Int(minval=0), '500'), SettingValue(types.Int(minval=0), '500'),
"Timeout for ambiguous keybindings."), "Timeout for ambiguous keybindings."),
('insert_mode_on_plugins', ('insert-mode-on-plugins',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether to switch to insert mode when clicking flash and other " "Whether to switch to insert mode when clicking flash and other "
"plugins."), "plugins."),
('auto_insert_mode', ('auto-insert-mode',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether to automatically enter insert mode if an editable element " "Whether to automatically enter insert mode if an editable element "
"is focused after page load."), "is focused after page load."),
('forward_unbound_keys', ('forward-unbound-keys',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Whether to forward unbound keys to the website in normal mode."), "Whether to forward unbound keys to the website in normal mode."),
)), )),
@ -213,11 +220,11 @@ DATA = OrderedDict([
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether tabs should be movable."), "Whether tabs should be movable."),
('closebuttons', ('close-buttons',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Whether tabs should have close-buttons."), "Whether tabs should have close-buttons."),
('scrollbuttons', ('scroll-buttons',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Whether there should be scroll buttons if there are too many tabs."), "Whether there should be scroll buttons if there are too many tabs."),
@ -225,11 +232,11 @@ DATA = OrderedDict([
SettingValue(types.Position(), 'north'), SettingValue(types.Position(), 'north'),
"The position of the tab bar."), "The position of the tab bar."),
('select_on_remove', ('select-on-remove',
SettingValue(types.SelectOnRemove(), 'previous'), SettingValue(types.SelectOnRemove(), 'previous'),
"Which tab to select when the focused tab is removed."), "Which tab to select when the focused tab is removed."),
('last_close', ('last-close',
SettingValue(types.LastClose(), 'ignore'), SettingValue(types.LastClose(), 'ignore'),
"Behaviour when the last tab is closed."), "Behaviour when the last tab is closed."),
@ -239,112 +246,112 @@ DATA = OrderedDict([
)), )),
('webkit', sect.KeyValue( ('webkit', sect.KeyValue(
('auto_load_images', ('auto-load-images',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Specifies whether images are automatically loaded in web pages."), "Specifies whether images are automatically loaded in web pages."),
('dns_prefetch_enabled', ('dns-prefetch-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether QtWebkit will try to pre-fetch DNS entries to " "Specifies whether QtWebkit will try to pre-fetch DNS entries to "
"speed up browsing."), "speed up browsing."),
('javascript_enabled', ('javascript-enabled',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Enables or disables the running of JavaScript programs."), "Enables or disables the running of JavaScript programs."),
#('java_enabled', #('java-enabled',
# SettingValue(types.Bool(), 'true'), # SettingValue(types.Bool(), 'true'),
# "Enables or disables Java applets. Currently Java applets are " # "Enables or disables Java applets. Currently Java applets are "
# "not supported"), # "not supported"),
('plugins_enabled', ('plugins-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Enables or disables plugins in Web pages"), "Enables or disables plugins in Web pages"),
('private_browsing_enabled', ('private-browsing-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Private browsing prevents WebKit from recording visited pages in " "Private browsing prevents WebKit from recording visited pages in "
"the history and storing web page icons."), "the history and storing web page icons."),
('javascript_can_open_windows', ('javascript-can-open-windows',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether JavaScript programs can open new windows."), "Specifies whether JavaScript programs can open new windows."),
('javascript_can_close_windows', ('javascript-can-close-windows',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether JavaScript programs can close windows."), "Specifies whether JavaScript programs can close windows."),
('javascript_can_access_clipboard', ('javascript-can-access-clipboard',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether JavaScript programs can read or write to the " "Specifies whether JavaScript programs can read or write to the "
"clipboard."), "clipboard."),
('developer_extras_enabled', ('developer-extras-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Enables extra tools for Web developers (e.g. webinspector)"), "Enables extra tools for Web developers (e.g. webinspector)"),
('spatial_navigation_enabled', ('spatial-navigation-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Enables or disables the Spatial Navigation feature, which consists " "Enables or disables the Spatial Navigation feature, which consists "
"in the ability to navigate between focusable elements in a Web " "in the ability to navigate between focusable elements in a Web "
"page, such as hyperlinks and form controls, by using Left, Right, " "page, such as hyperlinks and form controls, by using Left, Right, "
"Up and Down arrow keys."), "Up and Down arrow keys."),
('links_included_in_focus_chain', ('links-included-in-focus-chain',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Specifies whether hyperlinks should be included in the keyboard " "Specifies whether hyperlinks should be included in the keyboard "
"focus chain."), "focus chain."),
('zoom_text_only', ('zoom-text-only',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether the zoom factor on a frame applies only to the " "Specifies whether the zoom factor on a frame applies only to the "
"text or to all content."), "text or to all content."),
('print_element_backgrounds', ('print-element-backgrounds',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Specifies whether the background color and images are also drawn " "Specifies whether the background color and images are also drawn "
"when the page is printed. "), "when the page is printed. "),
('offline_storage_database_enabled', ('offline-storage-database-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether support for the HTML 5 offline storage feature is " "Specifies whether support for the HTML 5 offline storage feature is "
"enabled or not. "), "enabled or not. "),
('offline_web_application_storage_enabled', ('offline-web-application-storage-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether support for the HTML 5 web application cache " "Specifies whether support for the HTML 5 web application cache "
"feature is enabled or not. "), "feature is enabled or not. "),
('local_storage_enabled', ('local-storage-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether support for the HTML 5 local storage feature is " "Specifies whether support for the HTML 5 local storage feature is "
"enabled or not."), "enabled or not."),
('local_content_can_access_remote_urls', ('local-content-can-access-remote-urls',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether locally loaded documents are allowed to access " "Specifies whether locally loaded documents are allowed to access "
"remote urls."), "remote urls."),
('local_content_can_access_file_urls', ('local-content-can-access-file-urls',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"Specifies whether locally loaded documents are allowed to access " "Specifies whether locally loaded documents are allowed to access "
"other local urls."), "other local urls."),
('xss_auditing_enabled', ('xss-auditing-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"Specifies whether load requests should be monitored for cross-site " "Specifies whether load requests should be monitored for cross-site "
"scripting attempts. Suspicious scripts will be blocked and reported " "scripting attempts. Suspicious scripts will be blocked and reported "
"in the inspector's JavaScript console. Enabling this feature might " "in the inspector's JavaScript console. Enabling this feature might "
"have an impact on performance."), "have an impact on performance."),
#('accelerated_compositing_enabled', #('accelerated-compositing-enabled',
# SettingValue(types.Bool(), 'true'), # SettingValue(types.Bool(), 'true'),
# "This feature, when used in conjunction with QGraphicsWebView, " # "This feature, when used in conjunction with QGraphicsWebView, "
# "accelerates animations of web content. CSS animations of the " # "accelerates animations of web content. CSS animations of the "
# "transform and opacity properties will be rendered by composing the " # "transform and opacity properties will be rendered by composing the "
# "cached content of the animated elements. "), # "cached content of the animated elements. "),
#('tiled_backing_store_enabled', #('tiled-backing-store-enabled',
# SettingValue(types.Bool(), 'false'), # SettingValue(types.Bool(), 'false'),
# "This setting enables the tiled backing store feature for a " # "This setting enables the tiled backing store feature for a "
# "QGraphicsWebView. With the tiled backing store enabled, the web " # "QGraphicsWebView. With the tiled backing store enabled, the web "
@ -354,13 +361,13 @@ DATA = OrderedDict([
# "significantly speed up painting heavy operations like scrolling. " # "significantly speed up painting heavy operations like scrolling. "
# "Enabling the feature increases memory consuption."), # "Enabling the feature increases memory consuption."),
('frame_flattening_enabled', ('frame-flattening-enabled',
SettingValue(types.Bool(), 'false'), SettingValue(types.Bool(), 'false'),
"With this setting each subframe is expanded to its contents. This " "With this setting each subframe is expanded to its contents. This "
"will flatten all the frames to become one scrollable " "will flatten all the frames to become one scrollable "
"page."), "page."),
('site_specific_quirks_enabled', ('site-specific-quirks-enabled',
SettingValue(types.Bool(), 'true'), SettingValue(types.Bool(), 'true'),
"This setting enables WebKit's workaround for broken sites."), "This setting enables WebKit's workaround for broken sites."),
)), )),

View File

@ -31,36 +31,36 @@ import qutebrowser.config.config as config
MAPPING = { MAPPING = {
# noqa # noqa
'auto_load_images': QWebSettings.AutoLoadImages, 'auto-load-images': QWebSettings.AutoLoadImages,
'dns_prefetch_enabled': QWebSettings.DnsPrefetchEnabled, 'dns-prefetch-enabled': QWebSettings.DnsPrefetchEnabled,
'javascript_enabled': QWebSettings.JavascriptEnabled, 'javascript-enabled': QWebSettings.JavascriptEnabled,
#'java_enabled': #QWebSettings.JavaEnabled, #'java-enabled': #QWebSettings.JavaEnabled,
'plugins_enabled': QWebSettings.PluginsEnabled, 'plugins-enabled': QWebSettings.PluginsEnabled,
'private_browsing_enabled': QWebSettings.PrivateBrowsingEnabled, 'private-browsing-enabled': QWebSettings.PrivateBrowsingEnabled,
'javascript_can_open_windows': QWebSettings.JavascriptCanOpenWindows, 'javascript-can-open-windows': QWebSettings.JavascriptCanOpenWindows,
'javascript_can_close_windows': QWebSettings.JavascriptCanCloseWindows, 'javascript-can-close-windows': QWebSettings.JavascriptCanCloseWindows,
'javascript_can_access_clipboard': 'javascript-can-access-clipboard':
QWebSettings.JavascriptCanAccessClipboard, QWebSettings.JavascriptCanAccessClipboard,
'developer_extras_enabled': QWebSettings.DeveloperExtrasEnabled, 'developer-extras-enabled': QWebSettings.DeveloperExtrasEnabled,
'spatial_navigation_enabled': QWebSettings.SpatialNavigationEnabled, 'spatial-navigation-enabled': QWebSettings.SpatialNavigationEnabled,
'links_included_in_focus_chain': QWebSettings.LinksIncludedInFocusChain, 'links-included-in-focus-chain': QWebSettings.LinksIncludedInFocusChain,
'zoom_text_only': QWebSettings.ZoomTextOnly, 'zoom-text-only': QWebSettings.ZoomTextOnly,
'print_element_backgrounds': QWebSettings.PrintElementBackgrounds, 'print-element-backgrounds': QWebSettings.PrintElementBackgrounds,
'offline_storage_database_enabled': 'offline-storage-database-enabled':
QWebSettings.OfflineStorageDatabaseEnabled, QWebSettings.OfflineStorageDatabaseEnabled,
'offline_web_application_storage_enabled': 'offline-web-application-storage-enabled':
QWebSettings.OfflineWebApplicationCacheEnabled, QWebSettings.OfflineWebApplicationCacheEnabled,
'local_storage_enabled': QWebSettings.LocalStorageEnabled, 'local-storage-enabled': QWebSettings.LocalStorageEnabled,
'local_content_can_access_remote_urls': 'local-content-can-access-remote-urls':
QWebSettings.LocalContentCanAccessRemoteUrls, QWebSettings.LocalContentCanAccessRemoteUrls,
'local_content_can_access_file_urls': 'local-content-can-access-file-urls':
QWebSettings.LocalContentCanAccessFileUrls, QWebSettings.LocalContentCanAccessFileUrls,
'xss_auditing_enabled': QWebSettings.XSSAuditingEnabled, 'xss-auditing-enabled': QWebSettings.XSSAuditingEnabled,
#'accelerated_compositing_enabled': #'accelerated-compositing-enabled':
# QWebSettings.AcceleratedCompositingEnabled, # QWebSettings.AcceleratedCompositingEnabled,
#'tiled_backing_store_enabled': QWebSettings.TiledBackingStoreEnabled, #'tiled-backing-store-enabled': QWebSettings.TiledBackingStoreEnabled,
'frame_flattening_enabled': QWebSettings.FrameFlatteningEnabled, 'frame-flattening-enabled': QWebSettings.FrameFlatteningEnabled,
'site_specific_quirks_enabled': QWebSettings.SiteSpecificQuirksEnabled, 'site-specific-quirks-enabled': QWebSettings.SiteSpecificQuirksEnabled,
} }
settings = None settings = None

View File

@ -245,7 +245,7 @@ class BaseKeyParser(QObject):
count: The count to pass. count: The count to pass.
""" """
logging.debug("Ambiguous match for \"{}\"".format(self._keystring)) logging.debug("Ambiguous match for \"{}\"".format(self._keystring))
time = config.get('general', 'cmd_timeout') time = config.get('input', 'timeout')
if time == 0: if time == 0:
# execute immediately # execute immediately
self._keystring = '' self._keystring = ''

View File

@ -98,8 +98,8 @@ class ModeManager(QObject):
self.passthrough = [] self.passthrough = []
self._mode_stack = [] self._mode_stack = []
self._releaseevents_to_pass = [] self._releaseevents_to_pass = []
self._forward_unbound_keys = config.get('general', self._forward_unbound_keys = config.get('input',
'forward_unbound_keys') 'forward-unbound-keys')
@property @property
def mode(self): def mode(self):
@ -132,7 +132,7 @@ class ModeManager(QObject):
if not filter_this: if not filter_this:
self._releaseevents_to_pass.append(event) self._releaseevents_to_pass.append(event)
logging.debug("handled: {}, forward_unbound_keys: {}, passthrough: {} " logging.debug("handled: {}, forward-unbound-keys: {}, passthrough: {} "
"--> filter: {}".format(handled, "--> filter: {}".format(handled,
self._forward_unbound_keys, self._forward_unbound_keys,
self.mode in self.passthrough, self.mode in self.passthrough,
@ -220,9 +220,9 @@ class ModeManager(QObject):
@pyqtSlot(str, str) @pyqtSlot(str, str)
def on_config_changed(self, section, option): def on_config_changed(self, section, option):
"""Update local setting when config changed.""" """Update local setting when config changed."""
if (section, option) == ('general', 'forward_unbound_keys'): if (section, option) == ('input', 'forward-unbound-keys'):
self._forward_unbound_keys = config.get('general', self._forward_unbound_keys = config.get('input',
'forward_unbound_keys') 'forward-unbound-keys')
def eventFilter(self, obj, event): def eventFilter(self, obj, event):
"""Filter all events based on the currently set mode. """Filter all events based on the currently set mode.

View File

@ -164,7 +164,7 @@ def is_url(url):
""" """
urlstr = urlstring(url) urlstr = urlstring(url)
autosearch = config.get('general', 'auto_search') autosearch = config.get('general', 'auto-search')
logging.debug("Checking if '{}' is an URL (autosearch={}).".format( logging.debug("Checking if '{}' is an URL (autosearch={}).".format(
urlstr, autosearch)) urlstr, autosearch))

View File

@ -105,7 +105,7 @@ class CompletionView(QTreeView):
def __init__(self, parent=None): def __init__(self, parent=None):
super().__init__(parent) super().__init__(parent)
self._enabled = config.get('general', 'show_completion') self._enabled = config.get('completion', 'show')
self._model = None self._model = None
self._lastmodel = None self._lastmodel = None
self._completion_models = { self._completion_models = {
@ -241,8 +241,8 @@ class CompletionView(QTreeView):
@pyqtSlot(str, str) @pyqtSlot(str, str)
def on_config_changed(self, section, option): def on_config_changed(self, section, option):
"""Update self._enabled when the config changed.""" """Update self._enabled when the config changed."""
if section == 'general' and option == 'show_completion': if section == 'completion' and option == 'show':
self._enabled = config.get('general', 'show_completion') self._enabled = config.get('completion', 'show')
@pyqtSlot(str) @pyqtSlot(str)
def on_cmd_text_changed(self, text): def on_cmd_text_changed(self, text):

View File

@ -188,14 +188,14 @@ class TabbedBrowser(TabWidget):
count: The tab index to close, or None count: The tab index to close, or None
Emit: Emit:
quit: If last tab was closed and last_close in config is set to quit: If last tab was closed and last-close in config is set to
quit. quit.
""" """
idx = self.currentIndex() if count is None else count - 1 idx = self.currentIndex() if count is None else count - 1
tab = self.cntwidget(count) tab = self.cntwidget(count)
if tab is None: if tab is None:
return return
last_close = config.get('tabbar', 'last_close') last_close = config.get('tabbar', 'last-close')
if self.count() > 1: if self.count() > 1:
self._url_stack.append(tab.url()) self._url_stack.append(tab.url())
self.removeTab(idx) self.removeTab(idx)

View File

@ -80,10 +80,10 @@ class TabWidget(QTabWidget):
'previous': QTabBar.SelectPreviousTab, 'previous': QTabBar.SelectPreviousTab,
} }
self.setMovable(config.get('tabbar', 'movable')) self.setMovable(config.get('tabbar', 'movable'))
self.setTabsClosable(config.get('tabbar', 'closebuttons')) self.setTabsClosable(config.get('tabbar', 'close-buttons'))
self.setUsesScrollButtons(config.get('tabbar', 'scrollbuttons')) self.setUsesScrollButtons(config.get('tabbar', 'scroll-buttons'))
posstr = config.get('tabbar', 'position') posstr = config.get('tabbar', 'position')
selstr = config.get('tabbar', 'select_on_remove') selstr = config.get('tabbar', 'select-on-remove')
try: try:
self.setTabPosition(position_conv[posstr]) self.setTabPosition(position_conv[posstr])
self.tabBar().setSelectionBehaviorOnRemove(select_conv[selstr]) self.tabBar().setSelectionBehaviorOnRemove(select_conv[selstr])

View File

@ -88,12 +88,12 @@ class MainWindow(QWidget):
@pyqtSlot(str, str) @pyqtSlot(str, str)
def on_config_changed(self, section, option): def on_config_changed(self, section, option):
"""Resize completion if config changed.""" """Resize completion if config changed."""
if section == 'general' and option == 'completion_height': if section == 'completion' and option == 'height':
self.resize_completion() self.resize_completion()
def resize_completion(self): def resize_completion(self):
"""Adjust completion according to config.""" """Adjust completion according to config."""
confheight = str(config.get('general', 'completion_height')) confheight = str(config.get('completion', 'height'))
if confheight.endswith('%'): if confheight.endswith('%'):
perc = int(confheight.rstrip('%')) perc = int(confheight.rstrip('%'))
height = self.height() * perc / 100 height = self.height() * perc / 100
@ -115,7 +115,7 @@ class MainWindow(QWidget):
self.inspector.hide() self.inspector.hide()
self.resize_completion() self.resize_completion()
else: else:
if not config.get('webkit', 'developer_extras_enabled'): if not config.get('webkit', 'developer-extras-enabled'):
self.status.disp_error("Please enable developer-extras before " self.status.disp_error("Please enable developer-extras before "
"using the webinspector!") "using the webinspector!")
else: else:

View File

@ -93,8 +93,8 @@ class WebView(QWebView):
def _init_neighborlist(self): def _init_neighborlist(self):
"""Initialize the _zoom neighborlist.""" """Initialize the _zoom neighborlist."""
self._zoom = NeighborList( self._zoom = NeighborList(
config.get('general', 'zoomlevels'), config.get('general', 'zoom-levels'),
default=config.get('general', 'defaultzoom'), default=config.get('general', 'default-zoom'),
mode=NeighborList.BLOCK) mode=NeighborList.BLOCK)
def _on_destroyed(self, sender): def _on_destroyed(self, sender):
@ -123,7 +123,7 @@ class WebView(QWebView):
if hitresult.isContentEditable(): if hitresult.isContentEditable():
# text fields and the like # text fields and the like
return True return True
if not config.get('general', 'insert_mode_on_plugins'): if not config.get('input', 'insert-mode-on-plugins'):
return False return False
elem = hitresult.element() elem = hitresult.element()
tag = elem.tagName().lower() tag = elem.tagName().lower()
@ -236,7 +236,7 @@ class WebView(QWebView):
@pyqtSlot(str, str) @pyqtSlot(str, str)
def on_config_changed(self, section, option): def on_config_changed(self, section, option):
"""Update tab config when config was changed.""" """Update tab config when config was changed."""
if section == 'general' and option in ['zoomlevels', 'defaultzoom']: if section == 'general' and option in ['zoom-levels', 'default-zoom']:
self._init_neighborlist() self._init_neighborlist()
@pyqtSlot('QMouseEvent') @pyqtSlot('QMouseEvent')
@ -247,8 +247,8 @@ class WebView(QWebView):
@pyqtSlot(bool) @pyqtSlot(bool)
def on_load_finished(self, _ok): def on_load_finished(self, _ok):
"""Handle auto_insert_mode after loading finished.""" """Handle auto-insert-mode after loading finished."""
if not config.get('general', 'auto_insert_mode'): if not config.get('input', 'auto-insert-mode'):
return return
frame = self.page_.currentFrame() frame = self.page_.currentFrame()
elem = frame.findFirstElement( elem = frame.findFirstElement(
@ -334,7 +334,7 @@ class WebView(QWebView):
self._open_target)) self._open_target))
elif (e.button() == Qt.MidButton or elif (e.button() == Qt.MidButton or
e.modifiers() & Qt.ControlModifier): e.modifiers() & Qt.ControlModifier):
if config.get('general', 'background_tabs'): if config.get('general', 'background-tabs'):
self._open_target = "bgtab" self._open_target = "bgtab"
else: else:
self._open_target = "tab" self._open_target = "tab"