1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.mode_settings import ModeSettings
from . import strings
from .tab import Tab
from .threads import EventHandlerThread
from .gui_common import GuiCommon
from .tor_settings_tab import TorSettingsTab
from .settings_tab import SettingsTab
from .connection_tab import AutoConnectTab
class SettingsParentTab(QtWidgets.QTabWidget):
"""
The settings tab widget containing the tor settings
and app settings subtabs
"""
bring_to_front = QtCore.Signal()
close_this_tab = QtCore.Signal()
def __init__(self, common, tab_id, parent=None, active_tab='tor', from_autoconnect=False):
super(SettingsParentTab, self).__init__()
self.parent = parent
self.common = common
self.common.log("SettingsParentTab", "__init__")
# Keep track of tabs in a dictionary that maps tab_id to tab.
# 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 = {}
self.tab_id = tab_id
# self.current_tab_id = 0 # Each tab has a unique id
# self.tor_settings_tab = None
# Use a custom tab bar
tab_bar = TabBar()
self.setTabBar(tab_bar)
settings_tab = SettingsTab(self.common, 0)
self.tor_settings_tab = TorSettingsTab(
self.common,
1,
self.parent.are_tabs_active(),
self.parent.status_bar,
from_autoconnect,
)
self.addTab(
self.tor_settings_tab, strings._("gui_tor_settings_window_title")
)
self.addTab(settings_tab, strings._("gui_settings_window_title"))
# Set up the tab widget
self.setMovable(False)
self.setTabsClosable(False)
self.setUsesScrollButtons(False)
# self.setDocumentMode(True)
# self.setStyleSheet(self.common.gui.css["tab_widget"])
# self.tabCloseRequested.connect(self.close_tab)
# self.move_new_tab_button()
class TabBar(QtWidgets.QTabBar):
"""
A custom tab bar
"""
move_new_tab_button = QtCore.Signal()
def __init__(self):
super(TabBar, self).__init__()
|