mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-20 20:44:23 -04:00
Start splitting settings into normal settings and Tor settings
This commit is contained in:
parent
c58272c117
commit
03d1953246
6 changed files with 1154 additions and 16 deletions
|
@ -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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from PySide2 import QtCore, QtWidgets, QtGui
|
from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from . import strings
|
from . import strings
|
||||||
from .tor_connection_dialog import TorConnectionDialog
|
from .tor_connection_dialog import TorConnectionDialog
|
||||||
|
from .tor_settings_dialog import TorSettingsDialog
|
||||||
from .settings_dialog import SettingsDialog
|
from .settings_dialog import SettingsDialog
|
||||||
from .widgets import Alert
|
from .widgets import Alert
|
||||||
from .update_checker import UpdateThread
|
from .update_checker import UpdateThread
|
||||||
|
@ -106,6 +108,24 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
)
|
)
|
||||||
self.status_bar.addPermanentWidget(self.status_bar.server_status_indicator)
|
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
|
# Settings button
|
||||||
self.settings_button = QtWidgets.QPushButton()
|
self.settings_button = QtWidgets.QPushButton()
|
||||||
self.settings_button.setDefault(False)
|
self.settings_button.setDefault(False)
|
||||||
|
@ -223,6 +243,15 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
# Wait 1ms for the event loop to finish closing the TorConnectionDialog
|
# Wait 1ms for the event loop to finish closing the TorConnectionDialog
|
||||||
QtCore.QTimer.singleShot(1, self.open_settings)
|
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):
|
def open_settings(self):
|
||||||
"""
|
"""
|
||||||
Open the SettingsDialog.
|
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_no_button": "Starting…",
|
||||||
"gui_please_wait": "Starting… Click to cancel.",
|
"gui_please_wait": "Starting… Click to cancel.",
|
||||||
"zip_progress_bar_format": "Compressing: %p%",
|
"zip_progress_bar_format": "Compressing: %p%",
|
||||||
|
"gui_tor_settings_window_title": "Tor Settings",
|
||||||
"gui_settings_window_title": "Settings",
|
"gui_settings_window_title": "Settings",
|
||||||
"gui_settings_autoupdate_label": "Check for new version",
|
"gui_settings_autoupdate_label": "Check for new version",
|
||||||
"gui_settings_autoupdate_option": "Notify me when a new version is available",
|
"gui_settings_autoupdate_option": "Notify me when a new version is available",
|
||||||
|
|
|
@ -46,8 +46,7 @@ from onionshare_cli.onion import (
|
||||||
|
|
||||||
from . import strings
|
from . import strings
|
||||||
from .widgets import Alert
|
from .widgets import Alert
|
||||||
from .update_checker import (
|
from .update_checker import UpdateThread
|
||||||
UpdateThread)
|
|
||||||
from .tor_connection_dialog import TorConnectionDialog
|
from .tor_connection_dialog import TorConnectionDialog
|
||||||
from .gui_common import GuiCommon
|
from .gui_common import GuiCommon
|
||||||
|
|
||||||
|
@ -131,7 +130,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
theme_choices = [
|
theme_choices = [
|
||||||
strings._("gui_settings_theme_auto"),
|
strings._("gui_settings_theme_auto"),
|
||||||
strings._("gui_settings_theme_light"),
|
strings._("gui_settings_theme_light"),
|
||||||
strings._("gui_settings_theme_dark")
|
strings._("gui_settings_theme_dark"),
|
||||||
]
|
]
|
||||||
self.theme_combobox.addItems(theme_choices)
|
self.theme_combobox.addItems(theme_choices)
|
||||||
theme_layout = QtWidgets.QHBoxLayout()
|
theme_layout = QtWidgets.QHBoxLayout()
|
||||||
|
@ -165,14 +164,16 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
self.tor_bridges_no_bridges_radio_toggled
|
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_path,
|
||||||
self.tor_geo_ip_file_path,
|
self.tor_geo_ip_file_path,
|
||||||
self.tor_geo_ipv6_file_path,
|
self.tor_geo_ipv6_file_path,
|
||||||
self.obfs4proxy_file_path,
|
self.obfs4proxy_file_path,
|
||||||
|
self.snowflake_file_path,
|
||||||
) = self.common.gui.get_tor_paths()
|
) = 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(
|
if not self.obfs4proxy_file_path or not os.path.isfile(
|
||||||
self.obfs4proxy_file_path
|
self.obfs4proxy_file_path
|
||||||
):
|
):
|
||||||
|
@ -190,12 +191,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
|
|
||||||
# meek_lite-azure option radio
|
# meek_lite-azure option radio
|
||||||
# if the obfs4proxy binary is missing, we can't use meek_lite-azure transports
|
# 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(
|
if not self.obfs4proxy_file_path or not os.path.isfile(
|
||||||
self.obfs4proxy_file_path
|
self.obfs4proxy_file_path
|
||||||
):
|
):
|
||||||
|
@ -802,7 +797,9 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
)
|
)
|
||||||
close_forced_update_thread()
|
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_available.connect(update_available)
|
||||||
forced_update_thread.update_not_available.connect(update_not_available)
|
forced_update_thread.update_not_available.connect(update_not_available)
|
||||||
forced_update_thread.update_error.connect(update_error)
|
forced_update_thread.update_error.connect(update_error)
|
||||||
|
@ -843,7 +840,6 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||||
notice = strings._("gui_settings_language_changed_notice")
|
notice = strings._("gui_settings_language_changed_notice")
|
||||||
Alert(self.common, notice, QtWidgets.QMessageBox.Information)
|
Alert(self.common, notice, QtWidgets.QMessageBox.Information)
|
||||||
|
|
||||||
|
|
||||||
# If color mode changed, inform user they need to restart OnionShare
|
# If color mode changed, inform user they need to restart OnionShare
|
||||||
if changed(settings, self.old_settings, ["theme"]):
|
if changed(settings, self.old_settings, ["theme"]):
|
||||||
notice = strings._("gui_color_mode_changed_notice")
|
notice = strings._("gui_color_mode_changed_notice")
|
||||||
|
|
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…
Add table
Add a link
Reference in a new issue