Show URL in statusbar.

This commit is contained in:
Florian Bruhin 2014-02-10 17:55:03 +01:00
parent 7486cb628a
commit d89098582f
3 changed files with 14 additions and 3 deletions

View File

@ -59,6 +59,7 @@ class TabbedBrowser(TabWidget):
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
cur_url_changed = pyqtSignal('QUrl') # Current URL changed
# Current tab changed scroll position
cur_scroll_perc_changed = pyqtSignal(int, int)
set_cmd_text = pyqtSignal(str) # Set commandline to a given text
@ -94,6 +95,7 @@ class TabbedBrowser(TabWidget):
self._filter_factory(self.cur_statusbar_message))
tab.scroll_pos_changed.connect(
self._filter_factory(self.cur_scroll_perc_changed))
tab.urlChanged.connect(self._filter_factory(self.cur_url_changed))
tab.titleChanged.connect(self._titleChanged_handler)
# FIXME sometimes this doesn't load
tab.open_tab.connect(self.tabopen)

View File

@ -68,6 +68,7 @@ class MainWindow(QMainWindow):
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.tabs.cur_url_changed.connect(self.status.txt.set_url)
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

@ -26,6 +26,7 @@ from PyQt5.QtGui import QValidator, QKeySequence
import qutebrowser.utils.config as config
import qutebrowser.commands.keys as keys
from qutebrowser.utils.url import urlstring
class StatusBar(QWidget):
@ -333,6 +334,9 @@ class Text(QLabel):
error = ''
text = ''
scrollperc = ''
url = ''
fields = ['keystring', 'url', 'error', 'text', 'scrollperc']
def __init__(self, bar):
super().__init__(bar)
@ -341,12 +345,17 @@ class Text(QLabel):
def __setattr__(self, name, value):
super().__setattr__(name, value)
self.update()
if name in self.fields:
self.update()
def set_keystring(self, s):
"""Setter to be used as a Qt slot."""
self.keystring = s
def set_url(self, s):
"""Setter to be used as a Qt slot."""
self.url = urlstring(s)
def set_perc(self, x, y):
"""Setter to be used as a Qt slot."""
# pylint: disable=unused-argument
@ -364,5 +373,4 @@ class Text(QLabel):
def update(self):
"""Update the text displayed."""
self.setText(' '.join([self.keystring, self.error, self.text,
self.scrollperc]))
self.setText(' '.join(getattr(self, name) for name in self.fields))