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
77cf346d
Commit
77cf346d
authored
Sep 22, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
settings categories split to columns, remade categories
parent
75b90a5e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
70 deletions
+93
-70
shared.py
modules/shared.py
+61
-47
ui.py
modules/ui.py
+32
-23
No files found.
modules/shared.py
View file @
77cf346d
This diff is collapsed.
Click to expand it.
modules/ui.py
View file @
77cf346d
...
@@ -9,7 +9,6 @@ import random
...
@@ -9,7 +9,6 @@ import random
import
sys
import
sys
import
time
import
time
import
traceback
import
traceback
import
itertools
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
...
@@ -23,7 +22,6 @@ from modules.paths import script_path
...
@@ -23,7 +22,6 @@ from modules.paths import script_path
from
modules.shared
import
opts
,
cmd_opts
from
modules.shared
import
opts
,
cmd_opts
import
modules.shared
as
shared
import
modules.shared
as
shared
from
modules.sd_samplers
import
samplers
,
samplers_for_img2img
from
modules.sd_samplers
import
samplers
,
samplers_for_img2img
import
modules.realesrgan_model
as
realesrgan
import
modules.ldsr_model
import
modules.ldsr_model
import
modules.scripts
import
modules.scripts
import
modules.gfpgan_model
import
modules.gfpgan_model
...
@@ -815,9 +813,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -815,9 +813,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
return
comp
(
label
=
info
.
label
,
value
=
fun
,
**
(
args
or
{}))
return
comp
(
label
=
info
.
label
,
value
=
fun
,
**
(
args
or
{}))
components
=
[]
components
=
[]
keys
=
list
(
opts
.
data_labels
.
keys
())
settings_cols
=
3
items_per_col
=
math
.
ceil
(
len
(
keys
)
/
settings_cols
)
def
run_settings
(
*
args
):
def
run_settings
(
*
args
):
up
=
[]
up
=
[]
...
@@ -843,28 +838,33 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -843,28 +838,33 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
settings_submit
=
gr
.
Button
(
value
=
"Apply settings"
,
variant
=
'primary'
)
settings_submit
=
gr
.
Button
(
value
=
"Apply settings"
,
variant
=
'primary'
)
result
=
gr
.
HTML
()
result
=
gr
.
HTML
()
s
ortedKeys
=
sorted
([(
opts
.
data_labels
[
key
]
.
section
,
key
)
for
key
in
keys
],
key
=
lambda
x
:
x
[
0
])
s
ettings_cols
=
3
groupedKeys
=
itertools
.
groupby
(
sortedKeys
,
key
=
lambda
x
:
x
[
0
]
)
items_per_col
=
int
(
len
(
opts
.
data_labels
)
*
0.9
/
settings_cols
)
for
(
sectionNumber
,
sectionName
),
sectionGroup
in
groupedKeys
:
cols_displayed
=
0
with
gr
.
Row
(
elem_id
=
"settings_header_{}"
.
format
(
sectionNumber
))
.
style
(
equal_height
=
False
):
items_displayed
=
0
gr
.
HTML
(
elem_id
=
"settings_header_text_{}"
.
format
(
sectionNumber
),
value
=
'<h1 class="gr-button-lg">{}</h1>'
.
format
(
sectionName
))
previous_section
=
None
column
=
None
with
gr
.
Row
(
elem_id
=
"settings"
)
.
style
(
equal_height
=
False
):
for
i
,
(
k
,
item
)
in
enumerate
(
opts
.
data_labels
.
items
()):
with
gr
.
Row
(
elem_id
=
"settings_{}"
.
format
(
sectionNumber
))
.
style
(
equal_height
=
False
)
:
if
previous_section
!=
item
.
section
:
columnLookup
=
{}
if
cols_displayed
<
settings_cols
and
(
items_displayed
>=
items_per_col
or
previous_section
is
None
):
for
colNum
,
element
in
zip
(
itertools
.
cycle
(
range
(
settings_cols
)),
sectionGroup
)
:
if
column
is
not
None
:
columnLookup
.
setdefault
(
colNum
,[])
.
append
(
element
)
column
.
__exit__
(
)
for
colno
,
elements
in
sorted
(
columnLookup
.
items
()):
column
=
gr
.
Column
(
variant
=
'panel'
)
with
gr
.
Column
(
variant
=
'panel'
):
column
.
__enter__
()
for
_
,
keyElement
in
elements
:
components
.
append
(
create_setting_component
(
keyElement
))
settings_submit
.
click
(
items_displayed
=
0
fn
=
run_settings
,
cols_displayed
+=
1
inputs
=
components
,
outputs
=
[
result
]
previous_section
=
item
.
section
)
gr
.
HTML
(
elem_id
=
"settings_header_text_{}"
.
format
(
item
.
section
[
0
]),
value
=
'<h1 class="gr-button-lg">{}</h1>'
.
format
(
item
.
section
[
1
]))
components
.
append
(
create_setting_component
(
k
))
items_displayed
+=
1
request_notifications
=
gr
.
Button
(
value
=
'Request browser notifications'
,
elem_id
=
"request_notifications"
)
request_notifications
=
gr
.
Button
(
value
=
'Request browser notifications'
,
elem_id
=
"request_notifications"
)
request_notifications
.
click
(
request_notifications
.
click
(
...
@@ -874,6 +874,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -874,6 +874,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
_js
=
'function(){}'
_js
=
'function(){}'
)
)
if
column
is
not
None
:
column
.
__exit__
()
settings_submit
.
click
(
fn
=
run_settings
,
inputs
=
components
,
outputs
=
[
result
]
)
interfaces
=
[
interfaces
=
[
(
txt2img_interface
,
"txt2img"
,
"txt2img"
),
(
txt2img_interface
,
"txt2img"
,
"txt2img"
),
(
img2img_interface
,
"img2img"
,
"img2img"
),
(
img2img_interface
,
"img2img"
,
"img2img"
),
...
...
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