Keep setting the style to Fusion for Darwin and Windows

This commit is contained in:
Micah Lee 2022-07-04 16:54:48 -04:00
parent a666a0620d
commit c832e993de
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -28,7 +28,7 @@ import psutil
import getpass
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtCore import Slot,Qt
from PySide2.QtCore import Slot, Qt
from PySide2.QtGui import QPalette, QColor
from onionshare_cli.common import Common
@ -51,8 +51,12 @@ class Application(QtWidgets.QApplication):
self.setDesktopFileName("org.onionshare.OnionShare")
self.setOrganizationDomain("org.onionshare.OnionShare")
self.setOrganizationName("OnionShare")
QtWidgets.QApplication.__init__(self, sys.argv)
if common.platform == "Darwin" or common.platform == "Windows":
self.setStyle("Fusion")
# Check color mode on starting the app
self.color_mode = self.get_color_mode(common)
@ -117,7 +121,9 @@ class Application(QtWidgets.QApplication):
dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
dark_palette.setColor(QPalette.HighlightedText, Qt.black)
self.setPalette(dark_palette)
self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")
self.setStyleSheet(
"QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"
)
def get_color_mode(self, common):
curr_settings = Settings(common)
@ -131,6 +137,7 @@ class Application(QtWidgets.QApplication):
else:
return "dark" if self.is_dark_mode() else "light"
def main():
"""
The main() function implements all of the logic that the GUI version of onionshare uses.