From d60dff26233d777dc8eca888ac60f02737d80d54 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 28 Nov 2018 17:34:33 +0100 Subject: [PATCH] Renaem private attribute to is_private --- qutebrowser/browser/browsertab.py | 4 ++-- qutebrowser/browser/commands.py | 6 +++--- qutebrowser/browser/navigate.py | 2 +- qutebrowser/browser/shared.py | 2 +- qutebrowser/browser/webelem.py | 2 +- qutebrowser/mainwindow/statusbar/bar.py | 2 +- qutebrowser/mainwindow/tabbedbrowser.py | 11 ++++++----- qutebrowser/mainwindow/tabwidget.py | 2 +- qutebrowser/misc/sessions.py | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 15cfb4f91..ab186e56a 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -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) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index a53cfc75e..2b4165364 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -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( diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index baeb7bf5b..0f80775bd 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -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) diff --git a/qutebrowser/browser/shared.py b/qutebrowser/browser/shared.py index eb222cbe8..0bf3301f9 100644 --- a/qutebrowser/browser/shared.py +++ b/qutebrowser/browser/shared.py @@ -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 diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index 520b7d12b..a22facfbd 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -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: diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 3edb8128a..13a368f05 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -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): diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 1f3484663..15b8f2c7b 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -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) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index a3ba0f1da..ca4be6d50 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -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 diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index e50d803a2..5f50bf5d1 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -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()