UN-GCPDS / qt-material

Material inspired stylesheet for PySide2, PySide6, PyQt5 and PyQt6
https://qt-material.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
2.27k stars 241 forks source link

How will the jinja conditionals work with exported qss? #46

Open pstavirs opened 2 years ago

pstavirs commented 2 years ago

I noticed some conditionals in the jinja template. I assume they will be evaluated during build_stylesheet - so for exported themes, the values in the environment during the export will be applicable and the deployed Qt/C++ with QSS has no effect?

YeisonCardona commented 2 years ago

Hi

Here an example:

from qt_material import export_theme

extra = {

    # Button colors
    'danger': '#dc3545',
    'warning': '#ffc107',
    'success': '#17a2b8',

    # Font
    'font_family': 'monoespace',
    'font_size': '13px',
    'line_height': '13px',

    # Density Scale
    'density_scale': '0',

    # environ
    'pyside2': True,
    'linux': True,

}

export_theme(theme='dark_teal.xml', qss='dark_teal.qss', rcc='resources.rcc',
             output='theme', prefix='icon:/', invert_secondary=False, extra=extra)
pstavirs commented 2 years ago

@YeisonCardona This won't work because the linux variable is evaluated at the time of export, not at run time.

Consider a cross-platform Qt/C++ app which includes the exported .qss - the same app can run on windows or on linux. If the linux var was set during export, the app running on windows will end up using the linux CSS and vice versa.