summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-02-23 17:19:03 +0100
committerJules Laplace <julescarbon@gmail.com>2020-02-23 17:19:03 +0100
commitd6d463cf1a1d260d4b36a308b97dc0b7ef5f22fd (patch)
treef1223a9f04bd8f4175030b167ab4a7f767470c2d /app
parent752ef11cda9aed54793084c05953cbcd1df09c5e (diff)
pause or unpause
Diffstat (limited to 'app')
-rw-r--r--app/client/live/live.reducer.js13
-rw-r--r--app/client/modules/biggan/views/biggan.live.js12
2 files changed, 21 insertions, 4 deletions
diff --git a/app/client/live/live.reducer.js b/app/client/live/live.reducer.js
index 1d437e0..d6f8dc5 100644
--- a/app/client/live/live.reducer.js
+++ b/app/client/live/live.reducer.js
@@ -117,9 +117,16 @@ const liveReducer = (state = liveInitialState, action) => {
if (b.indexOf('set_opt') === 0) {
const terms = b.split(' ')
let key = terms[1]
- let value = parseFloat(terms[2])
- if (isNaN(value)) {
- value = terms[2]
+ let value = terms[2]
+ if (value === 'True') {
+ value = true
+ } else if (value === 'False') {
+ value = false
+ } else {
+ value = parseFloat(terms[2])
+ if (isNaN(value)) {
+ value = terms[2]
+ }
}
a[key] = value
}
diff --git a/app/client/modules/biggan/views/biggan.live.js b/app/client/modules/biggan/views/biggan.live.js
index b6316a8..a1e99a1 100644
--- a/app/client/modules/biggan/views/biggan.live.js
+++ b/app/client/modules/biggan/views/biggan.live.js
@@ -32,6 +32,12 @@ class BigGANLive extends Component {
interrupt(){
this.props.actions.queue.stop_task('gpu')
}
+ play() {
+ this.props.actions.live.send_command('play', '')
+ }
+ pause() {
+ this.props.actions.live.send_command('pause', '')
+ }
stop() {
this.props.actions.live.send_command('stop', '')
}
@@ -160,7 +166,7 @@ class BigGANLive extends Component {
}
renderRestartButton(){
// console.log(this.props.runner.gpu)
- const { i18n } = this.props
+ const { i18n, opt } = this.props
if (this.props.runner.gpu.status === 'IDLE') {
return (
<Button
@@ -197,6 +203,10 @@ class BigGANLive extends Component {
title={i18n.gpu.busy}
onClick={() => this.stop()}
>{i18n.gpu.stop}</Button>
+ <Button
+ title={opt.paused ? 'Paused' : 'Playing'}
+ onClick={() => { opt.paused ? this.play() : this.pause()}}
+ >{opt.paused ? 'Play' : 'Play'}</Button>
</div>
)
}