Corrected a UI issue with selecting directories of non-supported images. Works on macOS now with videos, images and image sequences. Testing on linux again before resolving.

This commit is contained in:
Matt McWilliams 2021-02-24 11:50:15 -05:00
parent fb7b1e2fb6
commit 31c701734a
6 changed files with 50 additions and 24 deletions

View File

@ -169,9 +169,11 @@ class FilmOut {
}
else if (this.stillExtensions.indexOf(ext) !== -1) {
this.state.still = true;
this.state.directory = false;
}
else if (this.videoExtensions.indexOf(ext) !== -1) {
this.state.still = false;
this.state.directory = false;
}
else {
this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

View File

@ -150,7 +150,6 @@ class FilmOut {
let linuxChoice = 0;
if (process.platform === 'linux') {
linuxChoice = yield gui.choice(linuxMessage, linuxChoices);
console.log(linuxChoice);
if (linuxChoice === 0) {
options.properties = ['openFile'];
}
@ -174,11 +173,13 @@ class FilmOut {
pathStr = files.filePaths[0];
displayName = path.basename(pathStr);
valid = this.validateSelection(files);
log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr);
elem.val(displayName);
$('#filmout_file').val(displayName);
this.useFile();
if (valid) {
log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr);
elem.val(displayName);
$('#filmout_file').val(displayName);
this.useFile();
}
}
if (!valid) {
gui.warn('Invalid selection', `The selection "${displayName}" is not an accepted video, image or folder containing an image sequence.`);
@ -208,7 +209,7 @@ class FilmOut {
fileList = fs.readdirSync(pathStr);
fileList = fileList.filter((file) => {
let ext = path.extname(file).toLowerCase();
if (this.sequenceExtensions.indexOf(ext)) {
if (this.sequenceExtensions.indexOf(ext) !== -1) {
return true;
}
return false;
@ -216,11 +217,16 @@ class FilmOut {
if (fileList.length > 0) {
valid = true;
}
else {
valid = false;
}
}
ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1;
else {
ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1;
}
}
}
return valid;
@ -288,6 +294,7 @@ class FilmOut {
$('#filmout_stats_video_name').text(state.fileName);
$('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`);
$('#filmout_stats_video_frames').text(`${state.frames} frames`);
this.reset();
gui.updateState();
this.previewFrame();
if (!this.state.directory) {
@ -359,6 +366,10 @@ class FilmOut {
}
$('#filmout_position').val(this.state.frame).trigger('change');
}
reset() {
this.state.frame = 0;
$('#filmout_position').val(this.state.frame).trigger('change');
}
preview() {
const frame = this.state.frame;
ipcRenderer.send('preview', { frame });

File diff suppressed because one or more lines are too long

View File

@ -176,11 +176,13 @@ class FilmOut {
pathStr = files.filePaths[0];
displayName = path.basename(pathStr);
valid = this.validateSelection(files);
log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr);
elem.val(displayName);
$('#filmout_file').val(displayName);
this.useFile();
if (valid) {
log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr);
elem.val(displayName);
$('#filmout_file').val(displayName);
this.useFile();
}
}
if (!valid) {
@ -211,19 +213,22 @@ class FilmOut {
fileList = fs.readdirSync(pathStr);
fileList = fileList.filter((file : string) => {
let ext : string = path.extname(file).toLowerCase();
if (this.sequenceExtensions.indexOf(ext)) {
if (this.sequenceExtensions.indexOf(ext) !== -1) {
return true;
}
return false;
});
if (fileList.length > 0) {
valid = true;
} else {
valid = false
}
} else {
ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1;
}
}
ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1;
}
}
return valid;
@ -297,6 +302,7 @@ class FilmOut {
$('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`);
$('#filmout_stats_video_frames').text(`${state.frames} frames`);
this.reset();
gui.updateState();
this.previewFrame();
if (!this.state.directory) {
@ -375,6 +381,11 @@ class FilmOut {
$('#filmout_position').val(this.state.frame).trigger('change');
}
reset () {
this.state.frame = 0;
$('#filmout_position').val(this.state.frame).trigger('change');
}
preview () {
const frame : number = this.state.frame;
ipcRenderer.send('preview', { frame });

View File

@ -178,8 +178,10 @@ class FilmOut {
this.state.still = !isAnimated;
} else if (this.stillExtensions.indexOf(ext) !== -1) {
this.state.still = true;
this.state.directory = false;
} else if (this.videoExtensions.indexOf(ext) !== -1) {
this.state.still = false;
this.state.directory = false;
} else {
this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true);
return false;