Permalink
Browse files

Remove support for showing JS statusbar messages

Closes #1579.
  • Loading branch information...
The-Compiler committed Jul 11, 2016
1 parent d0aea24 commit e80475ed5724431188e76f1822be0bd81370b9eb
View
@@ -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
@@ -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.
@@ -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)
@@ -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 @@ def __init__(self, win_id, tab_id, tab, parent=None):
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 @@ def _init_page(self):
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):
@@ -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'):
@@ -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 "
@@ -345,9 +345,6 @@ def _connect_signals(self):
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)
@@ -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 @@ def set_text(self, which, text):
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 @@ def maybe_reset_text(self, text):
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
@@ -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 @@ def _connect_tab_signals(self, tab):
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)
@@ -53,10 +53,10 @@ def currentIndex(self):
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

0 comments on commit e80475e

Please sign in to comment.