Remove support for showing JS statusbar messages

Closes #1579.
This commit is contained in:
Florian Bruhin 2016-07-11 16:19:44 +02:00
parent d0aea24568
commit e80475ed57
10 changed files with 14 additions and 60 deletions

View File

@ -35,6 +35,12 @@ Changed
- Aliases can now use `;;` to have an alias which executed multiple commands.
- `:edit-url` now does nothing if the URL isn't changed in the spawned editor.
Removed
-------
- The ability to display status messages from webpages, as well as the related
`ui -> display-statusbar-messages` setting.
Fixed
-----

View File

@ -37,7 +37,6 @@
|<<ui-message-timeout,message-timeout>>|Time (in ms) to show messages in the statusbar for.
|<<ui-message-unfocused,message-unfocused>>|Whether to show messages in unfocused windows.
|<<ui-confirm-quit,confirm-quit>>|Whether to confirm quitting the application.
|<<ui-display-statusbar-messages,display-statusbar-messages>>|Whether to display javascript statusbar messages.
|<<ui-zoom-text-only,zoom-text-only>>|Whether the zoom factor on a frame applies only to the text or to all content.
|<<ui-frame-flattening,frame-flattening>>|Whether to expand each subframe to its contents.
|<<ui-user-stylesheet,user-stylesheet>>|User stylesheet to use (absolute filename, filename relative to the config directory or CSS string). Will expand environment variables.
@ -558,17 +557,6 @@ Valid values:
Default: +pass:[never]+
[[ui-display-statusbar-messages]]
=== display-statusbar-messages
Whether to display javascript statusbar messages.
Valid values:
* +true+
* +false+
Default: +pass:[false]+
[[ui-zoom-text-only]]
=== zoom-text-only
Whether the zoom factor on a frame applies only to the text or to all content.

View File

