diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-14 11:56:39 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-14 11:56:39 +0000 |
commit | 865228a83736bea9ede33e98041f2a7d0ca5daaa (patch) | |
tree | fd19dba380e50d3155050259e9da57c6434f14e6 /modules/styles.py | |
parent | 6eb72fd13f34d94d5459290dd1a0bf0e9ddeda82 (diff) | |
download | stable-diffusion-webui-gfx803-865228a83736bea9ede33e98041f2a7d0ca5daaa.tar.gz stable-diffusion-webui-gfx803-865228a83736bea9ede33e98041f2a7d0ca5daaa.tar.bz2 stable-diffusion-webui-gfx803-865228a83736bea9ede33e98041f2a7d0ca5daaa.zip |
change style dropdowns to multiselect
Diffstat (limited to 'modules/styles.py')
-rw-r--r-- | modules/styles.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/styles.py b/modules/styles.py index ce6e71ca..990d5623 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -40,12 +40,18 @@ def apply_styles_to_prompt(prompt, styles): class StyleDatabase:
def __init__(self, path: str):
self.no_style = PromptStyle("None", "", "")
- self.styles = {"None": self.no_style}
+ self.styles = {}
+ self.path = path
- if not os.path.exists(path):
+ self.reload()
+
+ def reload(self):
+ self.styles.clear()
+
+ if not os.path.exists(self.path):
return
- with open(path, "r", encoding="utf-8-sig", newline='') as file:
+ with open(self.path, "r", encoding="utf-8-sig", newline='') as file:
reader = csv.DictReader(file)
for row in reader:
# Support loading old CSV format with "name, text"-columns
|