mirror of
https://github.com/ColinDuquesnoy/QDarkStyleSheet.git
synced 2026-08-29 16:40:31 +08:00
Make dark images be created on its own directory
This commit is contained in:
committed by
juanis2112
parent
f68903b8dd
commit
4f11708a35
@@ -0,0 +1 @@
|
||||
|
||||
@@ -11,6 +11,9 @@ from qdarkstyle.utils.palette import PaletteMixin
|
||||
class DarkPalette(PaletteMixin):
|
||||
"""Theme variables."""
|
||||
|
||||
# Identifier
|
||||
ID = 'dark'
|
||||
|
||||
# Color
|
||||
COLOR_BACKGROUND_1 = Gray.B10
|
||||
COLOR_BACKGROUND_2 = Gray.B20
|
||||
|
||||
@@ -10,6 +10,7 @@ from __future__ import absolute_import, division, print_function
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Third party imports
|
||||
@@ -88,16 +89,25 @@ def convert_svg_to_png(svg_path, png_path, height, width):
|
||||
|
||||
|
||||
def create_palette_image(base_svg_path=SVG_PATH, path=IMAGES_PATH,
|
||||
palette=DarkPalette):
|
||||
palette=None):
|
||||
"""
|
||||
Create palette image svg and png image on specified path.
|
||||
"""
|
||||
# Needed to use QPixmap
|
||||
_ = QApplication([])
|
||||
|
||||
if palette is None:
|
||||
print("Please pass a palette class in order to create its "
|
||||
"associaciated images")
|
||||
sys.exit(1)
|
||||
|
||||
if palette.ID is None:
|
||||
print("A QDarkStyle palette requires and ID!")
|
||||
sys.exit(1)
|
||||
|
||||
base_palette_svg_path = os.path.join(base_svg_path, 'base_palette.svg')
|
||||
palette_svg_path = os.path.join(path, 'palette.svg')
|
||||
palette_png_path = os.path.join(path, 'palette.png')
|
||||
palette_svg_path = os.path.join(path, palette.ID, 'palette.svg')
|
||||
palette_png_path = os.path.join(path, palette.ID, 'palette.png')
|
||||
|
||||
_logger.info("Creating palette image ...")
|
||||
_logger.info("Base SVG: %s" % base_palette_svg_path)
|
||||
|
||||
@@ -9,6 +9,8 @@ from collections import OrderedDict
|
||||
|
||||
class PaletteMixin(object):
|
||||
|
||||
ID = None
|
||||
|
||||
@classmethod
|
||||
def to_dict(cls, colors_only=False):
|
||||
"""Convert variables to dictionary."""
|
||||
|
||||
@@ -38,6 +38,7 @@ from watchdog.observers import Observer
|
||||
|
||||
# Local imports
|
||||
from qdarkstyle import PACKAGE_PATH
|
||||
from qdarkstyle.darkpalette import DarkPalette
|
||||
from qdarkstyle.utils.images import create_images, create_palette_image, generate_qrc_file
|
||||
from qdarkstyle.utils.scss import create_qss
|
||||
|
||||
@@ -97,7 +98,7 @@ def run_process(args):
|
||||
|
||||
# Create palette and resources png images
|
||||
print('Generating palette image ...')
|
||||
create_palette_image()
|
||||
create_palette_image(palette=DarkPalette)
|
||||
|
||||
print('Generating images ...')
|
||||
create_images()
|
||||
|
||||
Reference in New Issue
Block a user