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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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