diff --git a/TODO.md b/TODO.md
index 6db7b5426..1f82ea050 100644
--- a/TODO.md
+++ b/TODO.md
@@ -95,3 +95,4 @@ Tech that can be integrated as part of the core workflow...
- force unload `xformers` when not used, improves compatibility with AMD/M1
- add `styles.csv` to UI settings to allow customizing path
- add `--disable-queue` to cmd flags that disables Gradio queues and forces it to use HTTP instead of WebSockets
+- allow scripts & extensions to set loading priority, fixes `ScuNet`
diff --git a/javascript/black-orange.css b/javascript/black-orange.css
index fefb87908..8c1e7de1e 100644
--- a/javascript/black-orange.css
+++ b/javascript/black-orange.css
@@ -106,8 +106,8 @@ svg.feather.feather-image, .feather .feather-image { display: none }
/* custom elements overrides */
#steps-animation, #controlnet { border-width: 0; }
-/* gradio built-in theme */
-.dark {
+/* based on gradio built-in dark theme */
+:root {
--body-background-fill: black;
--body-text-color: var(--neutral-100);
--color-accent-soft: var(--neutral-700);
diff --git a/modules/extensions.py b/modules/extensions.py
index 9efc56b8f..349c8e671 100644
--- a/modules/extensions.py
+++ b/modules/extensions.py
@@ -71,9 +71,7 @@ class Extension:
if os.path.isfile(os.path.join(dirpath, "..", ".priority")):
with open(os.path.join(dirpath, "..", ".priority"), "r", encoding="utf-8") as f:
priority = str(f.read().strip())
- _fn, ext = os.path.splitext(filename)
- if ext == '.py':
- res.append(scripts.ScriptFile(self.path, filename, os.path.join(dirpath, filename), priority))
+ res.append(scripts.ScriptFile(self.path, filename, os.path.join(dirpath, filename), priority))
res = [x for x in res if os.path.splitext(x.path)[1].lower() == extension and os.path.isfile(x.path)]
diff --git a/modules/scripts.py b/modules/scripts.py
index 9fc9fa143..ec716492b 100644
--- a/modules/scripts.py
+++ b/modules/scripts.py
@@ -196,9 +196,7 @@ def list_scripts(scriptdirname, extension):
with open(os.path.join(base, "..", ".priority"), "r", encoding="utf-8") as f:
priority = str(f.read().strip())
for filename in sorted(os.listdir(base)):
- _fn, ext = os.path.splitext(filename)
- if ext == '.py':
- scripts_list.append(ScriptFile(paths.script_path, filename, os.path.join(base, filename), priority))
+ scripts_list.append(ScriptFile(paths.script_path, filename, os.path.join(base, filename), priority))
for ext in extensions.active():
scripts_list += ext.list_files(scriptdirname, extension)
diff --git a/modules/ui.py b/modules/ui.py
index cba8d63de..6fd61f864 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -1689,55 +1689,52 @@ def webpath(fn):
return f'file={web_path}?{os.path.getmtime(fn)}'
-def javascript_html():
+def html_head():
script_js = os.path.join(script_path, "script.js")
head = f'\n'
+ for script in modules.scripts.list_scripts("javascript", ".js"):
+ head += f'\n'
+ for script in modules.scripts.list_scripts("javascript", ".mjs"):
+ head += f'\n'
+ return head
+
+def html_body():
+ body = ''
# inline = f"{localization.localization_js(shared.opts.localization)};"
inline = ''
if cmd_opts.theme is not None:
inline += f"set_theme('{cmd_opts.theme}');"
elif opts.gradio_theme == 'black-orange':
inline += "set_theme('dark');"
-
- for script in modules.scripts.list_scripts("javascript", ".js"):
- head += f'\n'
-
- for script in modules.scripts.list_scripts("javascript", ".mjs"):
- head += f'\n'
-
- head += f'\n'
-
- return head
+ body += f'\n'
+ return body
-def css_html():
+def html_css():
head = ""
-
def stylesheet(fn):
return f''
-
for cssfile in modules.scripts.list_files_with_name("style.css"):
if not os.path.isfile(cssfile):
continue
head += stylesheet(cssfile)
-
if opts.gradio_theme == 'black-orange':
head += stylesheet(os.path.join(data_path, "javascript", "black-orange.css"))
if os.path.exists(os.path.join(data_path, "user.css")):
head += stylesheet(os.path.join(data_path, "user.css"))
-
return head
def reload_javascript():
- js = javascript_html()
- css = css_html()
+ head = html_head()
+ css = html_css()
+ body = html_body()
def template_response(*args, **kwargs):
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
- res.body = res.body.replace(b'', f'{js}'.encode("utf8"))
- res.body = res.body.replace(b'