mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
fix en refresh
This commit is contained in:
+1
-1
@@ -65,7 +65,7 @@ class StyleDatabase:
|
||||
def reload(self):
|
||||
self.styles.clear()
|
||||
for fn in os.listdir(self.path):
|
||||
if not fn.endswith(".json"):
|
||||
if not fn.lower().endswith(".json"):
|
||||
continue
|
||||
with open(os.path.join(self.path, fn), 'r', encoding='utf-8') as f:
|
||||
try:
|
||||
|
||||
@@ -369,6 +369,7 @@ def create_ui(container, button, tabname, skip_indexing = False):
|
||||
for page in extra_pages:
|
||||
if title == '' or title == page.title or len(page.html) == 0:
|
||||
page.refresh()
|
||||
page.refresh_time = None
|
||||
page.create_page(ui.tabname)
|
||||
shared.log.debug(f"Refreshing Extra networks: page={page.title} items={len(page.items)} tab={ui.tabname}")
|
||||
res.append(page.html)
|
||||
|
||||
@@ -13,20 +13,19 @@ class ExtraNetworksPageStyles(ui_extra_networks.ExtraNetworksPage):
|
||||
shared.prompt_styles.reload()
|
||||
|
||||
def list_items(self):
|
||||
styles = list(shared.prompt_styles.styles)
|
||||
for style in styles:
|
||||
path = os.path.join(shared.opts.styles_dir, style)
|
||||
txt = f'Prompt: {shared.prompt_styles.styles[style].prompt}'
|
||||
negative = shared.prompt_styles.styles[style].negative_prompt
|
||||
for k in shared.prompt_styles.styles.keys():
|
||||
path = os.path.join(shared.opts.styles_dir, k)
|
||||
txt = f'Prompt: {shared.prompt_styles.styles[k].prompt}'
|
||||
negative = shared.prompt_styles.styles[k].negative_prompt
|
||||
if negative is not None and len(negative) > 0:
|
||||
txt += f'\nNegative: {negative}'
|
||||
yield {
|
||||
"name": style,
|
||||
"name": k,
|
||||
"search_term": path,
|
||||
"filename": path,
|
||||
"preview": self.find_preview(path),
|
||||
"description": txt,
|
||||
"onclick": '"' + html.escape(f"""return selectStyle({json.dumps(style)})""") + '"',
|
||||
"onclick": '"' + html.escape(f"""return selectStyle({json.dumps(k)})""") + '"',
|
||||
"local_preview": f"{path}.{shared.opts.samples_format}",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user