コード例 #1
0
ファイル: window.py プロジェクト: branden-akana/octogon-tool
    def update_css(self):
        """Re-read the stylesheet for the window."""
        # compile the scss file
        qtsass.compile_filename(
            "templates/qtsass/window.scss", "sites/style/window.css"
        )

        with open("sites/style/window.css", "r") as f:
            self.setStyleSheet(f.read())
コード例 #2
0
def compile():
    import qtsass
    # Compile SCSS into QSS
    qtsass.compile_filename(os.path.join(dirname, "stylesheets/dark.scss"),
                            os.path.join(dirname, "compiled/dark.qss"))
    qtsass.compile_filename(os.path.join(dirname, "stylesheets/light.scss"),
                            os.path.join(dirname, "compiled/light.qss"))
    # Compile resources defined by style.qrc into a python module
    os.system(f"pyrcc5 {dirname}/stylesheets/main.qrc -o {dirname}/compiled/qtstylish_rc.py")
    # This part is for hot reload
    with open(os.path.join(dirname, "compiled/dark.qss")) as f:
        global DARK
        DARK = f.read()
    with open(os.path.join(dirname, "compiled/light.qss")) as f:
        global LIGHT
        LIGHT = f.read()
コード例 #3
0
ファイル: scss.py プロジェクト: YvanMasterAll/yvan.pyqt.prime
def _create_qss(main_scss_path, qss_filepath, header=HEADER_QSS):
    """Create a styles.qss file from qtsass."""
    data = ''

    qtsass.compile_filename(main_scss_path, qss_filepath,
                            output_style='expanded')

    with open(qss_filepath, 'r') as f:
        data = f.read()

    data = header.format(qtsass.__version__) + data

    with open(qss_filepath, 'w') as f:
        f.write(data)

    return data
コード例 #4
0
def _create_qss(main_scss_path, qss_filepath, header=HEADER_QSS):
    """Create a styles.qss file from qtsass."""
    data = ''
    if QTSASS_INSTALLED:
        qtsass.compile_filename(main_scss_path,
                                qss_filepath,
                                output_style='expanded')

        with open(qss_filepath, 'r') as f:
            data = f.read()

        data = header + data

        with open(qss_filepath, 'w') as f:
            f.write(data)

    return data
コード例 #5
0
def _create_qss(main_scss_path, qss_filepath, header=HEADER_QSS):
    """Create a styles.qss file from qtsass."""

    data = ''

    _logger.info("Generating QSS file ...")
    _logger.info("File path: %s" % os.path.join(main_scss_path, qss_filepath))

    qtsass.compile_filename(main_scss_path,
                            qss_filepath,
                            output_style='expanded')

    with open(qss_filepath, 'r') as f:
        data = f.read()

    data = header.format(qtsass.__version__) + data

    with open(qss_filepath, 'w') as f:
        f.write(data)

    return data
コード例 #6
0
def test_compile_filename_imports(tmpdir):
    """compile_filename with imports."""

    output = tmpdir.join('dark.css')
    qtsass.compile_filename(example('complex', 'dark.scss'), output.strpath)
    assert exists(output.strpath)
コード例 #7
0
def test_compile_filename(tmpdir):
    """compile_filename simple."""

    output = tmpdir.join('dummy.css')
    qtsass.compile_filename(example('dummy.scss'), output.strpath)
    assert exists(output.strpath)