diff --git a/qutebrowser/app.py b/qutebrowser/app.py index ac8f2f348..891dc0e17 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -1,7 +1,7 @@ import sys -from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, - QTabWidget, QWidget) -from qutebrowser.widgets import StatusBar, TabWidget +from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, QWidget) +from qutebrowser.widgets.statusbar import StatusBar +from qutebrowser.widgets.tabbar import TabWidget class TestWindow(QMainWindow): def __init__(self): diff --git a/qutebrowser/widgets.py b/qutebrowser/widgets/statusbar.py similarity index 57% rename from qutebrowser/widgets.py rename to qutebrowser/widgets/statusbar.py index 52e9cdb0f..842da60aa 100644 --- a/qutebrowser/widgets.py +++ b/qutebrowser/widgets/statusbar.py @@ -1,4 +1,4 @@ -from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget, QTabWidget +from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget class StatusBar(QWidget): def __init__(self, parent): @@ -17,8 +17,12 @@ class StatusBar(QWidget): self.hbox.addWidget(self.lbl) def bg_color(self, color): - self.setStyleSheet("""* {{ background: {}; color: white; font-family: - Monospace; }}""".format(color)) + self.setStyleSheet(""" + * { + background: """ + color + """; + color: white; + font-family: Monospace; + }""") class StatusText(QLabel): def __init__(self, parent): @@ -31,32 +35,3 @@ class StatusCommand(QLineEdit): super().__init__(parent) self.setObjectName(self.__class__.__name__) self.setStyleSheet("border: 0px; padding-left: 1px") - -class TabWidget(QTabWidget): - def __init__(self, parent): - super().__init__(parent) - self.setObjectName(self.__class__.__name__) - self.setStyleSheet(""" - QTabWidget::pane { - position: absolute; - top: 0px; - } - - QTabBar { - font-family: Monospace; - } - - QTabBar::tab { - background-color: grey; - color: white; - padding-left: 5px; - padding-right: 5px; - padding-top: 0px; - padding-bottom: 0px; - } - - QTabBar::tab:selected { - background-color: black; - } - """) - self.setDocumentMode(True) diff --git a/qutebrowser/widgets/tabbar.py b/qutebrowser/widgets/tabbar.py new file mode 100644 index 000000000..88c51b8b2 --- /dev/null +++ b/qutebrowser/widgets/tabbar.py @@ -0,0 +1,30 @@ +from PyQt5.QtWidgets import QTabWidget + +class TabWidget(QTabWidget): + def __init__(self, parent): + super().__init__(parent) + self.setObjectName(self.__class__.__name__) + self.setStyleSheet(""" + QTabWidget::pane { + position: absolute; + top: 0px; + } + + QTabBar { + font-family: Monospace; + } + + QTabBar::tab { + background-color: grey; + color: white; + padding-left: 5px; + padding-right: 5px; + padding-top: 0px; + padding-bottom: 0px; + } + + QTabBar::tab:selected { + background-color: black; + } + """) + self.setDocumentMode(True)