From 24ec0726bf254f4e4398cf2bfa0c794978367744 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 5 Jun 2018 19:58:10 +0200 Subject: move p2pl --- app/client/modules/pix2pix/datasets.component.js | 0 app/client/modules/pix2pix/index.js | 2 +- app/client/modules/pix2pix/live.component.js | 253 ----------------------- app/client/modules/pix2pix/pix2pix.live.js | 253 +++++++++++++++++++++++ 4 files changed, 254 insertions(+), 254 deletions(-) delete mode 100644 app/client/modules/pix2pix/datasets.component.js delete mode 100644 app/client/modules/pix2pix/live.component.js create mode 100644 app/client/modules/pix2pix/pix2pix.live.js (limited to 'app') diff --git a/app/client/modules/pix2pix/datasets.component.js b/app/client/modules/pix2pix/datasets.component.js deleted file mode 100644 index e69de29..0000000 diff --git a/app/client/modules/pix2pix/index.js b/app/client/modules/pix2pix/index.js index 87bbf0d..0343963 100644 --- a/app/client/modules/pix2pix/index.js +++ b/app/client/modules/pix2pix/index.js @@ -1,7 +1,7 @@ import { h, Component } from 'preact' import { Route, Link } from 'react-router-dom' -import Pix2PixLive from './live.component' +import Pix2PixLive from './pix2pix.live' function router () { return ( diff --git a/app/client/modules/pix2pix/live.component.js b/app/client/modules/pix2pix/live.component.js deleted file mode 100644 index bb6c730..0000000 --- a/app/client/modules/pix2pix/live.component.js +++ /dev/null @@ -1,253 +0,0 @@ -import { h, Component } from 'preact' -import { bindActionCreators } from 'redux' -import { connect } from 'react-redux' - -import Player from '../../common/player.component' -import ParamGroup from '../../common/paramGroup.component' -import Slider from '../../common/slider.component' -import Select from '../../common/select.component' -import Button from '../../common/button.component' - -import { startRecording, stopRecording, saveFrame } from '../../live/player' - -import * as liveActions from '../../live/live.actions' - -class Pix2PixLive extends Component { - constructor(props){ - super() - props.actions.get_params() - props.actions.list_checkpoints() - props.actions.list_sequences() - this.changeCheckpoint = this.changeCheckpoint.bind(this) - this.changeEpoch = this.changeEpoch.bind(this) - this.changeSequence = this.changeSequence.bind(this) - this.seek = this.seek.bind(this) - this.togglePlaying = this.togglePlaying.bind(this) - this.toggleRecording = this.toggleRecording.bind(this) - } - componentWillUpdate(nextProps) { - if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { - this.props.actions.list_epochs(nextProps.opt.checkpoint_name) - } - } - changeCheckpoint(checkpoint_name){ - this.props.actions.load_epoch(checkpoint_name, 'latest') - } - changeEpoch(epoch_name){ - this.props.actions.load_epoch(this.props.opt.checkpoint_name, epoch_name) - } - changeSequence(sequence){ - console.log('got sequence', sequence) - this.props.actions.load_sequence(sequence) - } - seek(percentage){ - const frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1) - this.props.actions.seek(frame) - } - togglePlaying(){ - if (this.props.opt.processing) { - this.props.actions.pause() - } else { - this.props.actions.play() - } - } - toggleRecording(){ - if (this.props.opt.recording){ - stopRecording() - this.props.actions.pause() - } else { - startRecording() - } - } - render(){ - return ( -
- -
-
- - - - - - - - -
-
- - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
-
-
- ) - } -} -function timeInSeconds(n){ - return (n / 10).toFixed(1) + ' s.' -} -const mapStateToProps = state => ({ - opt: state.live.opt, - frame: state.live.frame, - checkpoints: state.live.checkpoints, - epochs: state.live.epochs, - sequences: state.live.sequences, -}) - -const mapDispatchToProps = (dispatch, ownProps) => ({ - actions: bindActionCreators(liveActions, dispatch) -}) - -export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixLive) diff --git a/app/client/modules/pix2pix/pix2pix.live.js b/app/client/modules/pix2pix/pix2pix.live.js new file mode 100644 index 0000000..bb6c730 --- /dev/null +++ b/app/client/modules/pix2pix/pix2pix.live.js @@ -0,0 +1,253 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import Player from '../../common/player.component' +import ParamGroup from '../../common/paramGroup.component' +import Slider from '../../common/slider.component' +import Select from '../../common/select.component' +import Button from '../../common/button.component' + +import { startRecording, stopRecording, saveFrame } from '../../live/player' + +import * as liveActions from '../../live/live.actions' + +class Pix2PixLive extends Component { + constructor(props){ + super() + props.actions.get_params() + props.actions.list_checkpoints() + props.actions.list_sequences() + this.changeCheckpoint = this.changeCheckpoint.bind(this) + this.changeEpoch = this.changeEpoch.bind(this) + this.changeSequence = this.changeSequence.bind(this) + this.seek = this.seek.bind(this) + this.togglePlaying = this.togglePlaying.bind(this) + this.toggleRecording = this.toggleRecording.bind(this) + } + componentWillUpdate(nextProps) { + if (nextProps.opt.checkpoint_name && nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { + this.props.actions.list_epochs(nextProps.opt.checkpoint_name) + } + } + changeCheckpoint(checkpoint_name){ + this.props.actions.load_epoch(checkpoint_name, 'latest') + } + changeEpoch(epoch_name){ + this.props.actions.load_epoch(this.props.opt.checkpoint_name, epoch_name) + } + changeSequence(sequence){ + console.log('got sequence', sequence) + this.props.actions.load_sequence(sequence) + } + seek(percentage){ + const frame = Math.floor(percentage * (parseInt(this.props.frame.sequence_len) || 1) + 1) + this.props.actions.seek(frame) + } + togglePlaying(){ + if (this.props.opt.processing) { + this.props.actions.pause() + } else { + this.props.actions.play() + } + } + toggleRecording(){ + if (this.props.opt.recording){ + stopRecording() + this.props.actions.pause() + } else { + startRecording() + } + } + render(){ + return ( +
+ +
+
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ ) + } +} +function timeInSeconds(n){ + return (n / 10).toFixed(1) + ' s.' +} +const mapStateToProps = state => ({ + opt: state.live.opt, + frame: state.live.frame, + checkpoints: state.live.checkpoints, + epochs: state.live.epochs, + sequences: state.live.sequences, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(liveActions, dispatch) +}) + +export default connect(mapStateToProps, mapDispatchToProps)(Pix2PixLive) -- cgit v1.2.3-70-g09d2