aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-22 10:34:49 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-22 10:34:49 +0000
commit6398dc9b1049f242576ca309f95a3fb1e654951c (patch)
tree1a1ed8a712fa20df2d1c23eb9a6803051a980991 /modules/ui.py
parent2b91251637078e04472c91a06a8d9c4db9c1dcf0 (diff)
downloadstable-diffusion-webui-gfx803-6398dc9b1049f242576ca309f95a3fb1e654951c.tar.gz
stable-diffusion-webui-gfx803-6398dc9b1049f242576ca309f95a3fb1e654951c.tar.bz2
stable-diffusion-webui-gfx803-6398dc9b1049f242576ca309f95a3fb1e654951c.zip
further support for extensions
Diffstat (limited to 'modules/ui.py')
-rw-r--r--modules/ui.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/modules/ui.py b/modules/ui.py
index c977482c..29986124 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -1636,13 +1636,15 @@ Requested path was: {f}
interfaces += [(settings_interface, "Settings", "settings")]
- with open(os.path.join(script_path, "style.css"), "r", encoding="utf8") as file:
- css = file.read()
+ css = ""
+
+ for cssfile in modules.scripts.list_files_with_name("style.css"):
+ with open(cssfile, "r", encoding="utf8") as file:
+ css += file.read() + "\n"
if os.path.exists(os.path.join(script_path, "user.css")):
with open(os.path.join(script_path, "user.css"), "r", encoding="utf8") as file:
- usercss = file.read()
- css += usercss
+ css += file.read() + "\n"
if not cmd_opts.no_progressbar_hiding:
css += css_hide_progressbar
@@ -1865,9 +1867,9 @@ def load_javascript(raw_response):
with open(os.path.join(script_path, "script.js"), "r", encoding="utf8") as jsfile:
javascript = f'<script>{jsfile.read()}</script>'
- jsdir = os.path.join(script_path, "javascript")
- for filename in sorted(os.listdir(jsdir)):
- with open(os.path.join(jsdir, filename), "r", encoding="utf8") as jsfile:
+ scripts_list = modules.scripts.list_scripts("javascript", ".js")
+ for basedir, filename, path in scripts_list:
+ with open(path, "r", encoding="utf8") as jsfile:
javascript += f"\n<!-- {filename} --><script>{jsfile.read()}</script>"
if cmd_opts.theme is not None:
@@ -1885,6 +1887,5 @@ def load_javascript(raw_response):
gradio.routes.templates.TemplateResponse = template_response
-reload_javascript = partial(load_javascript,
- gradio.routes.templates.TemplateResponse)
+reload_javascript = partial(load_javascript, gradio.routes.templates.TemplateResponse)
reload_javascript()