@ -40,8 +40,7 @@ class SignalFilter(QObject):
BLACKLIST: List of signal names which should not be logged.
"""
BLACKLIST = ['cur_scroll_perc_changed', 'cur_progress',
'cur_statusbar_message', 'cur_link_hovered']
BLACKLIST = ['cur_scroll_perc_changed', 'cur_progress', 'cur_link_hovered']
def __init__(self, win_id, parent=None):
super().__init__(parent)

View File

@ -42,7 +42,6 @@ class WebView(QWebView):
tab: The WebKitTab object for this WebView
hintmanager: The HintManager instance for this view.
scroll_pos: The current scroll position as (x%, y%) tuple.
statusbar_message: The current javascript statusbar message.
win_id: The window ID of the view.
_tab_id: The tab ID of the view.
_old_scroll_pos: The old scroll position.
@ -75,7 +74,6 @@ class WebView(QWebView):
self.win_id = win_id
self._check_insertmode = False
self.scroll_pos = (-1, -1)
self.statusbar_message = ''
self._old_scroll_pos = (-1, -1)
self._ignore_wheel_event = False
self._set_bg_color()
@ -116,8 +114,6 @@ class WebView(QWebView):
page.mainFrame().loadFinished.connect(self.on_load_finished)
page.mainFrame().initialLayoutCompleted.connect(
self.on_initial_layout_completed)
page.statusBarMessage.connect(
lambda msg: setattr(self, 'statusbar_message', msg))
return page
def __repr__(self):

View File

@ -351,6 +351,7 @@ class ConfigManager(QObject):
('tabs', 'hide-auto'),
('tabs', 'auto-hide'),
('tabs', 'hide-always'),
('ui', 'display-statusbar-messages'),
]
CHANGED_OPTIONS = {
('content', 'cookies-accept'):

View File

@ -288,10 +288,6 @@ def data(readonly=False):
SettingValue(typ.ConfirmQuit(), 'never'),
"Whether to confirm quitting the application."),
('display-statusbar-messages',
SettingValue(typ.Bool(), 'false'),
"Whether to display javascript statusbar messages."),
('zoom-text-only',
SettingValue(typ.Bool(), 'false'),
"Whether the zoom factor on a frame applies only to the text or "

View File

@ -345,9 +345,6 @@ class MainWindow(QWidget):
tabs.tab_index_changed.connect(status.tabindex.on_tab_index_changed)
tabs.cur_statusbar_message.connect(status.txt.on_statusbar_message)
tabs.cur_load_started.connect(status.txt.on_load_started)
tabs.current_tab_changed.connect(status.url.on_tab_changed)
tabs.cur_url_changed.connect(status.url.set_url)
tabs.cur_link_hovered.connect(status.url.set_hover_url)

View File

@ -34,20 +34,17 @@ class Text(textbase.TextBase):
Attributes:
_normaltext: The "permanent" text. Never automatically cleared.
_temptext: The temporary text to display.
_jstext: The text javascript wants to display.
The temptext is shown from StatusBar when a temporary text or error is
available. If not, the permanent text is shown.
"""
Text = usertypes.enum('Text', ['normal', 'temp', 'js'])
Text = usertypes.enum('Text', ['normal', 'temp'])
def __init__(self, parent=None):
super().__init__(parent)
self._normaltext = ''
self._temptext = ''
self._jstext = ''
objreg.get('config').changed.connect(self.update_text)
def set_text(self, which, text):
"""Set a text.
@ -62,8 +59,6 @@ class Text(textbase.TextBase):
self._normaltext = text
elif which is self.Text.temp:
self._temptext = text
elif which is self.Text.js:
self._jstext = text
else:
raise ValueError("Invalid value {} for which!".format(which))
self.update_text()
@ -77,29 +72,11 @@ class Text(textbase.TextBase):
else:
log.statusbar.debug("Ignoring reset: '{}'".format(text))
@config.change_filter('ui', 'display-statusbar-messages')
def update_text(self):
"""Update QLabel text when needed."""
if self._temptext:
self.setText(self._temptext)
elif self._jstext and config.get('ui', 'display-statusbar-messages'):
self.setText(self._jstext)
elif self._normaltext:
self.setText(self._normaltext)
else:
self.setText('')
@pyqtSlot(str)
def on_statusbar_message(self, val):
"""Called when javascript tries to set a statusbar message."""
self._jstext = val
@pyqtSlot()
def on_load_started(self):
"""Clear jstext when page loading started."""
self._jstext = ''
@pyqtSlot(browsertab.AbstractTab)
def on_tab_changed(self, tab):
"""Set the correct jstext when the current tab changed."""
self._jstext = tab.statusbar_message

View File

@ -73,8 +73,6 @@ class TabbedBrowser(tabwidget.TabWidget):
cur_progress: Progress of the current tab changed (load_progress).
cur_load_started: Current tab started loading (load_started)
cur_load_finished: Current tab finished loading (load_finished)
cur_statusbar_message: Current tab got a statusbar message
(statusBarMessage)
cur_url_changed: Current URL changed.
cur_link_hovered: Link hovered in current tab (link_hovered)
cur_scroll_perc_changed: Scroll percentage of current tab changed.
@ -92,7 +90,6 @@ class TabbedBrowser(tabwidget.TabWidget):
cur_progress = pyqtSignal(int)
cur_load_started = pyqtSignal()
cur_load_finished = pyqtSignal(bool)
cur_statusbar_message = pyqtSignal(str)
cur_url_changed = pyqtSignal(QUrl)
cur_link_hovered = pyqtSignal(str)
cur_scroll_perc_changed = pyqtSignal(int, int)
@ -178,9 +175,6 @@ class TabbedBrowser(tabwidget.TabWidget):
self._filter.create(self.cur_load_finished, tab))
tab.load_started.connect(
self._filter.create(self.cur_load_started, tab))
# https://github.com/The-Compiler/qutebrowser/issues/1579
# tab.statusBarMessage.connect(
# self._filter.create(self.cur_statusbar_message, tab))
tab.scroll.perc_changed.connect(
self._filter.create(self.cur_scroll_perc_changed, tab))
tab.scroll.perc_changed.connect(self.on_scroll_pos_changed)

View File

@ -53,10 +53,10 @@ class FakeTabbedBrowser:
class Signaller(QObject):
signal = pyqtSignal(str)
statusbar_message = pyqtSignal(str)
link_hovered = pyqtSignal(str)
filtered_signal = pyqtSignal(str)
cur_statusbar_message = pyqtSignal(str)
cur_link_hovered = pyqtSignal(str)
def __init__(self, parent=None):
super().__init__(parent)
@ -78,8 +78,8 @@ def objects():
signaller = Signaller()
signaller.signal.connect(
signal_filter.create(signaller.filtered_signal, tab))
signaller.statusbar_message.connect(
signal_filter.create(signaller.cur_statusbar_message, tab))
signaller.link_hovered.connect(
signal_filter.create(signaller.cur_link_hovered, tab))
return Objects(signal_filter=signal_filter, signaller=signaller)
@ -121,7 +121,7 @@ def test_no_logging(caplog, objects, tabbed_browser, index_of):
tabbed_browser.index_of = index_of
with caplog.at_level(logging.DEBUG, logger='signals'):
objects.signaller.statusbar_message.emit('foo')
objects.signaller.link_hovered.emit('foo')
assert not caplog.records