qutebrowser/qutebrowser/widgets/tabbar.py
2014-01-30 22:29:26 +01:00

54 lines
1.4 KiB
Python

"""The tab widget used for TabbedBrowser from browser.py."""
from PyQt5.QtWidgets import QTabWidget, QSizePolicy
from PyQt5.QtCore import Qt
import qutebrowser.utils.config as config
class TabWidget(QTabWidget):
"""The tabwidget used for TabbedBrowser."""
# FIXME there is still some ugly 1px white stripe from somewhere if we do
# background-color: grey for QTabBar...
_stylesheet = """
QTabWidget::pane {{
position: absolute;
top: 0px;
}}
QTabBar {{
font-family: {monospace};
font-size: 8pt;
height: 13px;
}}
QTabBar::tab {{
{color[tab.bg]}
{color[tab.fg]}
padding-left: 5px;
padding-right: 5px;
padding-top: 0px;
padding-bottom: 0px;
}}
QTabBar::tab:first, QTabBar::tab:middle {{
border-right: 1px solid {color[tab.seperator]};
}}
QTabBar::tab:selected {{
{color[tab.bg.selected]}
}}
"""
def __init__(self, parent):
# FIXME export some settings (TabPosition, tabsClosable,
# usesScrollButtons)
super().__init__(parent)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
self.setDocumentMode(True)
self.setMovable(True)
self.setElideMode(Qt.ElideRight)