Replace double quotes with single quotes

This commit is contained in:
Saptak S 2022-02-28 12:34:01 +05:30
parent 625144afe6
commit 8d6e375c44
No known key found for this signature in database
GPG Key ID: 7B7F1772C0C6FCBF
5 changed files with 22 additions and 16 deletions

View File

@ -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):
"""

View File

@ -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}")

View File

@ -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"])

View File

@ -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

View File

@ -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__()