From 3bf31ffeb013581d85de03bc9ce47933d72a09e6 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Thu, 30 May 2024 02:55:34 -0500 Subject: [PATCH] fix a few theme-related issues, much still broken --- .../HolocronToolset/src/toolset/gui/editors/dlg.py | 3 +++ .../src/toolset/gui/widgets/edit/locstring.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Tools/HolocronToolset/src/toolset/gui/editors/dlg.py b/Tools/HolocronToolset/src/toolset/gui/editors/dlg.py index 9789f470a..4691239a4 100644 --- a/Tools/HolocronToolset/src/toolset/gui/editors/dlg.py +++ b/Tools/HolocronToolset/src/toolset/gui/editors/dlg.py @@ -31,6 +31,7 @@ from toolset.gui.dialogs.edit.dialog_model import CutsceneModelDialog from toolset.gui.dialogs.edit.locstring import LocalizedStringDialog from toolset.gui.editor import Editor +from toolset.gui.widgets.settings.installations import GlobalSettings from toolset.utils.misc import QtKey from utility.error_handling import assert_with_variable_trace from utility.system.os_helper import remove_any @@ -194,6 +195,8 @@ def __init__( self.ui.dialogTree.customContextMenuRequested.connect(self.onTreeContextMenu) self.ui.dialogTree.selectionModel().selectionChanged.connect(self.onSelectionChanged) self.ui.textEdit.mouseDoubleClickEvent = self.editText + if GlobalSettings().selectedTheme != "Default (Light)": + self.ui.textEdit.setStyleSheet(f"{self.ui.textEdit.styleSheet()} QPlainTextEdit {{color: black;}}") self.buffer: QBuffer = QBuffer() self.player: QMediaPlayer = QMediaPlayer(self) diff --git a/Tools/HolocronToolset/src/toolset/gui/widgets/edit/locstring.py b/Tools/HolocronToolset/src/toolset/gui/widgets/edit/locstring.py index 7011e3609..8bf4a3ff9 100644 --- a/Tools/HolocronToolset/src/toolset/gui/widgets/edit/locstring.py +++ b/Tools/HolocronToolset/src/toolset/gui/widgets/edit/locstring.py @@ -9,6 +9,7 @@ from pykotor.common.language import LocalizedString from toolset.gui.dialogs.edit.locstring import LocalizedStringDialog +from toolset.gui.widgets.settings.installations import GlobalSettings from utility.error_handling import assert_with_variable_trace if TYPE_CHECKING: @@ -72,13 +73,22 @@ def setLocstring(self, locstring: LocalizedString): - If not, looks up the string from the talktable and uses a yellow background """ self._locstring = locstring + theme = GlobalSettings().selectedTheme if locstring.stringref == -1: text = str(locstring) self.ui.locstringText.setText(text if text != "-1" else "") - self.ui.locstringText.setStyleSheet("QLineEdit {background-color: white;}") + # Check theme condition for setting stylesheet + if theme == "Default (Light)": + self.ui.locstringText.setStyleSheet(f"{self.ui.locstringText.styleSheet()} QLineEdit {{background-color: white;}}") + else: + self.ui.locstringText.setStyleSheet(f"{self.ui.locstringText.styleSheet()} QLineEdit {{background-color: white; color: black;}}") else: self.ui.locstringText.setText(self._installation.talktable().string(locstring.stringref)) - self.ui.locstringText.setStyleSheet("QLineEdit {background-color: #fffded;}") + # Check theme condition for setting stylesheet + if theme == "Default (Light)": + self.ui.locstringText.setStyleSheet(f"{self.ui.locstringText.styleSheet()} QLineEdit {{background-color: #fffded;}}") + else: + self.ui.locstringText.setStyleSheet(f"{self.ui.locstringText.styleSheet()} QLineEdit {{background-color: #fffded; color: black;}}") def editLocstring(self): assert self._installation is not None, assert_with_variable_trace(self._installation is not None)