Move main window logic to mainwindow.py

This commit is contained in:
Florian Bruhin 2013-12-15 20:33:43 +01:00
parent ae516f3f73
commit fbe968af73
2 changed files with 41 additions and 38 deletions

View File

@ -1,43 +1,17 @@
import sys
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):
super().__init__()
self.setObjectName(self.__class__.__name__)
self.cwidget = QWidget(self)
self.cwidget.setObjectName("cwidget")
self.setCentralWidget(self.cwidget)
self.vbox = QVBoxLayout(self.cwidget)
self.vbox.setObjectName("vbox")
self.vbox.setContentsMargins(0, 0, 0, 0)
self.vbox.setSpacing(0)
self.tabs = TabWidget(self.cwidget)
self.tabs.setObjectName("tabs")
self.tab = QWidget()
self.tab2 = QWidget()
self.tab.setObjectName("tab")
self.tab2.setObjectName("tab2")
self.tabs.addTab(self.tab, "test")
self.tabs.addTab(self.tab2, "test2")
self.vbox.addWidget(self.tabs)
self.status = StatusBar(self.cwidget)
self.status.lbl.setText("Hello World")
self.vbox.addWidget(self.status)
#self.retranslateUi(MainWindow)
#self.tabWidget.setCurrentIndex(0)
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.show()
from PyQt5.QtWidgets import QWidget, QApplication
from qutebrowser.widgets.mainwindow import MainWindow
def main():
app = QApplication(sys.argv)
tw = TestWindow()
mw = MainWindow()
tab = QWidget()
tab2 = QWidget()
tab.setObjectName("tab")
tab2.setObjectName("tab2")
mw.tabs.addTab(tab, "test")
mw.tabs.addTab(tab2, "test2")
mw.show()
sys.exit(app.exec_())

View File

@ -0,0 +1,29 @@
from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, QWidget)
from qutebrowser.widgets.statusbar import StatusBar
from qutebrowser.widgets.tabbar import TabWidget
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setObjectName(self.__class__.__name__)
self.cwidget = QWidget(self)
self.cwidget.setObjectName("cwidget")
self.setCentralWidget(self.cwidget)
self.vbox = QVBoxLayout(self.cwidget)
self.vbox.setObjectName("vbox")
self.vbox.setContentsMargins(0, 0, 0, 0)
self.vbox.setSpacing(0)
self.tabs = TabWidget(self.cwidget)
self.tabs.setObjectName("tabs")
self.vbox.addWidget(self.tabs)
self.status = StatusBar(self.cwidget)
self.status.lbl.setText("Hello World")
self.vbox.addWidget(self.status)
#self.retranslateUi(MainWindow)
#self.tabWidget.setCurrentIndex(0)
#QtCore.QMetaObject.connectSlotsByName(MainWindow)