mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
avoid js double load
This commit is contained in:
@@ -37,7 +37,6 @@ class Extension:
|
||||
self.have_info_from_repo = False
|
||||
self.mtime = 0
|
||||
self.ctime = 0
|
||||
self.script_files = []
|
||||
|
||||
def read_info_from_repo(self):
|
||||
if self.have_info_from_repo:
|
||||
@@ -75,9 +74,6 @@ class Extension:
|
||||
self.remote = None
|
||||
|
||||
def list_files(self, subdir, extension):
|
||||
if len(self.script_files) > 0:
|
||||
return self.script_files
|
||||
|
||||
from modules import scripts
|
||||
dirpath = os.path.join(self.path, subdir)
|
||||
if not os.path.isdir(dirpath):
|
||||
@@ -94,7 +90,6 @@ class Extension:
|
||||
if priority != '50':
|
||||
shared.log.debug(f'Extension priority override: {os.path.dirname(dirpath)}:{priority}')
|
||||
res = [x for x in res if os.path.splitext(x.path)[1].lower() == extension and os.path.isfile(x.path)]
|
||||
self.script_files = res
|
||||
return res
|
||||
|
||||
def check_updates(self):
|
||||
|
||||
+1
-4
@@ -193,11 +193,9 @@ ScriptFile = namedtuple("ScriptFile", ["basedir", "filename", "path", "priority"
|
||||
scripts_data = []
|
||||
postprocessing_scripts_data = []
|
||||
ScriptClassData = namedtuple("ScriptClassData", ["script_class", "path", "basedir", "module"])
|
||||
scripts_list_per_dir = {}
|
||||
|
||||
|
||||
def list_scripts(scriptdirname, extension):
|
||||
if scriptdirname in scripts_list_per_dir:
|
||||
return scripts_list_per_dir[scriptdirname]
|
||||
tmp_list = []
|
||||
base = os.path.join(paths.script_path, scriptdirname)
|
||||
if os.path.exists(base):
|
||||
@@ -227,7 +225,6 @@ def list_scripts(scriptdirname, extension):
|
||||
priority_list.append(ScriptFile(script.basedir, script.filename, script.path, priority))
|
||||
# log.debug(f'Adding script: {script.basedir} {script.filename} {script.path} {priority}')
|
||||
priority_sort = sorted(priority_list, key=lambda item: item.priority + item.path.lower(), reverse=False)
|
||||
scripts_list_per_dir[scriptdirname] = priority_sort
|
||||
return priority_sort
|
||||
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ def create_ui(container, button_parent, tabname, skip_indexing = False):
|
||||
ui.button_save = ToolButton(symbols.book, elem_id=tabname+"_extra_save", visible=False)
|
||||
ui.button_close = ToolButton(symbols.close, elem_id=tabname+"_extra_close")
|
||||
ui.button_model = ToolButton(symbols.refine, elem_id=tabname+"_extra_model", visible=True)
|
||||
ui.search = gr.Textbox('', show_label=False, elem_id=tabname+"_extra_search", placeholder="Search...", elem_classes="textbox", lines=2)
|
||||
ui.search = gr.Textbox('', show_label=False, elem_id=tabname+"_extra_search", placeholder="Search...", elem_classes="textbox", lines=2, container=True)
|
||||
ui.description = gr.Textbox('', show_label=False, elem_id=tabname+"_description", elem_classes="textbox", lines=2, interactive=False)
|
||||
|
||||
if ui.tabname == 'txt2img': # refresh only once
|
||||
|
||||
Reference in New Issue
Block a user