diff --git a/README.md b/README.md index b3416d9..b65079d 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ If you enjoy this project, then come say hi here: ## Installation and usage +### Definitions + +Part - A list of svg elements that make up a part + +Design - A list of Parts that make up a final output + *TODO :)* ## Project structure diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c7cada7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +svgutils +cairosvg +toml \ No newline at end of file diff --git a/src/main.py b/src/main.py index efa51d6..702ae64 100644 --- a/src/main.py +++ b/src/main.py @@ -4,28 +4,28 @@ import toml, os CONFIG["svg.file_path"] = "../assets/" -with open("../definitions.toml", "r") as def_file: +with open("../definitions.toml", "r") as def_file: #Load the part definitions definitions = toml.loads(def_file.read()) -with open("../designs.toml", "r") as design_file: +with open("../designs.toml", "r") as design_file: #Load the user designs designs = toml.loads(design_file.read()) -with open("../config.toml", "r") as config_file: +with open("../config.toml", "r") as config_file: #Load the user config config = toml.loads(config_file.read()) os.makedirs("../output/vector/", exist_ok=True) os.makedirs("../output/" + str(config["raster_size"]) + "/", exist_ok=True) for key in designs: - currentDesign = designs[key] + currentDesign = designs[key] #Select the current design which is a list of parts partsList = [] for part in currentDesign: for url in definitions[part]: - partsList.append(url) - svg_parts = [] + partsList.append(url) #For each part add each element to the list + svg_parts = [] for part in partsList: - svg_parts.append(SVG(part)) - Figure("128","128", *svg_parts, SVG("credits.svg")).save("../output/vector/" + key + ".svg") + svg_parts.append(SVG(part)) #Add each element of the list of paths to a new list as a SVG element + Figure("128","128", *svg_parts, SVG("credits.svg")).save("../output/vector/" + key + ".svg") #Compile all parts into an SVG - if config["raster_images"]: + if config["raster_images"]: #Create png of designated size svg2png( url="../output/vector/" + key + ".svg", write_to="../output/" + str(config["raster_size"]) + "/" + key + ".png", output_width=config["raster_size"]