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
1f8f3a6e
Commit
1f8f3a6e
authored
Jun 11, 2024
by
YSH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: prevent screen sleep during generation
parent
feee37d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
javascript/progressbar.js
javascript/progressbar.js
+25
-0
modules/shared_options.py
modules/shared_options.py
+1
-0
No files found.
javascript/progressbar.js
View file @
1f8f3a6e
...
@@ -76,6 +76,28 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
...
@@ -76,6 +76,28 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var
dateStart
=
new
Date
();
var
dateStart
=
new
Date
();
var
wasEverActive
=
false
;
var
wasEverActive
=
false
;
var
parentProgressbar
=
progressbarContainer
.
parentNode
;
var
parentProgressbar
=
progressbarContainer
.
parentNode
;
var
wakeLock
=
null
;
var
requestWakeLock
=
async
function
()
{
if
(
!
opts
.
prevent_screen_sleep_during_generation
)
return
;
try
{
wakeLock
=
await
navigator
.
wakeLock
.
request
(
'
screen
'
);
console
.
log
(
'
Wake Lock is active.
'
);
}
catch
(
err
)
{
console
.
log
(
'
Wake Lock is not supported.
'
);
}
};
var
releaseWakeLock
=
async
function
()
{
if
(
!
opts
.
prevent_screen_sleep_during_generation
||
!
wakeLock
)
return
;
try
{
await
wakeLock
.
release
();
console
.
log
(
'
Wake Lock is released.
'
);
wakeLock
=
null
;
}
catch
(
err
)
{
console
.
error
(
'
Wake Lock release failed
'
,
err
);
}
};
var
divProgress
=
document
.
createElement
(
'
div
'
);
var
divProgress
=
document
.
createElement
(
'
div
'
);
divProgress
.
className
=
'
progressDiv
'
;
divProgress
.
className
=
'
progressDiv
'
;
...
@@ -89,6 +111,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
...
@@ -89,6 +111,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var
livePreview
=
null
;
var
livePreview
=
null
;
var
removeProgressBar
=
function
()
{
var
removeProgressBar
=
function
()
{
releaseWakeLock
();
if
(
!
divProgress
)
return
;
if
(
!
divProgress
)
return
;
setTitle
(
""
);
setTitle
(
""
);
...
@@ -100,6 +123,8 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
...
@@ -100,6 +123,8 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
};
};
var
funProgress
=
function
(
id_task
)
{
var
funProgress
=
function
(
id_task
)
{
// Request the wake lock at the start of the progress
requestWakeLock
();
request
(
"
./internal/progress
"
,
{
id_task
:
id_task
,
live_preview
:
false
},
function
(
res
)
{
request
(
"
./internal/progress
"
,
{
id_task
:
id_task
,
live_preview
:
false
},
function
(
res
)
{
if
(
res
.
completed
)
{
if
(
res
.
completed
)
{
removeProgressBar
();
removeProgressBar
();
...
...
modules/shared_options.py
View file @
1f8f3a6e
...
@@ -359,6 +359,7 @@ options_templates.update(options_section(('ui', "Live previews", "ui"), {
...
@@ -359,6 +359,7 @@ options_templates.update(options_section(('ui', "Live previews", "ui"), {
"live_preview_refresh_period"
:
OptionInfo
(
1000
,
"Progressbar and preview update period"
)
.
info
(
"in milliseconds"
),
"live_preview_refresh_period"
:
OptionInfo
(
1000
,
"Progressbar and preview update period"
)
.
info
(
"in milliseconds"
),
"live_preview_fast_interrupt"
:
OptionInfo
(
False
,
"Return image with chosen live preview method on interrupt"
)
.
info
(
"makes interrupts faster"
),
"live_preview_fast_interrupt"
:
OptionInfo
(
False
,
"Return image with chosen live preview method on interrupt"
)
.
info
(
"makes interrupts faster"
),
"js_live_preview_in_modal_lightbox"
:
OptionInfo
(
False
,
"Show Live preview in full page image viewer"
),
"js_live_preview_in_modal_lightbox"
:
OptionInfo
(
False
,
"Show Live preview in full page image viewer"
),
"prevent_screen_sleep_during_generation"
:
OptionInfo
(
True
,
"Prevent screen sleep during generation"
),
}))
}))
options_templates
.
update
(
options_section
((
'sampler-params'
,
"Sampler parameters"
,
"sd"
),
{
options_templates
.
update
(
options_section
((
'sampler-params'
,
"Sampler parameters"
,
"sd"
),
{
...
...
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