Simplify logic and resolve style issues
This commit is contained in:
parent
563afb277d
commit
11d8df0e3e
@ -278,7 +278,8 @@ Set all settings back to their default.
|
||||
|
||||
[[config-cycle]]
|
||||
=== config-cycle
|
||||
Syntax: +:config-cycle [*--pattern* 'pattern'] [*--temp*] [*--print*] 'option' ['values' ['values' ...]]+
|
||||
Syntax: +:config-cycle [*--pattern* 'pattern'] [*--temp*] [*--print*]
|
||||
'option' ['values' ['values' ...]]+
|
||||
|
||||
Cycle an option between multiple values.
|
||||
|
||||
@ -530,7 +531,8 @@ Show help about a command or setting.
|
||||
|
||||
[[hint]]
|
||||
=== hint
|
||||
Syntax: +:hint [*--mode* 'mode'] [*--add-history*] [*--rapid*] [*--first*] ['group'] ['target'] ['args' ['args' ...]]+
|
||||
Syntax: +:hint [*--mode* 'mode'] [*--add-history*] [*--rapid*] [*--first*]
|
||||
['group'] ['target'] ['args' ['args' ...]]+
|
||||
|
||||
Start hinting.
|
||||
|
||||
@ -781,7 +783,8 @@ Do nothing.
|
||||
|
||||
[[open]]
|
||||
=== open
|
||||
Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*] ['url']+
|
||||
Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*]
|
||||
['url']+
|
||||
|
||||
Open a URL in the current/[count]th tab.
|
||||
|
||||
@ -1110,7 +1113,9 @@ Load a session.
|
||||
|
||||
[[session-save]]
|
||||
=== session-save
|
||||
Syntax: +:session-save [*--current*] [*--quiet*] [*--force*] [*--only-active-window*] [*--with-private*] ['name']+
|
||||
Syntax: +:session-save [*--current*] [*--quiet*] [*--force*] [*--only-active-window*]
|
||||
[*--with-private*]
|
||||
['name']+
|
||||
|
||||
Save a session.
|
||||
|
||||
|
@ -2238,7 +2238,7 @@ class CommandDispatcher:
|
||||
"""Mute/Unmute the current/[count]th tab.
|
||||
|
||||
Args:
|
||||
count: The tab index to pin or unpin, or None
|
||||
count: The tab index to mute or unmute, or None
|
||||
"""
|
||||
tab = self._cntwidget(count)
|
||||
if tab is None:
|
||||
|
@ -1377,7 +1377,7 @@ tabs.title.format:
|
||||
* `{private}`: Indicates when private mode is enabled.
|
||||
* `{current_url}`: URL of the current web page.
|
||||
* `{protocol}`: Protocol (http/https/...) of the current web page.
|
||||
* `{audio}`: Cookie for audio/mute status
|
||||
* `{audio}`: Indicator for audio/mute status
|
||||
|
||||
tabs.title.format_pinned:
|
||||
default: '{index}'
|
||||
|
@ -239,9 +239,9 @@ class TabbedBrowser(QWidget):
|
||||
tab.renderer_process_terminated.connect(
|
||||
functools.partial(self._on_renderer_process_terminated, tab))
|
||||
tab.audio_muted_changed.connect(
|
||||
functools.partial(self.on_audio_changed, tab))
|
||||
functools.partial(self._on_audio_changed, tab))
|
||||
tab.recently_audible_changed.connect(
|
||||
functools.partial(self.on_audio_changed, tab))
|
||||
functools.partial(self._on_audio_changed, tab))
|
||||
tab.new_tab_requested.connect(self.tabopen)
|
||||
if not self.private:
|
||||
web_history = objreg.get('web-history')
|
||||
@ -737,8 +737,7 @@ class TabbedBrowser(QWidget):
|
||||
self._update_window_title('scroll_pos')
|
||||
self.widget.update_tab_title(idx, 'scroll_pos')
|
||||
|
||||
@pyqtSlot()
|
||||
def on_audio_changed(self, tab, _muted):
|
||||
def _on_audio_changed(self, tab, _muted):
|
||||
"""Update audio field in tab when mute or recentlyAudible changed."""
|
||||
try:
|
||||
idx = self._tab_index(tab)
|
||||
|
@ -174,10 +174,14 @@ class TabWidget(QTabWidget):
|
||||
fields['backend'] = objects.backend.name
|
||||
fields['private'] = ' [Private Mode] ' if tab.private else ''
|
||||
try:
|
||||
fields['audio'] = '[M] ' if tab.is_muted() else (
|
||||
'[A] ' if tab.is_recently_audible() else '')
|
||||
except (NotImplementedError, browsertab.WebTabError):
|
||||
# one of the functions was not implemented or had an error, abort
|
||||
if tab.is_muted():
|
||||
fields['audio'] = '[M] '
|
||||
elif tab.is_recently_audible():
|
||||
fields['audio'] = '[A] '
|
||||
else:
|
||||
fields['audio'] = ''
|
||||
except browsertab.WebTabError:
|
||||
# Muting is only implemented with QtWebEngine
|
||||
fields['audio'] = ''
|
||||
|
||||
if tab.load_status() == usertypes.LoadStatus.loading:
|
||||
|
Loading…
Reference in New Issue
Block a user