Reorder tab stuff in config.
This commit is contained in:
parent
1217ed26ad
commit
13b6fe24eb
@ -534,7 +534,7 @@ class CommandDispatcher:
|
||||
newidx = self._tabs.currentIndex() - count
|
||||
if newidx >= 0:
|
||||
self._tabs.setCurrentIndex(newidx)
|
||||
elif config.get('tabbar', 'wrap'):
|
||||
elif config.get('tabs', 'wrap'):
|
||||
self._tabs.setCurrentIndex(newidx % self._tabs.count())
|
||||
else:
|
||||
raise CommandError("First tab")
|
||||
@ -549,7 +549,7 @@ class CommandDispatcher:
|
||||
newidx = self._tabs.currentIndex() + count
|
||||
if newidx < self._tabs.count():
|
||||
self._tabs.setCurrentIndex(newidx)
|
||||
elif config.get('tabbar', 'wrap'):
|
||||
elif config.get('tabs', 'wrap'):
|
||||
self._tabs.setCurrentIndex(newidx % self._tabs.count())
|
||||
else:
|
||||
raise CommandError("Last tab")
|
||||
|
@ -67,7 +67,7 @@ SECTION_DESC = {
|
||||
'input': "Options related to input modes.",
|
||||
'network': "Settings related to the network.",
|
||||
'completion': "Options related to completion and command history.",
|
||||
'tabbar': "Configuration of the tab bar.",
|
||||
'tabs': "Configuration of the tab bar.",
|
||||
'storage': "Settings related to cache and storage.",
|
||||
'permissions': "Loaded plugins/scripts and allowed actions.",
|
||||
'hints': "Hinting settings.",
|
||||
@ -191,10 +191,6 @@ DATA = OrderedDict([
|
||||
SettingValue(types.Bool(), 'true'),
|
||||
"Whether to save the config automatically on quit."),
|
||||
|
||||
('background-tabs',
|
||||
SettingValue(types.Bool(), 'false'),
|
||||
"Whether to open new tabs (middleclick/ctrl+click) in background."),
|
||||
|
||||
('editor',
|
||||
SettingValue(types.ShellCommand(placeholder=True), 'gvim -f "{}"'),
|
||||
"The editor (and arguments) to use for the `open-editor` command.\n\n"
|
||||
@ -373,18 +369,10 @@ DATA = OrderedDict([
|
||||
"chain."),
|
||||
)),
|
||||
|
||||
('tabbar', sect.KeyValue(
|
||||
('movable',
|
||||
SettingValue(types.Bool(), 'true'),
|
||||
"Whether tabs should be movable."),
|
||||
|
||||
('close-mouse-button',
|
||||
SettingValue(types.CloseButton(), 'middle'),
|
||||
"On which mouse button to close tabs."),
|
||||
|
||||
('position',
|
||||
SettingValue(types.Position(), 'north'),
|
||||
"The position of the tab bar."),
|
||||
('tabs', sect.KeyValue(
|
||||
('background-tabs',
|
||||
SettingValue(types.Bool(), 'false'),
|
||||
"Whether to open new tabs (middleclick/ctrl+click) in background."),
|
||||
|
||||
('select-on-remove',
|
||||
SettingValue(types.SelectOnRemove(), 'previous'),
|
||||
@ -406,6 +394,18 @@ DATA = OrderedDict([
|
||||
SettingValue(types.Bool(), 'true'),
|
||||
"Whether to wrap when changing tabs."),
|
||||
|
||||
('movable',
|
||||
SettingValue(types.Bool(), 'true'),
|
||||
"Whether tabs should be movable."),
|
||||
|
||||
('close-mouse-button',
|
||||
SettingValue(types.CloseButton(), 'middle'),
|
||||
"On which mouse button to close tabs."),
|
||||
|
||||
('position',
|
||||
SettingValue(types.Position(), 'north'),
|
||||
"The position of the tab bar."),
|
||||
|
||||
('show-favicons',
|
||||
SettingValue(types.Bool(), 'true'),
|
||||
"Whether to show favicons in the tab bar."),
|
||||
|
@ -236,7 +236,7 @@ class TabbedBrowser(TabWidget):
|
||||
Args:
|
||||
tab: The QWebView to be closed.
|
||||
"""
|
||||
last_close = config.get('tabbar', 'last-close')
|
||||
last_close = config.get('tabs', 'last-close')
|
||||
if self.count() > 1:
|
||||
self._remove_tab(tab)
|
||||
elif last_close == 'quit':
|
||||
@ -327,9 +327,9 @@ class TabbedBrowser(TabWidget):
|
||||
self._connect_tab_signals(tab)
|
||||
self._tabs.append(tab)
|
||||
if explicit:
|
||||
pos = config.get('tabbar', 'new-tab-position-explicit')
|
||||
pos = config.get('tabs', 'new-tab-position-explicit')
|
||||
else:
|
||||
pos = config.get('tabbar', 'new-tab-position')
|
||||
pos = config.get('tabs', 'new-tab-position')
|
||||
if pos == 'left':
|
||||
idx = self._tab_insert_idx_left
|
||||
# On first sight, we'd think we have to decrement
|
||||
@ -355,7 +355,7 @@ class TabbedBrowser(TabWidget):
|
||||
if url is not None:
|
||||
tab.openurl(url)
|
||||
if background is None:
|
||||
background = config.get('general', 'background-tabs')
|
||||
background = config.get('tabs', 'background-tabs')
|
||||
if not background:
|
||||
self.setCurrentWidget(tab)
|
||||
tab.show()
|
||||
@ -393,7 +393,7 @@ class TabbedBrowser(TabWidget):
|
||||
for tab in self._tabs:
|
||||
tab.on_config_changed(section, option)
|
||||
if (section, option) == ('tabbar', 'show-favicons'):
|
||||
show = config.get('tabbar', 'show-favicons')
|
||||
show = config.get('tabs', 'show-favicons')
|
||||
for i, tab in enumerate(self.widgets):
|
||||
if show:
|
||||
self.setTabIcon(i, tab.icon())
|
||||
@ -479,7 +479,7 @@ class TabbedBrowser(TabWidget):
|
||||
Args:
|
||||
tab: The WebView where the title was changed.
|
||||
"""
|
||||
if not config.get('tabbar', 'show-favicons'):
|
||||
if not config.get('tabs', 'show-favicons'):
|
||||
return
|
||||
try:
|
||||
idx = self.indexOf(tab)
|
||||
|
@ -69,10 +69,10 @@ class TabWidget(QTabWidget):
|
||||
'previous': QTabBar.SelectPreviousTab,
|
||||
}
|
||||
tabbar = self.tabBar()
|
||||
self.setMovable(config.get('tabbar', 'movable'))
|
||||
self.setMovable(config.get('tabs', 'movable'))
|
||||
self.setTabsClosable(False)
|
||||
posstr = config.get('tabbar', 'position')
|
||||
selstr = config.get('tabbar', 'select-on-remove')
|
||||
posstr = config.get('tabs', 'position')
|
||||
selstr = config.get('tabs', 'select-on-remove')
|
||||
position = position_conv[posstr]
|
||||
self.setTabPosition(position)
|
||||
tabbar.vertical = position in (QTabWidget.West, QTabWidget.East)
|
||||
@ -141,7 +141,7 @@ class TabBar(QTabBar):
|
||||
|
||||
def mousePressEvent(self, e):
|
||||
"""Override mousePressEvent to close tabs if configured."""
|
||||
button = config.get('tabbar', 'close-mouse-button')
|
||||
button = config.get('tabs', 'close-mouse-button')
|
||||
if (e.button() == Qt.RightButton and button == 'right' or
|
||||
e.button() == Qt.MiddleButton and button == 'middle'):
|
||||
idx = self.tabAt(e.pos())
|
||||
@ -196,7 +196,7 @@ class TabBar(QTabBar):
|
||||
minimum_size = self.minimumTabSizeHint(index)
|
||||
height = self.fontMetrics().height()
|
||||
if self.vertical:
|
||||
confwidth = str(config.get('tabbar', 'width'))
|
||||
confwidth = str(config.get('tabs', 'width'))
|
||||
if confwidth.endswith('%'):
|
||||
perc = int(confwidth.rstrip('%'))
|
||||
width = QApplication.instance().mainwindow.width() * perc / 100
|
||||
@ -299,10 +299,10 @@ class TabBarStyle(QCommonStyle):
|
||||
elif element == QStyle.CE_TabBarTabShape:
|
||||
p.fillRect(opt.rect, opt.palette.window())
|
||||
indicator_color = opt.palette.base().color()
|
||||
indicator_width = config.get('tabbar', 'indicator-width')
|
||||
indicator_width = config.get('tabs', 'indicator-width')
|
||||
if indicator_color.isValid() and indicator_width != 0:
|
||||
topleft = opt.rect.topLeft()
|
||||
topleft += QPoint(config.get('tabbar', 'indicator-space'), 2)
|
||||
topleft += QPoint(config.get('tabs', 'indicator-space'), 2)
|
||||
p.fillRect(topleft.x(), topleft.y(), indicator_width,
|
||||
opt.rect.height() - 4, indicator_color)
|
||||
# We use super() rather than self._style here because we don't want
|
||||
@ -383,11 +383,11 @@ class TabBarStyle(QCommonStyle):
|
||||
icon_rect = QRect()
|
||||
text_rect = QRect(opt.rect)
|
||||
qt_ensure_valid(text_rect)
|
||||
indicator_width = config.get('tabbar', 'indicator-width')
|
||||
indicator_width = config.get('tabs', 'indicator-width')
|
||||
text_rect.adjust(padding, 0, 0, 0)
|
||||
if indicator_width != 0:
|
||||
text_rect.adjust(indicator_width +
|
||||
config.get('tabbar', 'indicator-space'), 0, 0, 0)
|
||||
config.get('tabs', 'indicator-space'), 0, 0, 0)
|
||||
if not opt.icon.isNull():
|
||||
icon_rect = self._get_icon_rect(opt, text_rect)
|
||||
text_rect.adjust(icon_rect.width() + padding, 0, 0, 0)
|
||||
|
@ -266,7 +266,7 @@ class WebView(QWebView):
|
||||
self.open_target))
|
||||
elif (e.button() == Qt.MidButton or
|
||||
e.modifiers() & Qt.ControlModifier):
|
||||
if config.get('general', 'background-tabs'):
|
||||
if config.get('tabs', 'background-tabs'):
|
||||
self.open_target = ClickTarget.tab_bg
|
||||
else:
|
||||
self.open_target = ClickTarget.tab
|
||||
|
Loading…
Reference in New Issue
Block a user