Fix tab title when webpage has no title
This commit is contained in:
parent
7341193cf0
commit
a18f3f5aa5
@ -4,7 +4,6 @@ autostart
|
||||
show partial commands
|
||||
statusbar with widgets
|
||||
scrolling simplifying
|
||||
set tab titles correctly (e.g. pyeval)
|
||||
|
||||
bugs:
|
||||
|
||||
|
@ -2,6 +2,7 @@ import sys
|
||||
import argparse
|
||||
import logging
|
||||
from PyQt5.QtWidgets import QWidget, QApplication
|
||||
from PyQt5.QtCore import QUrl
|
||||
from qutebrowser.widgets.mainwindow import MainWindow
|
||||
from qutebrowser.commands.keys import KeyParser
|
||||
import qutebrowser.commands.utils as cmdutils
|
||||
@ -97,6 +98,8 @@ class QuteBrowser(QApplication):
|
||||
except Exception as e:
|
||||
out = ': '.join([e.__class__.__name__, str(e)])
|
||||
|
||||
# FIXME we probably want some nicer interface to display these about: pages
|
||||
tab = self.mainwindow.tabs.currentWidget()
|
||||
tab.setUrl(QUrl('about:pyeval'))
|
||||
tab.setContent(out.encode('UTF-8'), 'text/plain')
|
||||
|
||||
|
@ -23,6 +23,10 @@ class TabbedBrowser(TabWidget):
|
||||
self.progress_changed(tab.progress)
|
||||
tab.loadProgress.connect(self.progress_changed)
|
||||
tab.loadFinished.connect(self.load_finished)
|
||||
# FIXME should we really bind this to loadStarted? Sometimes the URL
|
||||
# isn't set correctly at this point, e.g. when doing
|
||||
# setContent(..., baseUrl=QUrl('foo'))
|
||||
tab.loadStarted.connect(self.init_title)
|
||||
tab.titleChanged.connect(self.update_title)
|
||||
|
||||
def openurl(self, url):
|
||||
@ -122,6 +126,10 @@ class TabbedBrowser(TabWidget):
|
||||
if text:
|
||||
self.setTabText(self.indexOf(self.sender()), text)
|
||||
|
||||
def init_title(self):
|
||||
s = self.sender()
|
||||
self.setTabText(self.indexOf(s), s.url().toString())
|
||||
|
||||
def filter_signals(self, signal, *args):
|
||||
dbgstr = "{} ({})".format(
|
||||
signal.signal, ','.join([str(e) for e in args]))
|
||||
|
Loading…
Reference in New Issue
Block a user