Name qrc and qss files with prefix of palette ID to keep them working on C++

This commit is contained in:
Daniel C. Pizetta
2022-05-30 12:22:55 -03:00
parent 0a97b4c546
commit 67c78db7f1
3 changed files with 11 additions and 8 deletions
+5 -4
View File
@@ -240,13 +240,13 @@ def _load_stylesheet(qt_api='', palette=None):
# Then we import resources - binary qrc content
if palette is None:
from qdarkstyle.dark import style_rc
from qdarkstyle.dark import darkstyle_rc
palette = DarkPalette
elif palette.ID == 'dark':
from qdarkstyle.dark import style_rc
from qdarkstyle.dark import darkstyle_rc
palette = DarkPalette
elif palette.ID == 'light':
from qdarkstyle.light import style_rc
from qdarkstyle.light import lightstyle_rc
palette = LightPalette
else:
print("Not recognized ID for palette! Exiting!")
@@ -254,7 +254,8 @@ def _load_stylesheet(qt_api='', palette=None):
# Thus, by importing the binary we can access the resources
package_dir = os.path.basename(PACKAGE_PATH)
qss_rc_path = ":" + os.path.join(package_dir, palette.ID, QSS_FILE)
palette_dir = os.path.join(package_dir, palette.ID)
qss_rc_path = ":" + os.path.join(palette_dir, palette.ID + QSS_FILE)
_logger.debug("Reading QSS file in: %s" % qss_rc_path)
+4 -2
View File
@@ -269,7 +269,9 @@ def generate_qrc_file(resource_prefix='qss_icons', style_prefix='qdarkstyle',
palette_path = os.path.join(PACKAGE_PATH, palette.ID)
rc_path = os.path.join(palette_path, 'rc')
qrc_filepath = os.path.join(palette_path, QRC_FILE)
qss_file = palette.ID + QSS_FILE
qrc_file = palette.ID + QRC_FILE
qrc_filepath = os.path.join(palette_path, qrc_file)
resource_prefix = resource_prefix + '/' + palette.ID
style_prefix = style_prefix + '/' + palette.ID
@@ -287,7 +289,7 @@ def generate_qrc_file(resource_prefix='qss_icons', style_prefix='qdarkstyle',
# Join parts
qrc_content = (TEMPLATE_QRC_HEADER.format(resource_prefix=resource_prefix)
+ '\n'.join(files)
+ TEMPLATE_QRC_FOOTER.format(style_prefix=style_prefix, qss_file=QSS_FILE))
+ TEMPLATE_QRC_FOOTER.format(style_prefix=style_prefix, qss_file=qss_file))
_logger.info("Writing in: %s" % qrc_filepath)
+2 -2
View File
@@ -128,7 +128,7 @@ def create_qss(palette=None):
palette_path = os.path.join(PACKAGE_PATH, palette.ID)
variables_scss_filepath = os.path.join(palette_path, VARIABLES_SCSS_FILE)
main_scss_filepath = os.path.join(palette_path, MAIN_SCSS_FILE)
qss_filepath = os.path.join(palette_path, QSS_FILE)
qss_filepath = os.path.join(palette_path, palette.ID + QSS_FILE)
_create_scss_variables(variables_scss_filepath, palette)
stylesheet = _create_qss(main_scss_filepath, qss_filepath)
@@ -224,7 +224,7 @@ def create_custom_qss(
# Compile SCSS
variables_scss_filepath = os.path.join(theme_qss_path, VARIABLES_SCSS_FILE)
theme_main_scss_filepath = os.path.join(theme_qss_path, MAIN_SCSS_FILE)
theme_qss_filepath = os.path.join(theme_root_path, QSS_FILE)
theme_qss_filepath = os.path.join(theme_root_path, palette.ID + QSS_FILE)
stylesheet = create_qss(
qss_filepath=theme_qss_filepath,
main_scss_filepath=theme_main_scss_filepath,