aboutsummaryrefslogtreecommitdiff
path: root/desktop/src/onionshare/settings_dialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/src/onionshare/settings_dialog.py')
-rw-r--r--desktop/src/onionshare/settings_dialog.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/src/onionshare/settings_dialog.py b/desktop/src/onionshare/settings_dialog.py
index 190ae35d..e8d2752c 100644
--- a/desktop/src/onionshare/settings_dialog.py
+++ b/desktop/src/onionshare/settings_dialog.py
@@ -19,6 +19,8 @@ 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.QtGui import QPalette, QColor
import sys
import platform
import datetime
@@ -123,6 +125,20 @@ class SettingsDialog(QtWidgets.QDialog):
language_layout.addWidget(self.language_combobox)
language_layout.addStretch()
+ #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")
+ ]
+ self.theme_combobox.addItems(theme_choices)
+ theme_layout = QtWidgets.QHBoxLayout()
+ theme_layout.addWidget(theme_label)
+ theme_layout.addWidget(self.theme_combobox)
+ theme_layout.addStretch()
+
# Connection type: either automatic, control port, or socket file
# Bundled Tor
@@ -451,6 +467,8 @@ class SettingsDialog(QtWidgets.QDialog):
layout.addSpacing(20)
layout.addLayout(language_layout)
layout.addSpacing(20)
+ layout.addLayout(theme_layout)
+ layout.addSpacing(20)
layout.addStretch()
layout.addLayout(buttons_layout)
@@ -477,6 +495,9 @@ class SettingsDialog(QtWidgets.QDialog):
locale_index = self.language_combobox.findData(locale)
self.language_combobox.setCurrentIndex(locale_index)
+ theme_choice = self.old_settings.get("theme")
+ self.theme_combobox.setCurrentIndex(theme_choice)
+
connection_type = self.old_settings.get("connection_type")
if connection_type == "bundled":
if self.connection_type_bundled_radio.isEnabled():
@@ -822,6 +843,12 @@ 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")
+ Alert(self.common, notice, QtWidgets.QMessageBox.Information)
+
# Save the new settings
settings.save()
@@ -931,6 +958,10 @@ class SettingsDialog(QtWidgets.QDialog):
settings = Settings(self.common)
settings.load() # To get the last update timestamp
+ # Theme
+ theme_index = self.theme_combobox.currentIndex()
+ settings.set("theme",theme_index)
+
# Language
locale_index = self.language_combobox.currentIndex()
locale = self.language_combobox.itemData(locale_index)