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
|
show partial commands
|
||||||
statusbar with widgets
|
statusbar with widgets
|
||||||
scrolling simplifying
|
scrolling simplifying
|
||||||
set tab titles correctly (e.g. pyeval)
|
|
||||||
|
|
||||||
bugs:
|
bugs:
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
from PyQt5.QtWidgets import QWidget, QApplication
|
from PyQt5.QtWidgets import QWidget, QApplication
|
||||||
|
from PyQt5.QtCore import QUrl
|
||||||
from qutebrowser.widgets.mainwindow import MainWindow
|
from qutebrowser.widgets.mainwindow import MainWindow
|
||||||
from qutebrowser.commands.keys import KeyParser
|
from qutebrowser.commands.keys import KeyParser
|
||||||
import qutebrowser.commands.utils as cmdutils
|
import qutebrowser.commands.utils as cmdutils
|
||||||
@ -97,6 +98,8 @@ class QuteBrowser(QApplication):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
out = ': '.join([e.__class__.__name__, str(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 = self.mainwindow.tabs.currentWidget()
|
||||||
|
tab.setUrl(QUrl('about:pyeval'))
|
||||||
tab.setContent(out.encode('UTF-8'), 'text/plain')
|
tab.setContent(out.encode('UTF-8'), 'text/plain')
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@ class TabbedBrowser(TabWidget):
|
|||||||
self.progress_changed(tab.progress)
|
self.progress_changed(tab.progress)
|
||||||
tab.loadProgress.connect(self.progress_changed)
|
tab.loadProgress.connect(self.progress_changed)
|
||||||
tab.loadFinished.connect(self.load_finished)
|
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)
|
tab.titleChanged.connect(self.update_title)
|
||||||
|
|
||||||
def openurl(self, url):
|
def openurl(self, url):
|
||||||
@ -122,6 +126,10 @@ class TabbedBrowser(TabWidget):
|
|||||||
if text:
|
if text:
|
||||||
self.setTabText(self.indexOf(self.sender()), 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):
|
def filter_signals(self, signal, *args):
|
||||||
dbgstr = "{} ({})".format(
|
dbgstr = "{} ({})".format(
|
||||||
signal.signal, ','.join([str(e) for e in args]))
|
signal.signal, ','.join([str(e) for e in args]))
|
||||||
|
Loading…
Reference in New Issue
Block a user