From c832e993deacd668d87bdf719e2e290834c0e39b Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 4 Jul 2022 16:54:48 -0400 Subject: [PATCH] Keep setting the style to Fusion for Darwin and Windows --- desktop/onionshare/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/desktop/onionshare/__init__.py b/desktop/onionshare/__init__.py index 6d70719e..de68f6f4 100644 --- a/desktop/onionshare/__init__.py +++ b/desktop/onionshare/__init__.py @@ -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.