Merge pull request #4089 from jgkamat/jay/audible-tab-refactor

Move audible strings into class variables
This commit is contained in:
Florian Bruhin 2018-07-21 21:59:19 +02:00 committed by GitHub
commit d0412811d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,10 @@ class TabWidget(QTabWidget):
tab_index_changed = pyqtSignal(int, int)
new_tab_requested = pyqtSignal('QUrl', bool, bool)
# Strings for controlling the mute/audible text
MUTE_STRING = '[M] '
AUDIBLE_STRING = '[A] '
def __init__(self, win_id, parent=None):
super().__init__(parent)
bar = TabBar(win_id, self)
@ -175,9 +179,9 @@ class TabWidget(QTabWidget):
fields['private'] = ' [Private Mode] ' if tab.private else ''
try:
if tab.audio.is_muted():
fields['audio'] = '[M] '
fields['audio'] = TabWidget.MUTE_STRING
elif tab.audio.is_recently_audible():
fields['audio'] = '[A] '
fields['audio'] = TabWidget.AUDIBLE_STRING
else:
fields['audio'] = ''
except browsertab.WebTabError: