mirror of
https://github.com/ColinDuquesnoy/QDarkStyleSheet.git
synced 2026-08-29 16:40:31 +08:00
Name qrc and qss files with prefix of palette ID to keep them working on C++
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user