Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
fbb25fab
Unverified
Commit
fbb25fab
authored
Jan 22, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jan 22, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7024 from mezotaken/master
Fix followup to #7022
parents
f2eae612
e5520232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
xy_grid.py
scripts/xy_grid.py
+8
-9
No files found.
scripts/xy_grid.py
View file @
fbb25fab
...
@@ -293,17 +293,17 @@ class Script(scripts.Script):
...
@@ -293,17 +293,17 @@ class Script(scripts.Script):
return
"X/Y plot"
return
"X/Y plot"
def
ui
(
self
,
is_img2img
):
def
ui
(
self
,
is_img2img
):
current_axis_options
=
[
x
for
x
in
axis_options
if
type
(
x
)
==
AxisOption
or
x
.
is_img2img
==
is_img2img
]
self
.
current_axis_options
=
[
x
for
x
in
axis_options
if
type
(
x
)
==
AxisOption
or
x
.
is_img2img
==
is_img2img
]
with
gr
.
Row
():
with
gr
.
Row
():
with
gr
.
Column
(
scale
=
19
):
with
gr
.
Column
(
scale
=
19
):
with
gr
.
Row
():
with
gr
.
Row
():
x_type
=
gr
.
Dropdown
(
label
=
"X type"
,
choices
=
[
x
.
label
for
x
in
current_axis_options
],
value
=
current_axis_options
[
1
]
.
label
,
type
=
"index"
,
elem_id
=
self
.
elem_id
(
"x_type"
))
x_type
=
gr
.
Dropdown
(
label
=
"X type"
,
choices
=
[
x
.
label
for
x
in
self
.
current_axis_options
],
value
=
self
.
current_axis_options
[
1
]
.
label
,
type
=
"index"
,
elem_id
=
self
.
elem_id
(
"x_type"
))
x_values
=
gr
.
Textbox
(
label
=
"X values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"x_values"
))
x_values
=
gr
.
Textbox
(
label
=
"X values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"x_values"
))
fill_x_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"xy_grid_fill_x_tool_button"
,
visible
=
False
)
fill_x_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"xy_grid_fill_x_tool_button"
,
visible
=
False
)
with
gr
.
Row
():
with
gr
.
Row
():
y_type
=
gr
.
Dropdown
(
label
=
"Y type"
,
choices
=
[
x
.
label
for
x
in
current_axis_options
],
value
=
current_axis_options
[
0
]
.
label
,
type
=
"index"
,
elem_id
=
self
.
elem_id
(
"y_type"
))
y_type
=
gr
.
Dropdown
(
label
=
"Y type"
,
choices
=
[
x
.
label
for
x
in
self
.
current_axis_options
],
value
=
self
.
current_axis_options
[
0
]
.
label
,
type
=
"index"
,
elem_id
=
self
.
elem_id
(
"y_type"
))
y_values
=
gr
.
Textbox
(
label
=
"Y values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"y_values"
))
y_values
=
gr
.
Textbox
(
label
=
"Y values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"y_values"
))
fill_y_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"xy_grid_fill_y_tool_button"
,
visible
=
False
)
fill_y_button
=
ToolButton
(
value
=
fill_values_symbol
,
elem_id
=
"xy_grid_fill_y_tool_button"
,
visible
=
False
)
...
@@ -314,21 +314,20 @@ class Script(scripts.Script):
...
@@ -314,21 +314,20 @@ class Script(scripts.Script):
swap_axes_button
=
gr
.
Button
(
value
=
"Swap axes"
,
elem_id
=
"xy_grid_swap_axes_button"
)
swap_axes_button
=
gr
.
Button
(
value
=
"Swap axes"
,
elem_id
=
"xy_grid_swap_axes_button"
)
def
swap_axes
(
x_type
,
x_values
,
y_type
,
y_values
):
def
swap_axes
(
x_type
,
x_values
,
y_type
,
y_values
):
nonlocal
current_axis_options
return
self
.
current_axis_options
[
y_type
]
.
label
,
y_values
,
self
.
current_axis_options
[
x_type
]
.
label
,
x_values
return
current_axis_options
[
y_type
]
.
label
,
y_values
,
current_axis_options
[
x_type
]
.
label
,
x_values
swap_args
=
[
x_type
,
x_values
,
y_type
,
y_values
]
swap_args
=
[
x_type
,
x_values
,
y_type
,
y_values
]
swap_axes_button
.
click
(
swap_axes
,
inputs
=
swap_args
,
outputs
=
swap_args
)
swap_axes_button
.
click
(
swap_axes
,
inputs
=
swap_args
,
outputs
=
swap_args
)
def
fill
(
x_type
):
def
fill
(
x_type
):
axis
=
current_axis_options
[
x_type
]
axis
=
self
.
current_axis_options
[
x_type
]
return
", "
.
join
(
axis
.
choices
())
if
axis
.
choices
else
gr
.
update
()
return
", "
.
join
(
axis
.
choices
())
if
axis
.
choices
else
gr
.
update
()
fill_x_button
.
click
(
fn
=
fill
,
inputs
=
[
x_type
],
outputs
=
[
x_values
])
fill_x_button
.
click
(
fn
=
fill
,
inputs
=
[
x_type
],
outputs
=
[
x_values
])
fill_y_button
.
click
(
fn
=
fill
,
inputs
=
[
y_type
],
outputs
=
[
y_values
])
fill_y_button
.
click
(
fn
=
fill
,
inputs
=
[
y_type
],
outputs
=
[
y_values
])
def
select_axis
(
x_type
):
def
select_axis
(
x_type
):
return
gr
.
Button
.
update
(
visible
=
current_axis_options
[
x_type
]
.
choices
is
not
None
)
return
gr
.
Button
.
update
(
visible
=
self
.
current_axis_options
[
x_type
]
.
choices
is
not
None
)
x_type
.
change
(
fn
=
select_axis
,
inputs
=
[
x_type
],
outputs
=
[
fill_x_button
])
x_type
.
change
(
fn
=
select_axis
,
inputs
=
[
x_type
],
outputs
=
[
fill_x_button
])
y_type
.
change
(
fn
=
select_axis
,
inputs
=
[
y_type
],
outputs
=
[
fill_y_button
])
y_type
.
change
(
fn
=
select_axis
,
inputs
=
[
y_type
],
outputs
=
[
fill_y_button
])
...
@@ -403,10 +402,10 @@ class Script(scripts.Script):
...
@@ -403,10 +402,10 @@ class Script(scripts.Script):
return
valslist
return
valslist
x_opt
=
axis_options
[
x_type
]
x_opt
=
self
.
current_
axis_options
[
x_type
]
xs
=
process_axis
(
x_opt
,
x_values
)
xs
=
process_axis
(
x_opt
,
x_values
)
y_opt
=
axis_options
[
y_type
]
y_opt
=
self
.
current_
axis_options
[
y_type
]
ys
=
process_axis
(
y_opt
,
y_values
)
ys
=
process_axis
(
y_opt
,
y_values
)
def
fix_axis_seeds
(
axis_opt
,
axis_list
):
def
fix_axis_seeds
(
axis_opt
,
axis_list
):
...
...
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