mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-04-06 21:09:01 +08:00
put code that can cause an exception into its own function for #14120
This commit is contained in:
parent
5ed7daa3d9
commit
ef6b8123dc
@ -560,18 +560,25 @@ class ScriptRunner:
|
|||||||
on_after.clear()
|
on_after.clear()
|
||||||
|
|
||||||
def create_script_ui(self, script):
|
def create_script_ui(self, script):
|
||||||
import modules.api.models as api_models
|
|
||||||
|
|
||||||
script.args_from = len(self.inputs)
|
script.args_from = len(self.inputs)
|
||||||
script.args_to = len(self.inputs)
|
script.args_to = len(self.inputs)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.create_script_ui_inner(script)
|
||||||
|
except Exception:
|
||||||
|
errors.report(f"Error creating UI for {script.name}: ", exc_info=True)
|
||||||
|
|
||||||
|
def create_script_ui_inner(self, script):
|
||||||
|
import modules.api.models as api_models
|
||||||
|
|
||||||
controls = wrap_call(script.ui, script.filename, "ui", script.is_img2img)
|
controls = wrap_call(script.ui, script.filename, "ui", script.is_img2img)
|
||||||
|
|
||||||
if controls is None:
|
if controls is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
|
||||||
script.name = wrap_call(script.title, script.filename, "title", default=script.filename).lower()
|
script.name = wrap_call(script.title, script.filename, "title", default=script.filename).lower()
|
||||||
|
|
||||||
api_args = []
|
api_args = []
|
||||||
|
|
||||||
for control in controls:
|
for control in controls:
|
||||||
@ -606,9 +613,6 @@ class ScriptRunner:
|
|||||||
self.inputs += controls
|
self.inputs += controls
|
||||||
script.args_to = len(self.inputs)
|
script.args_to = len(self.inputs)
|
||||||
|
|
||||||
except Exception:
|
|
||||||
errors.report(f"Error creating UI for {script.name}: ", exc_info=True)
|
|
||||||
|
|
||||||
def setup_ui_for_section(self, section, scriptlist=None):
|
def setup_ui_for_section(self, section, scriptlist=None):
|
||||||
if scriptlist is None:
|
if scriptlist is None:
|
||||||
scriptlist = self.alwayson_scripts
|
scriptlist = self.alwayson_scripts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user