Allow use of mutiple styles csv files #14125
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add support for multiple style files, using a wildcard in the CSV file name, e.g.
style*.csv
; this allows users to split styles between different CSV files (e.g. photographic, illustrative, etc.) and use downloaded CSV files (e.g. the Fooocus style list) without needing to merge them into one single file.All code changes are within the
styles.py
file; no changes required elsewhere within the application to support this. Interfaces to exposed functions/methods have not been broken.[Feature Request]: Allow use of multiple CSV files for Styles #14122
Handles edge-case where style text includes multiple
{prompt}
s, causing split into more than two partsUses try-except with a print statement to warn about "invalid" style text
[Bug]: Error when clicking on the 'Paste' button in case styles.csv file contain 2 instances of {prompt} in the same line #14005
Usage
To enable the multiple CSV functionality it is sufficient to add or amend the
--styles-file
command-line argument to include a wildcard*
in the CSV file name, e.g.--styles-file=\path\to\styles*.csv
. This will load all files matching the wildcarded file name.The styles drop-down groups styles according to the file they were loaded from and inserts markers within the list to indicate which file the subsequent styles have been loaded from.
Edited styles are pushed to the bottom of the list of styles (no change to existing behavior). When an existing style is edited and saved, it will be saved to the same file that it was loaded from. New styles are always added back to the default
styles.csv
.If the command line argument is omitted, or points to exactly one file, then the default behavior of using just that one file is maintained.
Checklist: