diff --git a/desktop/onionshare/connection_tab.py b/desktop/onionshare/connection_tab.py index 0b60a8b4..2bb2a79c 100644 --- a/desktop/onionshare/connection_tab.py +++ b/desktop/onionshare/connection_tab.py @@ -149,7 +149,7 @@ class AutoConnectTab(QtWidgets.QWidget): self.curr_settings.save() def open_tor_settings(self): - self.parent.open_settings_tab(from_autoconnect=True, active_tab='tor') + self.parent.open_settings_tab(from_autoconnect=True, active_tab="tor") def first_launch_widget_connect_clicked(self): """ diff --git a/desktop/onionshare/main_window.py b/desktop/onionshare/main_window.py index eef12028..b2bd01e9 100644 --- a/desktop/onionshare/main_window.py +++ b/desktop/onionshare/main_window.py @@ -222,13 +222,13 @@ class MainWindow(QtWidgets.QMainWindow): """ Open the TorSettingsTab """ - self._open_settings(active_tab='tor') + self._open_settings(active_tab="tor") def open_settings(self): """ Open the general SettingsTab """ - self._open_settings(active_tab='general') + self._open_settings(active_tab="general") def _open_settings(self, active_tab): self.common.log("MainWindow", f"open settings with active tab: {active_tab}") diff --git a/desktop/onionshare/settings_parent_tab.py b/desktop/onionshare/settings_parent_tab.py index 030cacc0..2ade0e05 100644 --- a/desktop/onionshare/settings_parent_tab.py +++ b/desktop/onionshare/settings_parent_tab.py @@ -20,7 +20,9 @@ class SettingsParentTab(QtWidgets.QTabWidget): bring_to_front = QtCore.Signal() close_this_tab = QtCore.Signal() - def __init__(self, common, tab_id, parent=None, active_tab='general', from_autoconnect=False): + def __init__( + self, common, tab_id, parent=None, active_tab="general", from_autoconnect=False + ): super(SettingsParentTab, self).__init__() self.parent = parent self.common = common @@ -30,8 +32,8 @@ class SettingsParentTab(QtWidgets.QTabWidget): # Each tab has a unique, auto-incremented id (tab_id). This is different than the # tab's index, which changes as tabs are re-arranged. self.tabs = { - 'general': 0, - 'tor': 1, + "general": 0, + "tor": 1, } self.tab_id = tab_id self.current_tab_id = self.tabs[active_tab] @@ -39,19 +41,17 @@ class SettingsParentTab(QtWidgets.QTabWidget): # Use a custom tab bar tab_bar = TabBar(self.common) self.setTabBar(tab_bar) - settings_tab = SettingsTab(self.common, self.tabs['general'], parent=self) + settings_tab = SettingsTab(self.common, self.tabs["general"], parent=self) self.tor_settings_tab = TorSettingsTab( self.common, - self.tabs['tor'], + self.tabs["tor"], self.parent.are_tabs_active(), self.parent.status_bar, parent=self, from_autoconnect=from_autoconnect, ) self.addTab(settings_tab, strings._("gui_general_settings_window_title")) - self.addTab( - self.tor_settings_tab, strings._("gui_tor_settings_window_title") - ) + self.addTab(self.tor_settings_tab, strings._("gui_tor_settings_window_title")) # Set up the tab widget self.setMovable(False) @@ -59,6 +59,7 @@ class SettingsParentTab(QtWidgets.QTabWidget): self.setUsesScrollButtons(False) self.setCurrentIndex(self.current_tab_id) + class TabBar(QtWidgets.QTabBar): """ A custom tab bar @@ -68,5 +69,4 @@ class TabBar(QtWidgets.QTabBar): def __init__(self, common): super(TabBar, self).__init__() - self.setStyleSheet(common.gui.css['settings_subtab_bar']) - + self.setStyleSheet(common.gui.css["settings_subtab_bar"]) diff --git a/desktop/onionshare/tab_widget.py b/desktop/onionshare/tab_widget.py index a9b34030..0a59c20d 100644 --- a/desktop/onionshare/tab_widget.py +++ b/desktop/onionshare/tab_widget.py @@ -226,7 +226,7 @@ class TabWidget(QtWidgets.QTabWidget): index = self.addTab(connection_tab, strings._("gui_autoconnect_start")) self.setCurrentIndex(index) - def open_settings_tab(self, from_autoconnect=False, active_tab='general'): + def open_settings_tab(self, from_autoconnect=False, active_tab="general"): self.common.log("TabWidget", "open_settings_tab") # See if a settings tab is already open, and if so switch to it @@ -240,7 +240,7 @@ class TabWidget(QtWidgets.QTabWidget): self.current_tab_id, active_tab=active_tab, parent=self, - from_autoconnect=from_autoconnect + from_autoconnect=from_autoconnect, ) settings_tab.close_this_tab.connect(self.close_settings_tab) self.tor_settings_tab = settings_tab.tor_settings_tab diff --git a/desktop/onionshare/tor_settings_tab.py b/desktop/onionshare/tor_settings_tab.py index 347dbcbf..0e72c3b8 100644 --- a/desktop/onionshare/tor_settings_tab.py +++ b/desktop/onionshare/tor_settings_tab.py @@ -43,7 +43,13 @@ class TorSettingsTab(QtWidgets.QWidget): tor_is_disconnected = QtCore.Signal() def __init__( - self, common, tab_id, are_tabs_active, status_bar, from_autoconnect=False, parent=None + self, + common, + tab_id, + are_tabs_active, + status_bar, + from_autoconnect=False, + parent=None, ): super(TorSettingsTab, self).__init__()