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
97d3ba39
Commit
97d3ba39
authored
Oct 18, 2022
by
ふぁ
Committed by
AUTOMATIC1111
Oct 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scripts to ui-config,json
parent
428080d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
modules/scripts.py
modules/scripts.py
+13
-2
modules/ui.py
modules/ui.py
+5
-0
No files found.
modules/scripts.py
View file @
97d3ba39
...
...
@@ -96,6 +96,7 @@ def wrap_call(func, filename, funcname, *args, default=None, **kwargs):
class
ScriptRunner
:
def
__init__
(
self
):
self
.
scripts
=
[]
self
.
titles
=
[]
def
setup_ui
(
self
,
is_img2img
):
for
script_class
,
path
in
scripts_data
:
...
...
@@ -107,9 +108,10 @@ class ScriptRunner:
self
.
scripts
.
append
(
script
)
titles
=
[
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
)
or
f
"{script.filename} [error]"
for
script
in
self
.
scripts
]
self
.
titles
=
[
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
)
or
f
"{script.filename} [error]"
for
script
in
self
.
scripts
]
dropdown
=
gr
.
Dropdown
(
label
=
"Script"
,
choices
=
[
"None"
]
+
titles
,
value
=
"None"
,
type
=
"index"
)
dropdown
=
gr
.
Dropdown
(
label
=
"Script"
,
choices
=
[
"None"
]
+
self
.
titles
,
value
=
"None"
,
type
=
"index"
)
dropdown
.
save_to_config
=
True
inputs
=
[
dropdown
]
for
script
in
self
.
scripts
:
...
...
@@ -139,6 +141,15 @@ class ScriptRunner:
return
[
ui
.
gr_show
(
True
if
i
==
0
else
args_from
<=
i
<
args_to
)
for
i
in
range
(
len
(
inputs
))]
def
init_field
(
title
):
if
title
==
"None"
:
return
script_index
=
self
.
titles
.
index
(
title
)
script
=
self
.
scripts
[
script_index
]
for
i
in
range
(
script
.
args_from
,
script
.
args_to
):
inputs
[
i
]
.
visible
=
True
dropdown
.
init_field
=
init_field
dropdown
.
change
(
fn
=
select_script
,
inputs
=
[
dropdown
],
...
...
modules/ui.py
View file @
97d3ba39
...
...
@@ -1753,6 +1753,11 @@ Requested path was: {f}
print
(
f
'Warning: Bad ui setting value: {key}: {saved_value}; Default value "{getattr(obj, field)}" will be used instead.'
)
else
:
setattr
(
obj
,
field
,
saved_value
)
if
getattr
(
x
,
'init_field'
,
False
):
try
:
x
.
init_field
(
saved_value
)
except
Exception
:
print
(
f
'Warning: Bad ui setting value: {key}: {saved_value}; Default value "{getattr(obj, field)}" will be used instead.'
)
if
type
(
x
)
in
[
gr
.
Slider
,
gr
.
Radio
,
gr
.
Checkbox
,
gr
.
Textbox
,
gr
.
Number
]
and
x
.
visible
:
apply_field
(
x
,
'visible'
)
...
...
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