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
a4de699e
Commit
a4de699e
authored
Oct 16, 2022
by
yfszzx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Images history speed up
parent
f62905fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
images_history.js
javascript/images_history.js
+1
-0
images_history.py
modules/images_history.py
+5
-2
No files found.
javascript/images_history.js
View file @
a4de699e
...
@@ -108,6 +108,7 @@ function images_history_delete(del_num, tabname, image_index){
...
@@ -108,6 +108,7 @@ function images_history_delete(del_num, tabname, image_index){
});
});
var
img_num
=
buttons
.
length
/
2
;
var
img_num
=
buttons
.
length
/
2
;
del_num
=
Math
.
min
(
img_num
-
image_index
,
del_num
)
del_num
=
Math
.
min
(
img_num
-
image_index
,
del_num
)
console
.
log
(
del_num
,
img_num
)
if
(
img_num
<=
del_num
){
if
(
img_num
<=
del_num
){
setTimeout
(
function
(
tabname
){
setTimeout
(
function
(
tabname
){
gradioApp
().
getElementById
(
tabname
+
'_images_history_renew_page'
).
click
();
gradioApp
().
getElementById
(
tabname
+
'_images_history_renew_page'
).
click
();
...
...
modules/images_history.py
View file @
a4de699e
...
@@ -153,6 +153,7 @@ def delete_image(delete_num, name, filenames, image_index, visible_num):
...
@@ -153,6 +153,7 @@ def delete_image(delete_num, name, filenames, image_index, visible_num):
if
os
.
path
.
exists
(
name
):
if
os
.
path
.
exists
(
name
):
if
visible_num
==
image_index
:
if
visible_num
==
image_index
:
new_file_list
.
append
(
name
)
new_file_list
.
append
(
name
)
i
+=
1
continue
continue
print
(
f
"Delete file {name}"
)
print
(
f
"Delete file {name}"
)
os
.
remove
(
name
)
os
.
remove
(
name
)
...
@@ -221,7 +222,7 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
...
@@ -221,7 +222,7 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
with
gr
.
Column
(
visible
=
sorted_flag
)
as
page_panel
:
with
gr
.
Column
(
visible
=
sorted_flag
)
as
page_panel
:
with
gr
.
Row
():
with
gr
.
Row
():
#renew_page = gr.Button('Refresh'
)
renew_page
=
gr
.
Button
(
'Refresh page'
,
elem_id
=
tabname
+
"_images_history_renew_page"
)
first_page
=
gr
.
Button
(
'First Page'
)
first_page
=
gr
.
Button
(
'First Page'
)
prev_page
=
gr
.
Button
(
'Prev Page'
)
prev_page
=
gr
.
Button
(
'Prev Page'
)
page_index
=
gr
.
Number
(
value
=
1
,
label
=
"Page Index"
)
page_index
=
gr
.
Number
(
value
=
1
,
label
=
"Page Index"
)
...
@@ -231,7 +232,7 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
...
@@ -231,7 +232,7 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
with
gr
.
Row
(
elem_id
=
tabname
+
"_images_history"
):
with
gr
.
Row
(
elem_id
=
tabname
+
"_images_history"
):
with
gr
.
Column
(
scale
=
2
):
with
gr
.
Column
(
scale
=
2
):
with
gr
.
Row
():
with
gr
.
Row
():
newest
=
gr
.
Button
(
'Re
fresh
'
,
elem_id
=
tabname
+
"_images_history_start"
)
newest
=
gr
.
Button
(
'Re
load
'
,
elem_id
=
tabname
+
"_images_history_start"
)
date_from
=
gr
.
Textbox
(
label
=
"Date from"
,
interactive
=
False
)
date_from
=
gr
.
Textbox
(
label
=
"Date from"
,
interactive
=
False
)
date_to
=
gr
.
Dropdown
(
value
=
"start"
if
not
sorted_flag
else
None
,
label
=
"Date to"
)
date_to
=
gr
.
Dropdown
(
value
=
"start"
if
not
sorted_flag
else
None
,
label
=
"Date to"
)
...
@@ -291,12 +292,14 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
...
@@ -291,12 +292,14 @@ def show_images_history(gr, opts, tabname, run_pnginfo, switch_dict):
prev_page
.
click
(
prev_page_click
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
prev_page
.
click
(
prev_page_click
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
end_page
.
click
(
end_page_click
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
end_page
.
click
(
end_page_click
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
page_index
.
submit
(
page_index_change
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
page_index
.
submit
(
page_index_change
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
renew_page
.
click
(
page_index_change
,
inputs
=
gallery_inputs
,
outputs
=
gallery_outputs
)
first_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
first_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
next_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
next_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
prev_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
prev_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
end_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
end_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
page_index
.
submit
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
page_index
.
submit
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
renew_page
.
click
(
fn
=
None
,
inputs
=
[
tabname_box
],
outputs
=
None
,
_js
=
"images_history_turnpage"
)
# other funcitons
# other funcitons
set_index
.
click
(
show_image_info
,
_js
=
"images_history_get_current_img"
,
inputs
=
[
tabname_box
,
image_index
,
page_index
,
filenames
],
outputs
=
[
img_file_name
,
image_index
,
hidden
])
set_index
.
click
(
show_image_info
,
_js
=
"images_history_get_current_img"
,
inputs
=
[
tabname_box
,
image_index
,
page_index
,
filenames
],
outputs
=
[
img_file_name
,
image_index
,
hidden
])
...
...
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