Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
eae0bb89
Commit
eae0bb89
authored
Jan 27, 2024
by
w-e-w
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set_named_arg fuzzy option
parent
36d1fefc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
modules/scripts.py
modules/scripts.py
+3
-2
No files found.
modules/scripts.py
View file @
eae0bb89
...
@@ -939,13 +939,14 @@ class ScriptRunner:
...
@@ -939,13 +939,14 @@ class ScriptRunner:
except
Exception
:
except
Exception
:
errors
.
report
(
f
"Error running setup: {script.filename}"
,
exc_info
=
True
)
errors
.
report
(
f
"Error running setup: {script.filename}"
,
exc_info
=
True
)
def
set_named_arg
(
self
,
args
,
script_name
,
arg_elem_id
,
value
):
def
set_named_arg
(
self
,
args
,
script_name
,
arg_elem_id
,
value
,
fuzzy
=
False
):
"""Locate an arg of a specific script in script_args and set its value
"""Locate an arg of a specific script in script_args and set its value
Args:
Args:
args: all script args of process p, p.script_args
args: all script args of process p, p.script_args
script_name: the name target script name to
script_name: the name target script name to
arg_elem_id: the elem_id of the target arg
arg_elem_id: the elem_id of the target arg
value: the value to set
value: the value to set
fuzzy: if True, arg_elem_id can be a substring of the control.elem_id else exact match
Returns:
Returns:
Updated script args
Updated script args
when script_name in not found or arg_elem_id is not found in script controls, raise RuntimeError
when script_name in not found or arg_elem_id is not found in script controls, raise RuntimeError
...
@@ -955,7 +956,7 @@ class ScriptRunner:
...
@@ -955,7 +956,7 @@ class ScriptRunner:
raise
RuntimeError
(
f
"script {script_name} not found"
)
raise
RuntimeError
(
f
"script {script_name} not found"
)
for
i
,
control
in
enumerate
(
script
.
controls
):
for
i
,
control
in
enumerate
(
script
.
controls
):
if
arg_elem_id
==
control
.
elem_id
:
if
arg_elem_id
in
control
.
elem_id
if
fuzzy
else
arg_elem_id
==
control
.
elem_id
:
index
=
script
.
args_from
+
i
index
=
script
.
args_from
+
i
if
isinstance
(
args
,
tuple
):
if
isinstance
(
args
,
tuple
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment