diff options
author | Sj-Si <sjw.jetty@gmail.com> | 2024-01-11 21:37:35 +0000 |
---|---|---|
committer | Sj-Si <sjw.jetty@gmail.com> | 2024-01-11 21:37:35 +0000 |
commit | 036500223de0a3caaa86360a8ad3ed301e4367b0 (patch) | |
tree | f05f0d5fc503d9c35d57bad077a5dab1dfd6569e /modules/ui_gradio_extensions.py | |
parent | 0726a6e12e85a37d1e514f5603acf9f058c11783 (diff) | |
parent | cb5b335acddd126d4f6c990982816c06beb0d6ae (diff) | |
download | stable-diffusion-webui-gfx803-036500223de0a3caaa86360a8ad3ed301e4367b0.tar.gz stable-diffusion-webui-gfx803-036500223de0a3caaa86360a8ad3ed301e4367b0.tar.bz2 stable-diffusion-webui-gfx803-036500223de0a3caaa86360a8ad3ed301e4367b0.zip |
Merge changes from dev
Diffstat (limited to 'modules/ui_gradio_extensions.py')
-rw-r--r-- | modules/ui_gradio_extensions.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/modules/ui_gradio_extensions.py b/modules/ui_gradio_extensions.py index 0d368f8b..f5278d22 100644 --- a/modules/ui_gradio_extensions.py +++ b/modules/ui_gradio_extensions.py @@ -1,17 +1,12 @@ import os
import gradio as gr
-from modules import localization, shared, scripts
-from modules.paths import script_path, data_path, cwd
+from modules import localization, shared, scripts, util
+from modules.paths import script_path, data_path
def webpath(fn):
- if fn.startswith(cwd):
- web_path = os.path.relpath(fn, cwd)
- else:
- web_path = os.path.abspath(fn)
-
- return f'file={web_path}?{os.path.getmtime(fn)}'
+ return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
def javascript_html():
@@ -40,13 +35,11 @@ def css_html(): return f'<link rel="stylesheet" property="stylesheet" href="{webpath(fn)}">'
for cssfile in scripts.list_files_with_name("style.css"):
- if not os.path.isfile(cssfile):
- continue
-
head += stylesheet(cssfile)
- if os.path.exists(os.path.join(data_path, "user.css")):
- head += stylesheet(os.path.join(data_path, "user.css"))
+ user_css = os.path.join(data_path, "user.css")
+ if os.path.exists(user_css):
+ head += stylesheet(user_css)
return head
|