mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-12 04:31:41 -05:00
Shows warning to restart if color mode changed while onionshare is running
This commit is contained in:
parent
6a226adc23
commit
3f40c4a140
@ -58,10 +58,6 @@ class Application(QtWidgets.QApplication):
|
||||
and event.modifiers() == QtCore.Qt.ControlModifier
|
||||
):
|
||||
self.quit()
|
||||
|
||||
# Check if color switched while the app was open
|
||||
if event.type() == QtCore.QEvent.Type.ApplicationPaletteChange:
|
||||
self.color_mode = self.get_color_mode()
|
||||
return False
|
||||
|
||||
def is_dark_mode(self):
|
||||
|
@ -289,6 +289,20 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
self.system_tray.hide()
|
||||
e.accept()
|
||||
|
||||
def event(self, event):
|
||||
# Check if color mode switched while onionshare was open, if so, ask user to restart
|
||||
if event.type() == QtCore.QEvent.Type.ApplicationPaletteChange:
|
||||
QtCore.QTimer.singleShot(1, self.color_mode_warning)
|
||||
return True
|
||||
return QtWidgets.QMainWindow.event(self, event)
|
||||
|
||||
def color_mode_warning(self):
|
||||
"""
|
||||
Open the color mode warning alert.
|
||||
"""
|
||||
notice = strings._("gui_color_mode_changed_notice")
|
||||
Alert(self.common, notice, QtWidgets.QMessageBox.Information)
|
||||
|
||||
def cleanup(self):
|
||||
self.common.log("MainWindow", "cleanup")
|
||||
self.tabs.cleanup()
|
||||
|
@ -111,6 +111,7 @@
|
||||
"gui_open_folder_error": "Failed to open folder with xdg-open. The file is here: {}",
|
||||
"gui_settings_language_label": "Preferred language",
|
||||
"gui_settings_language_changed_notice": "Restart OnionShare for the new language to be applied.",
|
||||
"gui_color_mode_changed_notice": "Restart OnionShare for the new color mode to be applied.",
|
||||
"systray_menu_exit": "Quit",
|
||||
"systray_page_loaded_title": "Page Loaded",
|
||||
"systray_page_loaded_message": "OnionShare address loaded",
|
||||
|
Loading…
x
Reference in New Issue
Block a user