Renaem private attribute to is_private

This commit is contained in:
Florian Bruhin 2018-11-28 17:34:33 +01:00
parent 8765ebef23
commit d60dff2623
9 changed files with 18 additions and 17 deletions

View File

@ -743,7 +743,7 @@ class AbstractTab(QWidget):
Attributes:
history: The AbstractHistory for the current tab.
registry: The ObjectRegistry associated with this tab.
private: Whether private browsing is turned on for this tab.
is_private: Whether private browsing is turned on for this tab.
_load_status: loading status of this page
Accessible via load_status() method.
@ -790,7 +790,7 @@ class AbstractTab(QWidget):
mode_manager: modeman.ModeManager,
private: bool,
parent: QWidget = None) -> None:
self.private = private
self.is_private = private
self.win_id = win_id
self.tab_id = next(tab_id_gen)
super().__init__(parent)

View File

@ -126,7 +126,7 @@ class CommandDispatcher:
tabbed_browser = self._tabbed_browser
cmdutils.check_exclusive((tab, background, window, private), 'tbwp')
if window and private is None:
private = self._tabbed_browser.private
private = self._tabbed_browser.is_private
if window or private:
tabbed_browser = self._new_tabbed_browser(private)
@ -470,7 +470,7 @@ class CommandDispatcher:
# tabs.tabs_are_windows being set)
if window:
new_tabbed_browser = self._new_tabbed_browser(
private=self._tabbed_browser.private)
private=self._tabbed_browser.is_private)
else:
new_tabbed_browser = self._tabbed_browser
newtab = new_tabbed_browser.tabopen(background=bg)
@ -536,7 +536,7 @@ class CommandDispatcher:
"only one tab")
tabbed_browser = self._new_tabbed_browser(
private=self._tabbed_browser.private)
private=self._tabbed_browser.is_private)
else:
if win_id not in objreg.window_registry:
raise cmdexc.CommandError(

View File

@ -140,7 +140,7 @@ def prevnext(*, browsertab, win_id, baseurl, prev=False,
if window:
new_window = mainwindow.MainWindow(
private=cur_tabbed_browser.private)
private=cur_tabbed_browser.is_private)
new_window.show()
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=new_window.win_id)

View File

@ -262,7 +262,7 @@ def get_tab(win_id, target):
elif target == usertypes.ClickTarget.window:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)
window = mainwindow.MainWindow(private=tabbed_browser.private)
window = mainwindow.MainWindow(private=tabbed_browser.is_private)
window.show()
win_id = window.win_id
bg_tab = False

View File

@ -382,7 +382,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
background = click_target == usertypes.ClickTarget.tab_bg
tabbed_browser.tabopen(url, background=background)
elif click_target == usertypes.ClickTarget.window:
window = mainwindow.MainWindow(private=tabbed_browser.private)
window = mainwindow.MainWindow(private=tabbed_browser.is_private)
window.show()
window.tabbed_browser.tabopen(url)
else:

View File

@ -367,7 +367,7 @@ class StatusBar(QWidget):
self.percentage.on_tab_changed(tab)
self.backforward.on_tab_changed(tab)
self.maybe_hide()
assert tab.private == self._color_flags.private
assert tab.is_private == self._color_flags.private
@pyqtSlot(bool)
def on_caret_selection_toggled(self, selection):

View File

@ -76,7 +76,7 @@ class TabbedBrowser(QWidget):
_local_marks: Jump markers local to each page
_global_marks: Jump markers used across all pages
default_window_icon: The qutebrowser window icon
private: Whether private browsing is on for this window.
is_private: Whether private browsing is on for this window.
Signals:
cur_progress: Progress of the current tab changed (load_progress).
@ -131,7 +131,7 @@ class TabbedBrowser(QWidget):
self._local_marks = {}
self._global_marks = {}
self.default_window_icon = self.widget.window().windowIcon()
self.private = private
self.is_private = private
config.instance.changed.connect(self._on_config_changed)
def __repr__(self):
@ -243,7 +243,7 @@ class TabbedBrowser(QWidget):
tab.audio.recently_audible_changed.connect(
functools.partial(self._on_audio_changed, tab))
tab.new_tab_requested.connect(self.tabopen)
if not self.private:
if not self.is_private:
web_history = objreg.get('web-history')
tab.add_history_item.connect(web_history.add_from_tab)
@ -466,14 +466,15 @@ class TabbedBrowser(QWidget):
if (config.val.tabs.tabs_are_windows and self.widget.count() > 0 and
not ignore_tabs_are_windows):
window = mainwindow.MainWindow(private=self.private)
window = mainwindow.MainWindow(private=self.is_private)
window.show()
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=window.win_id)
return tabbed_browser.tabopen(url=url, background=background,
related=related)
tab = browsertab.create(win_id=self._win_id, private=self.private,
tab = browsertab.create(win_id=self._win_id,
private=self.is_private,
parent=self.widget)
self._connect_tab_signals(tab)

View File

@ -177,7 +177,7 @@ class TabWidget(QTabWidget):
fields['title_sep'] = ' - ' if page_title else ''
fields['perc_raw'] = tab.progress()
fields['backend'] = objects.backend.name
fields['private'] = ' [Private Mode] ' if tab.private else ''
fields['private'] = ' [Private Mode] ' if tab.is_private else ''
try:
if tab.audio.is_muted():
fields['audio'] = TabWidget.MUTE_STRING

View File

@ -242,7 +242,7 @@ class SessionManager(QObject):
if sip.isdeleted(main_window):
continue
if tabbed_browser.private and not with_private:
if tabbed_browser.is_private and not with_private:
continue
win_data = {}
@ -251,7 +251,7 @@ class SessionManager(QObject):
win_data['active'] = True
win_data['geometry'] = bytes(main_window.saveGeometry())
win_data['tabs'] = []
if tabbed_browser.private:
if tabbed_browser.is_private:
win_data['private'] = True
for i, tab in enumerate(tabbed_browser.widgets()):
active = i == tabbed_browser.widget.currentIndex()