qrainbowstyle.utils package

Submodules

qrainbowstyle.utils.images module

Utilities to process and convert svg images to png using palette colors.

qrainbowstyle.utils.images.convert_svg_to_png(svg_path, png_path, height, width)[source]

Convert svg files to png files using Qt.

qrainbowstyle.utils.images.create_images(base_svg_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/svg', rc_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/rc', palette=<class 'qrainbowstyle.palette.BasePalette'>)[source]

Create resources rc png image files from base svg files and palette.

Search all SVG files in base_svg_path excluding IMAGE_BLACKLIST, change its colors using palette creating temporary SVG files, for each state generating PNG images for each size heights.

Parameters
  • base_svg_path (str, optional) – Input svgs directory path. Defaults to SVG_PATH.

  • rc_path (str, optional) – Output pngs directory path. Defaults to RC_PATH.

  • palette (BasePalette, optional) – Palette . Defaults to BasePalette.

qrainbowstyle.utils.images.create_palette_image(base_svg_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/svg', path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/images', palette=<class 'qrainbowstyle.palette.BasePalette'>)[source]

Create palette image svg and png image on specified path.

qrainbowstyle.utils.images.create_titlebar_images(buttons_svg_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/svg', rc_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/rc', palette=<class 'qrainbowstyle.palette.BasePalette'>)[source]

Create resources rc png image files from titlebar buttons svg files and palette

qrainbowstyle.utils.images.generate_qrc_file(resource_prefix='qss_icons', style_prefix='qrainbowstyle', rc_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/rc', qrc_path='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/style.qrc')[source]

Generate the QRC file programmaticaly.

Search all RC folder for PNG images and create a QRC file.

Parameters
  • resource_prefix (str, optional) – Prefix used in resources. Defaults to ‘qss_icons’.

  • style_prefix (str, optional) – Prefix used to this style. Defaults to ‘qrainbowstyle’.

  • rc_path (str, optional) – Source path Defaults to ‘RC_PATH’

  • qrc_path (str, optional) – Output path Defaults to ‘QRC_FILEPATH’

Get all rc links from scss file returning the list of unique links.

Parameters

pattern (str) – regex pattern to find the links.

Returns

list of unique links found.

Return type

list(str)

qrainbowstyle.utils.scss module

Utilities for compiling SASS files.

qrainbowstyle.utils.scss.create_custom_qss(palette, name, path, color_background_light, color_background_normal, color_background_dark, color_foreground_light, color_foreground_normal, color_foreground_dark, color_selection_light, color_selection_normal, color_selection_dark, border_radius)[source]

Create a custom palette based on the parameters defined.

The name must be a valid Python identifier and will be stored as a lowercased folder (even if the identifier had uppercase letters).

This fuction returns the custom stylesheet pointing to resources stored at …/path/name/.

qrainbowstyle.utils.scss.create_custom_qss_from_palette(name, path, palette)[source]

Create a custom palette based on a palette class.

qrainbowstyle.utils.scss.create_qss(qss_filepath='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/style.qss', main_scss_filepath='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/qss/main.scss', variables_scss_filepath='/home/runner/work/QRainbowStyleSheet/QRainbowStyleSheet/qrainbowstyle/qss/_variables.scss', palette=<class 'qrainbowstyle.palette.BasePalette'>)[source]

Create variables files and run qtsass compilation.

qrainbowstyle.utils.scss.is_identifier(name)[source]

Check that name string is a valid identifier in Python.

Module contents

Utilities for processing SASS and images from default and custom palette.