Handle statusBarMessage from WebView

This commit is contained in:
Florian Bruhin 2014-01-28 07:16:33 +01:00
parent 5df27e36a0
commit b351fdf477
3 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,8 @@ class TabbedBrowser(TabWidget):
cur_progress = pyqtSignal(int) # Progress of the current tab changed
cur_load_started = pyqtSignal() # Current tab started loading
cur_load_finished = pyqtSignal(bool) # Current tab finished loading
cur_statusbar_message = pyqtSignal(str) # Status bar message
# FIXME we need to store this in our browser object
# Current tab changed scroll position
cur_scroll_perc_changed = pyqtSignal(int, int)
keypress = pyqtSignal('QKeyEvent')
@ -37,6 +39,8 @@ class TabbedBrowser(TabWidget):
lambda *args: self._filter_signals(self.cur_load_finished, *args))
tab.loadStarted.connect(
lambda *args: self._filter_signals(self.cur_load_started, *args))
tab.statusBarMessage.connect(
lambda *args: self._filter_signals(self.cur_statusbar_message, *args))
tab.scroll_pos_changed.connect(self._scroll_pos_changed_handler)
# FIXME should we really bind this to loadStarted? Sometimes the URL
# isn't set correctly at this point, e.g. when doing

View File

@ -36,6 +36,7 @@ class MainWindow(QMainWindow):
self.tabs.cur_load_finished.connect(self.status.prog.load_finished)
self.tabs.cur_load_started.connect(lambda: self.status.prog.set_progress(0))
self.tabs.cur_scroll_perc_changed.connect(self.status.txt.set_perc)
self.tabs.cur_statusbar_message.connect(self.status.txt.set_text)
self.status.cmd.esc_pressed.connect(self.tabs.setFocus)
self.status.cmd.hide_completion.connect(self.completion.hide)
self.status.cmd.textChanged.connect(self.completion.cmd_text_changed)

View File

@ -1,3 +1,4 @@
import logging
from PyQt5.QtWidgets import QLabel
class Text(QLabel):
@ -28,6 +29,10 @@ class Text(QLabel):
else:
self.scrollperc = '[{}%]'.format(y)
def set_text(self, text):
logging.debug('Setting text to "{}"'.format(text))
self.text = text
def update(self):
"""Update the text displayed"""
self.setText(' '.join([self.keystring, self.error, self.text,