aboutsummaryrefslogtreecommitdiff
path: root/modules/styles.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-01-14 14:56:39 +0300
committerAUTOMATIC <16777216c@gmail.com>2023-01-14 14:56:39 +0300
commit865228a83736bea9ede33e98041f2a7d0ca5daaa (patch)
treefd19dba380e50d3155050259e9da57c6434f14e6 /modules/styles.py
parent6eb72fd13f34d94d5459290dd1a0bf0e9ddeda82 (diff)
change style dropdowns to multiselect
Diffstat (limited to 'modules/styles.py')
-rw-r--r--modules/styles.py12
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