Skip to content

Commit

Permalink
fix a few theme-related issues, much still broken
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed May 30, 2024
1 parent 69552cf commit 3bf31ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Tools/HolocronToolset/src/toolset/gui/editors/dlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions Tools/HolocronToolset/src/toolset/gui/widgets/edit/locstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3bf31ff

Please sign in to comment.