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
fcbe0f35
Commit
fcbe0f35
authored
Jan 16, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jan 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6802 from space-nuko/xy-grid-swap-axes-button
Add swap axes button for XY Grid
parents
972f5785
2144c2eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
scripts/xy_grid.py
scripts/xy_grid.py
+20
-6
style.css
style.css
+10
-0
No files found.
scripts/xy_grid.py
View file @
fcbe0f35
...
...
@@ -23,6 +23,9 @@ import os
import
re
up_down_arrow_symbol
=
"
\u2195\ufe0f
"
def
apply_field
(
field
):
def
fun
(
p
,
x
,
xs
):
setattr
(
p
,
field
,
x
)
...
...
@@ -291,17 +294,28 @@ class Script(scripts.Script):
current_axis_options
=
[
x
for
x
in
axis_options
if
type
(
x
)
==
AxisOption
or
type
(
x
)
==
AxisOptionImg2Img
and
is_img2img
]
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_values
=
gr
.
Textbox
(
label
=
"X values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"x_values"
))
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_values
=
gr
.
Textbox
(
label
=
"Y values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"y_values"
))
with
gr
.
Column
(
scale
=
1
,
elem_id
=
"xy_grid_button_column"
):
swap_axes_button
=
gr
.
Button
(
value
=
up_down_arrow_symbol
,
elem_id
=
"xy_grid_swap_axes"
)
with
gr
.
Column
(
scale
=
19
):
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_values
=
gr
.
Textbox
(
label
=
"X values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"x_values"
))
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_values
=
gr
.
Textbox
(
label
=
"Y values"
,
lines
=
1
,
elem_id
=
self
.
elem_id
(
"y_values"
))
draw_legend
=
gr
.
Checkbox
(
label
=
'Draw legend'
,
value
=
True
,
elem_id
=
self
.
elem_id
(
"draw_legend"
))
include_lone_images
=
gr
.
Checkbox
(
label
=
'Include Separate Images'
,
value
=
False
,
elem_id
=
self
.
elem_id
(
"include_lone_images"
))
no_fixed_seeds
=
gr
.
Checkbox
(
label
=
'Keep -1 for seeds'
,
value
=
False
,
elem_id
=
self
.
elem_id
(
"no_fixed_seeds"
))
def
swap_axes
(
x_type
,
x_values
,
y_type
,
y_values
):
nonlocal
current_axis_options
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_axes_button
.
click
(
swap_axes
,
inputs
=
swap_args
,
outputs
=
swap_args
)
return
[
x_type
,
x_values
,
y_type
,
y_values
,
draw_legend
,
include_lone_images
,
no_fixed_seeds
]
def
run
(
self
,
p
,
x_type
,
x_values
,
y_type
,
y_values
,
draw_legend
,
include_lone_images
,
no_fixed_seeds
):
...
...
style.css
View file @
fcbe0f35
...
...
@@ -717,6 +717,16 @@ footer {
line-height
:
2.4em
;
}
#xy_grid_button_column
{
min-width
:
38px
!important
;
}
#xy_grid_button_column
button
{
height
:
100%
;
margin-bottom
:
0.7em
;
margin-left
:
1em
;
}
/* The following handles localization for right-to-left (RTL) languages like Arabic.
The rtl media type will only be activated by the logic in javascript/localization.js.
If you change anything above, you need to make sure it is RTL compliant by just running
...
...
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