mirror of
https://github.com/ColinDuquesnoy/QDarkStyleSheet.git
synced 2026-08-30 00:50:30 +08:00
Remove prints and enhance log messages
This commit is contained in:
+14
-14
@@ -103,12 +103,12 @@ def create_palette_image(base_svg_path=SVG_PATH, path=IMAGES_PATH,
|
||||
_ = QApplication([])
|
||||
|
||||
if palette is None:
|
||||
print("Please pass a palette class in order to create its "
|
||||
_logger.error("Please pass a palette class in order to create its "
|
||||
"associated images")
|
||||
sys.exit(1)
|
||||
|
||||
if palette.ID is None:
|
||||
print("A QDarkStyle palette requires an ID!")
|
||||
_logger.error("A QDarkStyle palette requires an ID!")
|
||||
sys.exit(1)
|
||||
|
||||
base_palette_svg_path = os.path.join(base_svg_path, 'base_palette.svg')
|
||||
@@ -153,12 +153,12 @@ def create_images(base_svg_path=SVG_PATH, rc_path=None, palette=None):
|
||||
_ = QApplication([])
|
||||
|
||||
if palette is None:
|
||||
print("Please pass a palette class in order to create its "
|
||||
_logger.error("Please pass a palette class in order to create its "
|
||||
"associated file")
|
||||
sys.exit(1)
|
||||
|
||||
if palette.ID is None:
|
||||
print("A QDarkStyle palette requires an ID!")
|
||||
_logger.error("A QDarkStyle palette requires an ID!")
|
||||
sys.exit(1)
|
||||
|
||||
if not rc_path:
|
||||
@@ -201,7 +201,7 @@ def create_images(base_svg_path=SVG_PATH, rc_path=None, palette=None):
|
||||
svg_path = os.path.join(base_svg_path, svg_fname)
|
||||
color_files = _get_file_color_map(svg_fname, palette=palette)
|
||||
|
||||
_logger.debug(" Working on: %s"
|
||||
_logger.log(logging.NOTSET, " Working on: %s"
|
||||
% os.path.basename(svg_fname))
|
||||
|
||||
# Replace colors and create all file for different states
|
||||
@@ -213,7 +213,7 @@ def create_images(base_svg_path=SVG_PATH, rc_path=None, palette=None):
|
||||
png_path = os.path.join(rc_path, png_fname)
|
||||
convert_svg_to_png(temp_svg_path, png_path, height, width)
|
||||
num_png += 1
|
||||
_logger.debug(" Creating: %s"
|
||||
_logger.log(logging.NOTSET, " Creating: %s"
|
||||
% os.path.basename(png_fname))
|
||||
|
||||
# Check if the rc_name is in the rc_list from scss
|
||||
@@ -259,12 +259,12 @@ def generate_qrc_file(resource_prefix='qss_icons', style_prefix='qdarkstyle',
|
||||
files = []
|
||||
|
||||
if palette is None:
|
||||
print("Please pass a palette class in order to create its "
|
||||
_logger.error("Please pass a palette class in order to create its "
|
||||
"qrc file")
|
||||
sys.exit(1)
|
||||
|
||||
if palette.ID is None:
|
||||
print("A QDarkStyle palette requires an ID!")
|
||||
_logger.error("A QDarkStyle palette requires an ID!")
|
||||
sys.exit(1)
|
||||
|
||||
rc_path = os.path.join(PACKAGE_PATH, palette.ID, 'rc')
|
||||
@@ -382,35 +382,35 @@ def compile_qrc_file(compile_for='qtpy', qrc_path=None, palette=None):
|
||||
|
||||
# calling external commands
|
||||
if compile_for in ['pyqt', 'pyqtgraph', 'all']:
|
||||
_logger.info("Compiling for PyQt4 ...")
|
||||
_logger.info("Compiling using PyQt4 ...")
|
||||
try:
|
||||
subprocess.call(['pyrcc4', '-py3', qrc_file, '-o', py_file_pyqt], shell=shell)
|
||||
except FileNotFoundError:
|
||||
_logger.error("You must install pyrcc4")
|
||||
|
||||
if compile_for in ['pyqt5', 'qtpy', 'all']:
|
||||
_logger.info("Compiling for PyQt5 ...")
|
||||
_logger.info("Compiling using PyQt5 ...")
|
||||
try:
|
||||
subprocess.call(['pyrcc5', qrc_file, '-o', py_file_pyqt5], shell=shell)
|
||||
except FileNotFoundError:
|
||||
_logger.error("You must install pyrcc5")
|
||||
|
||||
if compile_for in ['pyside', 'all']:
|
||||
_logger.info("Compiling for PySide ...")
|
||||
_logger.info("Compiling using PySide ...")
|
||||
try:
|
||||
subprocess.call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside], shell=shell)
|
||||
except FileNotFoundError:
|
||||
_logger.error("You must install pyside-rcc")
|
||||
|
||||
if compile_for in ['pyside2', 'all']:
|
||||
_logger.info("Compiling for PySide 2...")
|
||||
_logger.info("Compiling using PySide 2...")
|
||||
try:
|
||||
subprocess.call(['pyside2-rcc', qrc_file, '-o', py_file_pyside2], shell=shell)
|
||||
except FileNotFoundError:
|
||||
_logger.error("You must install pyside2-rcc")
|
||||
|
||||
if compile_for in ['qtpy', 'all']:
|
||||
_logger.info("Compiling for QtPy ...")
|
||||
_logger.info("Converting for QtPy ...")
|
||||
# special case - qtpy - syntax is PyQt5
|
||||
with open(py_file_pyqt5, 'r') as file:
|
||||
filedata = file.read()
|
||||
@@ -426,7 +426,7 @@ def compile_qrc_file(compile_for='qtpy', qrc_path=None, palette=None):
|
||||
os.remove(py_file_pyqt5)
|
||||
|
||||
if compile_for in ['pyqtgraph', 'all']:
|
||||
_logger.info("Compiling for PyQtGraph ...")
|
||||
_logger.info("Converting for PyQtGraph ...")
|
||||
# special case - pyqtgraph - syntax is PyQt4
|
||||
with open(py_file_pyqt, 'r') as file:
|
||||
filedata = file.read()
|
||||
|
||||
Reference in New Issue
Block a user