diff --git a/qutebrowser/app.py b/qutebrowser/app.py index dccb7b931..d8e9b7c45 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -1,11 +1,11 @@ import sys from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, - QHBoxLayout, QTabWidget, QWidget, QLabel) -from qutebrowser.widgets import CommandEdit + QTabWidget, QWidget) +from qutebrowser.widgets import StatusBar class TestWindow(QMainWindow): def __init__(self): - super(self.__class__, self).__init__() + super().__init__() self.setObjectName(self.__class__.__name__) self.cwidget = QWidget(self) @@ -22,18 +22,9 @@ class TestWindow(QMainWindow): self.tabs.addTab(self.tab, "test") self.vbox.addWidget(self.tabs) - self.status_hbox = QHBoxLayout() - - self.status_cmd = CommandEdit(self.cwidget) - self.status_cmd.setObjectName("status_cmd") - self.status_hbox.addWidget(self.status_cmd) - - self.status_lbl = QLabel(self.cwidget) - self.status_lbl.setObjectName("status_lbl") - self.status_lbl.setText("Hello World") - self.status_hbox.addWidget(self.status_lbl) - - self.vbox.addLayout(self.status_hbox) + self.status = StatusBar(self.cwidget) + self.status.lbl.setText("Hello World") + self.vbox.addLayout(self.status) #self.retranslateUi(MainWindow) #self.tabWidget.setCurrentIndex(0) diff --git a/qutebrowser/widgets.py b/qutebrowser/widgets.py index f130cde1f..8922a0f2c 100644 --- a/qutebrowser/widgets.py +++ b/qutebrowser/widgets.py @@ -1,6 +1,24 @@ -from PyQt5.QtWidgets import QLineEdit +from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel -class CommandEdit(QLineEdit): - def __init__(self, *args, **kwargs): - super(CommandEdit, self).__init__(*args, **kwargs) +class StatusBar(QHBoxLayout): + def __init__(self, parent): + super().__init__(parent) + self.setObjectName(self.__class__.__name__) + + self.cmd = StatusCommand(parent) + self.addWidget(self.cmd) + + self.lbl = StatusText(parent) + self.addWidget(self.lbl) + +class StatusText(QLabel): + def __init__(self, parent): + super().__init__(parent) + self.setObjectName(self.__class__.__name__) + self.setStyleSheet('QLabel { background: yellow }') + +class StatusCommand(QLineEdit): + def __init__(self, parent): + super().__init__(parent) + self.setObjectName(self.__class__.__name__) self.setStyleSheet('QLineEdit { background: yellow }')