diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-03 19:46:57 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-03 20:31:13 +0000 |
commit | 20549a50cb3c41868ce561c6658bfaa0d20ac7ba (patch) | |
tree | 789d872fc05f12633125c37c0ce88f6a4df8e597 /modules/styles.py | |
parent | 8e840e151917892af8d8681781b231a1fc47d404 (diff) | |
download | stable-diffusion-webui-gfx803-20549a50cb3c41868ce561c6658bfaa0d20ac7ba.tar.gz stable-diffusion-webui-gfx803-20549a50cb3c41868ce561c6658bfaa0d20ac7ba.tar.bz2 stable-diffusion-webui-gfx803-20549a50cb3c41868ce561c6658bfaa0d20ac7ba.zip |
add style editor dialog
rework toprow for img2img and txt2img to use a class with fields
fix the console error when editing checkpoint user metadata
Diffstat (limited to 'modules/styles.py')
-rw-r--r-- | modules/styles.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/styles.py b/modules/styles.py index ec0e1bc5..0740fe1b 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -106,10 +106,7 @@ class StyleDatabase: if os.path.exists(path):
shutil.copy(path, f"{path}.bak")
- fd = os.open(path, os.O_RDWR | os.O_CREAT)
- with os.fdopen(fd, "w", encoding="utf-8-sig", newline='') as file:
- # _fields is actually part of the public API: typing.NamedTuple is a replacement for collections.NamedTuple,
- # and collections.NamedTuple has explicit documentation for accessing _fields. Same goes for _asdict()
+ with open(path, "w", encoding="utf-8-sig", newline='') as file:
writer = csv.DictWriter(file, fieldnames=PromptStyle._fields)
writer.writeheader()
writer.writerows(style._asdict() for k, style in self.styles.items())
|