1
0
Fork 0
mirror of synced 2024-06-02 18:54:41 +12:00

Make qss resources path compatible with Windows

This commit is contained in:
Stelios Tsampas 2021-06-08 19:59:29 +03:00
parent dc2a99c2ee
commit 81aa8c30ec
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import os
__version__ = "1.4.1"
resources_path = os.path.join(os.path.dirname(__file__), "resources/")
languages_path = os.path.join(os.path.dirname(__file__), "languages/")
resources_path = os.path.join(os.path.dirname(__file__), "resources")
languages_path = os.path.join(os.path.dirname(__file__), "languages")

View file

@ -96,7 +96,10 @@ class App(QApplication):
elif style := settings.value("style_sheet", False):
settings.setValue("color_scheme", "")
stylesheet = open(os.path.join(resources_path, "stylesheets", style, "stylesheet.qss")).read()
self.setStyleSheet(stylesheet.replace("@path@", os.path.join(resources_path, "stylesheets", style, '')))
style_resource_path = os.path.join(resources_path, "stylesheets", style, "")
if os.name == "nt":
style_resource_path = style_resource_path.replace('\\', '/')
self.setStyleSheet(stylesheet.replace("@path@", style_resource_path))
# lk: for qresources stylesheets, not an ideal solution for modability,
# lk: too many extra steps and I don't like binary files in git, even as strings.
# importlib.import_module("rare.resources.stylesheets." + style)