mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-14 05:31:25 -05:00
Start splitting settings into normal settings and Tor settings
This commit is contained in:
parent
c58272c117
commit
03d1953246
@ -18,11 +18,13 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
|
||||
from . import strings
|
||||
from .tor_connection_dialog import TorConnectionDialog
|
||||
from .tor_settings_dialog import TorSettingsDialog
|
||||
from .settings_dialog import SettingsDialog
|
||||
from .widgets import Alert
|
||||
from .update_checker import UpdateThread
|
||||
@ -106,6 +108,24 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
)
|
||||
self.status_bar.addPermanentWidget(self.status_bar.server_status_indicator)
|
||||
|
||||
# Tor settings button
|
||||
self.tor_settings_button = QtWidgets.QPushButton()
|
||||
self.tor_settings_button.setDefault(False)
|
||||
self.tor_settings_button.setFixedSize(40, 50)
|
||||
self.tor_settings_button.setIcon(
|
||||
QtGui.QIcon(
|
||||
GuiCommon.get_resource_path(
|
||||
"images/{}_tor_settings.png".format(self.common.gui.color_mode)
|
||||
)
|
||||
)
|
||||
)
|
||||
self.tor_settings_button.clicked.connect(self.open_tor_settings)
|
||||
self.tor_settings_button.setStyleSheet(self.common.gui.css["settings_button"])
|
||||
self.status_bar.addPermanentWidget(self.tor_settings_button)
|
||||
|
||||
if os.environ.get("ONIONSHARE_HIDE_TOR_SETTINGS") == "1":
|
||||
self.tor_settings_button.hide()
|
||||
|
||||
# Settings button
|
||||
self.settings_button = QtWidgets.QPushButton()
|
||||
self.settings_button.setDefault(False)
|
||||
@ -223,6 +243,15 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
# Wait 1ms for the event loop to finish closing the TorConnectionDialog
|
||||
QtCore.QTimer.singleShot(1, self.open_settings)
|
||||
|
||||
def open_tor_settings(self):
|
||||
"""
|
||||
Open the TorSettingsDialog.
|
||||
"""
|
||||
self.common.log("MainWindow", "open_tor_settings")
|
||||
d = TorSettingsDialog(self.common)
|
||||
d.settings_saved.connect(self.settings_have_changed)
|
||||
d.exec_()
|
||||
|
||||
def open_settings(self):
|
||||
"""
|
||||
Open the SettingsDialog.
|
||||
|
BIN
desktop/src/onionshare/resources/images/dark_tor_settings.png
Normal file
BIN
desktop/src/onionshare/resources/images/dark_tor_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
desktop/src/onionshare/resources/images/light_tor_settings.png
Normal file
BIN
desktop/src/onionshare/resources/images/light_tor_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -40,6 +40,7 @@
|
||||
"gui_please_wait_no_button": "Starting…",
|
||||
"gui_please_wait": "Starting… Click to cancel.",
|
||||
"zip_progress_bar_format": "Compressing: %p%",
|
||||
"gui_tor_settings_window_title": "Tor Settings",
|
||||
"gui_settings_window_title": "Settings",
|
||||
"gui_settings_autoupdate_label": "Check for new version",
|
||||
"gui_settings_autoupdate_option": "Notify me when a new version is available",
|
||||
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from PySide2.QtCore import Slot,Qt
|
||||
from PySide2.QtCore import Slot, Qt
|
||||
from PySide2.QtGui import QPalette, QColor
|
||||
import sys
|
||||
import platform
|
||||
@ -46,8 +46,7 @@ from onionshare_cli.onion import (
|
||||
|
||||
from . import strings
|
||||
from .widgets import Alert
|
||||
from .update_checker import (
|
||||
UpdateThread)
|
||||
from .update_checker import UpdateThread
|
||||
from .tor_connection_dialog import TorConnectionDialog
|
||||
from .gui_common import GuiCommon
|
||||
|
||||
@ -125,13 +124,13 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
language_layout.addWidget(self.language_combobox)
|
||||
language_layout.addStretch()
|
||||
|
||||
#Theme Settings
|
||||
# Theme Settings
|
||||
theme_label = QtWidgets.QLabel(strings._("gui_settings_theme_label"))
|
||||
self.theme_combobox = QtWidgets.QComboBox()
|
||||
theme_choices = [
|
||||
strings._("gui_settings_theme_auto"),
|
||||
strings._("gui_settings_theme_light"),
|
||||
strings._("gui_settings_theme_dark")
|
||||
strings._("gui_settings_theme_dark"),
|
||||
]
|
||||
self.theme_combobox.addItems(theme_choices)
|
||||
theme_layout = QtWidgets.QHBoxLayout()
|
||||
@ -165,14 +164,16 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.tor_bridges_no_bridges_radio_toggled
|
||||
)
|
||||
|
||||
# obfs4 option radio
|
||||
# if the obfs4proxy binary is missing, we can't use obfs4 transports
|
||||
(
|
||||
self.tor_path,
|
||||
self.tor_geo_ip_file_path,
|
||||
self.tor_geo_ipv6_file_path,
|
||||
self.obfs4proxy_file_path,
|
||||
self.snowflake_file_path,
|
||||
) = self.common.gui.get_tor_paths()
|
||||
|
||||
# obfs4 option radio
|
||||
# if the obfs4proxy binary is missing, we can't use obfs4 transports
|
||||
if not self.obfs4proxy_file_path or not os.path.isfile(
|
||||
self.obfs4proxy_file_path
|
||||
):
|
||||
@ -190,12 +191,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
# meek_lite-azure option radio
|
||||
# if the obfs4proxy binary is missing, we can't use meek_lite-azure transports
|
||||
(
|
||||
self.tor_path,
|
||||
self.tor_geo_ip_file_path,
|
||||
self.tor_geo_ipv6_file_path,
|
||||
self.obfs4proxy_file_path,
|
||||
) = self.common.gui.get_tor_paths()
|
||||
if not self.obfs4proxy_file_path or not os.path.isfile(
|
||||
self.obfs4proxy_file_path
|
||||
):
|
||||
@ -802,7 +797,9 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
)
|
||||
close_forced_update_thread()
|
||||
|
||||
forced_update_thread = UpdateThread(self.common, self.common.gui.onion, force=True)
|
||||
forced_update_thread = UpdateThread(
|
||||
self.common, self.common.gui.onion, force=True
|
||||
)
|
||||
forced_update_thread.update_available.connect(update_available)
|
||||
forced_update_thread.update_not_available.connect(update_not_available)
|
||||
forced_update_thread.update_error.connect(update_error)
|
||||
@ -843,7 +840,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
notice = strings._("gui_settings_language_changed_notice")
|
||||
Alert(self.common, notice, QtWidgets.QMessageBox.Information)
|
||||
|
||||
|
||||
# If color mode changed, inform user they need to restart OnionShare
|
||||
if changed(settings, self.old_settings, ["theme"]):
|
||||
notice = strings._("gui_color_mode_changed_notice")
|
||||
@ -960,7 +956,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
# Theme
|
||||
theme_index = self.theme_combobox.currentIndex()
|
||||
settings.set("theme",theme_index)
|
||||
settings.set("theme", theme_index)
|
||||
|
||||
# Language
|
||||
locale_index = self.language_combobox.currentIndex()
|
||||
|
1112
desktop/src/onionshare/tor_settings_dialog.py
Normal file
1112
desktop/src/onionshare/tor_settings_dialog.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user