mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-24 06:48:41 +01:00
template: Don't make dir a constant.
This commit is contained in:
parent
5e5908a013
commit
d9a22726cb
@ -4,13 +4,13 @@ Export colors in various formats.
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from pywal.settings import CACHE_DIR, TEMPLATE_DIR
|
from pywal.settings import CACHE_DIR
|
||||||
from pywal import util
|
from pywal import util
|
||||||
|
|
||||||
|
|
||||||
def template(colors, input_file, output_dir):
|
def template(colors, input_file, output_dir):
|
||||||
"""Read template file, substitute markers and
|
"""Read template file, substitute markers and
|
||||||
save the file elsewhere."""
|
save the file elsewhere."""
|
||||||
# Get the template name.
|
# Get the template name.
|
||||||
template_file = os.path.basename(input_file)
|
template_file = os.path.basename(input_file)
|
||||||
|
|
||||||
@ -30,6 +30,9 @@ def template(colors, input_file, output_dir):
|
|||||||
|
|
||||||
def export_all_templates(colors):
|
def export_all_templates(colors):
|
||||||
"""Export all template files."""
|
"""Export all template files."""
|
||||||
|
# Add the template dir to module path.
|
||||||
|
template_dir = os.path.join(os.path.dirname(__file__), "templates")
|
||||||
|
|
||||||
# Exclude these templates from the loop.
|
# Exclude these templates from the loop.
|
||||||
# The excluded templates need color
|
# The excluded templates need color
|
||||||
# conversion or other intervention.
|
# conversion or other intervention.
|
||||||
@ -44,10 +47,10 @@ def export_all_templates(colors):
|
|||||||
|
|
||||||
# pylint: disable=W0106
|
# pylint: disable=W0106
|
||||||
[template(colors["colors"], file.path, CACHE_DIR)
|
[template(colors["colors"], file.path, CACHE_DIR)
|
||||||
for file in os.scandir(TEMPLATE_DIR)
|
for file in os.scandir(template_dir)
|
||||||
if file.name not in exclude]
|
if file.name not in exclude]
|
||||||
|
|
||||||
# Call 'putty' manually since it needs RGB
|
# Call 'putty' manually since it needs RGB
|
||||||
# colors.
|
# colors.
|
||||||
putty_file = TEMPLATE_DIR / pathlib.Path("colors-putty.reg")
|
putty_file = template_dir / pathlib.Path("colors-putty.reg")
|
||||||
template(colors_rgb, putty_file, CACHE_DIR)
|
template(colors_rgb, putty_file, CACHE_DIR)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
Global Constants.
|
Global Constants.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
@ -11,4 +10,3 @@ __version__ = "0.2.6"
|
|||||||
# Internal variables.
|
# Internal variables.
|
||||||
COLOR_COUNT = 16
|
COLOR_COUNT = 16
|
||||||
CACHE_DIR = pathlib.Path.home() / ".cache/wal/"
|
CACHE_DIR = pathlib.Path.home() / ".cache/wal/"
|
||||||
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user