2014-01-29 15:30:19 +01:00
|
|
|
"""The main window of QuteBrowser."""
|
|
|
|
|
2014-01-20 15:58:49 +01:00
|
|
|
from PyQt5.QtWidgets import QMainWindow, QVBoxLayout, QWidget
|
2014-01-21 17:54:21 +01:00
|
|
|
|
2014-01-21 15:46:29 +01:00
|
|
|
from qutebrowser.widgets.statusbar import StatusBar
|
2014-01-17 10:43:50 +01:00
|
|
|
from qutebrowser.widgets.browser import TabbedBrowser
|
2014-01-27 21:35:12 +01:00
|
|
|
from qutebrowser.widgets.completion import CompletionView
|
2013-12-15 20:33:43 +01:00
|
|
|
|
2014-01-28 23:04:02 +01:00
|
|
|
|
2013-12-15 20:33:43 +01:00
|
|
|
class MainWindow(QMainWindow):
|
2014-01-29 15:30:19 +01:00
|
|
|
"""The main window of QuteBrowser.
|
|
|
|
|
|
|
|
Adds all needed components to a vbox, initializes subwidgets and connects
|
|
|
|
signals.
|
|
|
|
"""
|
2014-01-20 15:58:49 +01:00
|
|
|
cwidget = None
|
|
|
|
vbox = None
|
|
|
|
tabs = None
|
|
|
|
status = None
|
|
|
|
|
2013-12-15 20:33:43 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
2014-01-21 09:05:31 +01:00
|
|
|
|
|
|
|
self.setWindowTitle('qutebrowser')
|
2014-01-31 10:11:59 +01:00
|
|
|
# FIXME maybe store window position/size on exit
|
|
|
|
self.resize(800, 600)
|
2014-01-21 09:05:31 +01:00
|
|
|
|
2013-12-15 20:33:43 +01:00
|
|
|
self.cwidget = QWidget(self)
|
|
|
|
self.setCentralWidget(self.cwidget)
|
|
|
|
|
|
|
|
self.vbox = QVBoxLayout(self.cwidget)
|
|
|
|
self.vbox.setContentsMargins(0, 0, 0, 0)
|
|
|
|
self.vbox.setSpacing(0)
|
|
|
|
|
2013-12-15 21:40:15 +01:00
|
|
|
self.tabs = TabbedBrowser(self)
|
2013-12-15 20:33:43 +01:00
|
|
|
self.vbox.addWidget(self.tabs)
|
|
|
|
|
2014-01-27 21:35:12 +01:00
|
|
|
self.completion = CompletionView(self)
|
|
|
|
|
2014-01-19 19:41:34 +01:00
|
|
|
self.status = StatusBar(self)
|
2013-12-15 20:33:43 +01:00
|
|
|
self.vbox.addWidget(self.status)
|
|
|
|
|
2014-01-27 21:35:12 +01:00
|
|
|
self.status.resized.connect(self.completion.resize_to_bar)
|
2014-01-18 00:02:53 +01:00
|
|
|
self.tabs.cur_progress.connect(self.status.prog.set_progress)
|
2014-01-19 16:56:19 +01:00
|
|
|
self.tabs.cur_load_finished.connect(self.status.prog.load_finished)
|
2014-01-28 17:33:48 +01:00
|
|
|
self.tabs.cur_load_started.connect(lambda:
|
2014-01-28 23:04:02 +01:00
|
|
|
self.status.prog.set_progress(0))
|
2014-01-21 08:37:21 +01:00
|
|
|
self.tabs.cur_scroll_perc_changed.connect(self.status.txt.set_perc)
|
2014-01-28 07:16:33 +01:00
|
|
|
self.tabs.cur_statusbar_message.connect(self.status.txt.set_text)
|
2014-01-19 20:20:35 +01:00
|
|
|
self.status.cmd.esc_pressed.connect(self.tabs.setFocus)
|
2014-01-27 21:35:12 +01:00
|
|
|
self.status.cmd.hide_completion.connect(self.completion.hide)
|
|
|
|
self.status.cmd.textChanged.connect(self.completion.cmd_text_changed)
|
|
|
|
self.status.cmd.tab_pressed.connect(self.completion.tab_handler)
|
|
|
|
self.completion.append_cmd_text.connect(self.status.cmd.append_cmd)
|
2014-01-17 12:24:38 +01:00
|
|
|
|
2013-12-15 20:33:43 +01:00
|
|
|
#self.retranslateUi(MainWindow)
|
|
|
|
#self.tabWidget.setCurrentIndex(0)
|
|
|
|
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
|