diff options
author | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-03-27 03:47:05 +0000 |
---|---|---|
committer | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-03-27 03:47:05 +0000 |
commit | efac2cf1ab6645f3f5134158c1401c6305c2ffea (patch) | |
tree | 24b69e980c07d03618a6e5b2447704cdb30a6a20 /modules/scripts.py | |
parent | 1d096ed1456c9b9b662477839853621848705e68 (diff) | |
parent | a336c7fe233fa7dff062f5187c0f4d01ab26e80b (diff) | |
download | stable-diffusion-webui-gfx803-efac2cf1ab6645f3f5134158c1401c6305c2ffea.tar.gz stable-diffusion-webui-gfx803-efac2cf1ab6645f3f5134158c1401c6305c2ffea.tar.bz2 stable-diffusion-webui-gfx803-efac2cf1ab6645f3f5134158c1401c6305c2ffea.zip |
Merge branch 'extra-network-preview-lazyload' of https://github.com/missionfloyd/stable-diffusion-webui into extra-network-preview-lazyload
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index 8de19884..d661be4f 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -239,7 +239,15 @@ def load_scripts(): elif issubclass(script_class, scripts_postprocessing.ScriptPostprocessing):
postprocessing_scripts_data.append(ScriptClassData(script_class, scriptfile.path, scriptfile.basedir, module))
- for scriptfile in sorted(scripts_list):
+ def orderby(basedir):
+ # 1st webui, 2nd extensions-builtin, 3rd extensions
+ priority = {os.path.join(paths.script_path, "extensions-builtin"):1, paths.script_path:0}
+ for key in priority:
+ if basedir.startswith(key):
+ return priority[key]
+ return 9999
+
+ for scriptfile in sorted(scripts_list, key=lambda x: [orderby(x.basedir), x]):
try:
if scriptfile.basedir != paths.script_path:
sys.path = [scriptfile.basedir] + sys.path
@@ -513,6 +521,18 @@ def reload_scripts(): scripts_postproc = scripts_postprocessing.ScriptPostprocessingRunner()
+def add_classes_to_gradio_component(comp):
+ """
+ this adds gradio-* to the component for css styling (ie gradio-button to gr.Button), as well as some others
+ """
+
+ comp.elem_classes = ["gradio-" + comp.get_block_name(), *(comp.elem_classes or [])]
+
+ if getattr(comp, 'multiselect', False):
+ comp.elem_classes.append('multiselect')
+
+
+
def IOComponent_init(self, *args, **kwargs):
if scripts_current is not None:
scripts_current.before_component(self, **kwargs)
@@ -521,6 +541,8 @@ def IOComponent_init(self, *args, **kwargs): res = original_IOComponent_init(self, *args, **kwargs)
+ add_classes_to_gradio_component(self)
+
script_callbacks.after_component_callback(self, **kwargs)
if scripts_current is not None:
|