Split widgets to different files

This commit is contained in:
Florian Bruhin 2013-12-15 20:29:39 +01:00
parent 7bd7c4d84d
commit ae516f3f73
3 changed files with 40 additions and 35 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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)