Merge branch 'master' of https://github.com/dylanaraps/qutebrowser into dylanaraps-master
This commit is contained in:
commit
3506947add
@ -625,6 +625,10 @@ def data(readonly=False):
|
|||||||
"* `{id}`: The internal tab ID of this tab.\n"
|
"* `{id}`: The internal tab ID of this tab.\n"
|
||||||
"* `{scroll_pos}`: The page scroll position."),
|
"* `{scroll_pos}`: The page scroll position."),
|
||||||
|
|
||||||
|
('title-alignment',
|
||||||
|
SettingValue(typ.TextAlignment(), 'left'),
|
||||||
|
"Alignment of the text inside of tabs"),
|
||||||
|
|
||||||
('mousewheel-tab-switching',
|
('mousewheel-tab-switching',
|
||||||
SettingValue(typ.Bool(), 'true'),
|
SettingValue(typ.Bool(), 'true'),
|
||||||
"Switch between tabs using the mouse wheel."),
|
"Switch between tabs using the mouse wheel."),
|
||||||
|
@ -29,7 +29,7 @@ import collections
|
|||||||
import warnings
|
import warnings
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from PyQt5.QtCore import QUrl
|
from PyQt5.QtCore import QUrl, Qt
|
||||||
from PyQt5.QtGui import QColor, QFont
|
from PyQt5.QtGui import QColor, QFont
|
||||||
from PyQt5.QtNetwork import QNetworkProxy
|
from PyQt5.QtNetwork import QNetworkProxy
|
||||||
from PyQt5.QtWidgets import QTabWidget, QTabBar
|
from PyQt5.QtWidgets import QTabWidget, QTabBar
|
||||||
@ -1336,6 +1336,22 @@ class Position(MappingType):
|
|||||||
valid_values=ValidValues('top', 'bottom', 'left', 'right'))
|
valid_values=ValidValues('top', 'bottom', 'left', 'right'))
|
||||||
|
|
||||||
|
|
||||||
|
class TextAlignment(MappingType):
|
||||||
|
|
||||||
|
"""Alignment of text."""
|
||||||
|
|
||||||
|
MAPPING = {
|
||||||
|
'left': Qt.AlignLeft,
|
||||||
|
'right': Qt.AlignRight,
|
||||||
|
'center': Qt.AlignCenter,
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, none_ok=False):
|
||||||
|
super().__init__(
|
||||||
|
none_ok,
|
||||||
|
valid_values=ValidValues('left', 'right', 'center'))
|
||||||
|
|
||||||
|
|
||||||
class VerticalPosition(BaseType):
|
class VerticalPosition(BaseType):
|
||||||
|
|
||||||
"""The position of the download bar."""
|
"""The position of the download bar."""
|
||||||
|
@ -577,7 +577,8 @@ class TabBarStyle(QCommonStyle):
|
|||||||
elif element == QStyle.CE_TabBarTabLabel:
|
elif element == QStyle.CE_TabBarTabLabel:
|
||||||
if not opt.icon.isNull() and layouts.icon.isValid():
|
if not opt.icon.isNull() and layouts.icon.isValid():
|
||||||
self._draw_icon(layouts, opt, p)
|
self._draw_icon(layouts, opt, p)
|
||||||
alignment = Qt.AlignLeft | Qt.AlignVCenter | Qt.TextHideMnemonic
|
alignment = (config.get('tabs', 'title-alignment') |
|
||||||
|
Qt.AlignVCenter | Qt.TextHideMnemonic)
|
||||||
self._style.drawItemText(p, layouts.text, alignment, opt.palette,
|
self._style.drawItemText(p, layouts.text, alignment, opt.palette,
|
||||||
opt.state & QStyle.State_Enabled,
|
opt.state & QStyle.State_Enabled,
|
||||||
opt.text, QPalette.WindowText)
|
opt.text, QPalette.WindowText)
|
||||||
|
@ -24,6 +24,7 @@ import pytest
|
|||||||
from qutebrowser.mainwindow import tabwidget
|
from qutebrowser.mainwindow import tabwidget
|
||||||
from qutebrowser.config import configtypes
|
from qutebrowser.config import configtypes
|
||||||
from PyQt5.QtGui import QIcon, QPixmap, QFont, QColor
|
from PyQt5.QtGui import QIcon, QPixmap, QFont, QColor
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
|
|
||||||
class TestTabWidget:
|
class TestTabWidget:
|
||||||
@ -44,6 +45,7 @@ class TestTabWidget:
|
|||||||
'indicator-width': 3,
|
'indicator-width': 3,
|
||||||
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
|
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
|
||||||
'title-format': '{index}: {title}',
|
'title-format': '{index}: {title}',
|
||||||
|
'title-alignment': Qt.AlignLeft,
|
||||||
},
|
},
|
||||||
'colors': {
|
'colors': {
|
||||||
'tabs.bg.bar': QColor(),
|
'tabs.bg.bar': QColor(),
|
||||||
|
Loading…
Reference in New Issue
Block a user