Added an edge-case helper for choosing files/directories in linux. This finishes the requirement for issue #50 on linux, but will test changes on macOS before marking the issue resolved.
This commit is contained in:
parent
5061a511ab
commit
fb7b1e2fb6
|
@ -2497,6 +2497,7 @@ const filmout = require('./lib/ui/filmout.js');
|
||||||
const mse = require('./lib/ui/mscript.js');
|
const mse = require('./lib/ui/mscript.js');
|
||||||
const Mscript = require('./lib/mscript');
|
const Mscript = require('./lib/mscript');
|
||||||
const { delay } = require('./lib/delay');
|
const { delay } = require('./lib/delay');
|
||||||
|
|
||||||
let log;
|
let log;
|
||||||
|
|
||||||
/******
|
/******
|
||||||
|
|
|
@ -27,6 +27,7 @@ class FilmOut {
|
||||||
this.id = 'filmout';
|
this.id = 'filmout';
|
||||||
this.videoExtensions = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4'];
|
this.videoExtensions = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4'];
|
||||||
this.stillExtensions = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
this.stillExtensions = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
||||||
|
this.sequenceExtensions = ['.png', '.jpg', '.jpeg'];
|
||||||
this.gifExtension = '.gif';
|
this.gifExtension = '.gif';
|
||||||
this.state = {
|
this.state = {
|
||||||
frame: 0,
|
frame: 0,
|
||||||
|
@ -346,7 +347,7 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
frameList = frameList.filter((fileName) => {
|
frameList = frameList.filter((fileName) => {
|
||||||
let ext = path_1.extname(fileName);
|
let ext = path_1.extname(fileName);
|
||||||
if (this.stillExtensions.indexOf(ext) !== -1) {
|
if (this.sequenceExtensions.indexOf(ext) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -49,6 +49,7 @@ class FilmOut {
|
||||||
this.videoExtensions = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4',
|
this.videoExtensions = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4',
|
||||||
'.gif'];
|
'.gif'];
|
||||||
this.stillExtensions = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
this.stillExtensions = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
||||||
|
this.sequenceExtensions = ['.png', '.jpg', '.jpeg'];
|
||||||
this.displays = [];
|
this.displays = [];
|
||||||
this.state = {
|
this.state = {
|
||||||
frame: 0,
|
frame: 0,
|
||||||
|
@ -127,9 +128,10 @@ class FilmOut {
|
||||||
selectFile() {
|
selectFile() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const elem = $('#digital');
|
const elem = $('#digital');
|
||||||
|
const properties = [`openFile`, `openDirectory`];
|
||||||
const options = {
|
const options = {
|
||||||
title: `Select video or image sequence`,
|
title: `Select video or image sequence`,
|
||||||
properties: [`openFile`, `openDirectory`],
|
properties,
|
||||||
defaultPath: 'c:/',
|
defaultPath: 'c:/',
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
|
@ -143,6 +145,22 @@ class FilmOut {
|
||||||
let pathStr;
|
let pathStr;
|
||||||
let displayName;
|
let displayName;
|
||||||
let ext;
|
let ext;
|
||||||
|
const linuxMessage = `Do you want to use a single file (video or still image) or a folder containing an image sequence?`;
|
||||||
|
const linuxChoices = ['File', 'Folder', 'Cancel'];
|
||||||
|
let linuxChoice = 0;
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
linuxChoice = yield gui.choice(linuxMessage, linuxChoices);
|
||||||
|
console.log(linuxChoice);
|
||||||
|
if (linuxChoice === 0) {
|
||||||
|
options.properties = ['openFile'];
|
||||||
|
}
|
||||||
|
else if (linuxChoice === 1) {
|
||||||
|
options.properties = ['openDirectory'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
files = yield dialog.showOpenDialog(options);
|
files = yield dialog.showOpenDialog(options);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +208,7 @@ class FilmOut {
|
||||||
fileList = fs.readdirSync(pathStr);
|
fileList = fs.readdirSync(pathStr);
|
||||||
fileList = fileList.filter((file) => {
|
fileList = fileList.filter((file) => {
|
||||||
let ext = path.extname(file).toLowerCase();
|
let ext = path.extname(file).toLowerCase();
|
||||||
if (this.stillExtensions.indexOf(ext)) {
|
if (this.sequenceExtensions.indexOf(ext)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -221,7 +239,7 @@ class FilmOut {
|
||||||
fileName
|
fileName
|
||||||
};
|
};
|
||||||
if (filePath && filePath !== '') {
|
if (filePath && filePath !== '') {
|
||||||
proceed = yield gui.confirm(`Are you sure you want to use ${fileName}?`);
|
proceed = yield gui.confirm(`Are you sure you want to use ${fileName}?`, 'No');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.selectFile();
|
this.selectFile();
|
||||||
|
@ -296,7 +314,7 @@ class FilmOut {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
if (this.state.path && this.state.path !== '') {
|
if (this.state.path && this.state.path !== '') {
|
||||||
proceed = yield gui.confirm(`Export all frames of ${this.state.name}? This may take a while, but will allow filmout sequences to run faster.`);
|
proceed = yield gui.confirm(`Export all frames of ${this.state.name}? This may take a while, but will allow filmout sequences to run faster.`, 'No');
|
||||||
}
|
}
|
||||||
if (proceed) {
|
if (proceed) {
|
||||||
gui.overlay(true);
|
gui.overlay(true);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -227,14 +227,23 @@ gui.info = async function (title, message) {
|
||||||
};
|
};
|
||||||
return dialog.showMessageBox(config);
|
return dialog.showMessageBox(config);
|
||||||
};
|
};
|
||||||
gui.confirm = async function (message) {
|
gui.confirm = async function (message, cancel = 'Cancel') {
|
||||||
const config = {
|
const config = {
|
||||||
buttons : ['Yes', 'Cancel'],
|
buttons : ['Yes', cancel],
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
const res = await dialog.showMessageBox(config);
|
const res = await dialog.showMessageBox(config);
|
||||||
return res.response === 0;
|
return res.response === 0;
|
||||||
};
|
};
|
||||||
|
gui.choice = async function (message, choices) {
|
||||||
|
const config = {
|
||||||
|
buttons : choices,
|
||||||
|
defaultId : 0,
|
||||||
|
message
|
||||||
|
}
|
||||||
|
const res = await dialog.showMessageBox(config);
|
||||||
|
return res.response;
|
||||||
|
};
|
||||||
gui.warn = async function (title, message) {
|
gui.warn = async function (title, message) {
|
||||||
'use strict';
|
'use strict';
|
||||||
const config = {
|
const config = {
|
||||||
|
|
|
@ -23,6 +23,7 @@ const filmout = require('./lib/ui/filmout.js');
|
||||||
const mse = require('./lib/ui/mscript.js');
|
const mse = require('./lib/ui/mscript.js');
|
||||||
const Mscript = require('./lib/mscript');
|
const Mscript = require('./lib/mscript');
|
||||||
const { delay } = require('./lib/delay');
|
const { delay } = require('./lib/delay');
|
||||||
|
|
||||||
let log;
|
let log;
|
||||||
|
|
||||||
/******
|
/******
|
||||||
|
|
|
@ -47,6 +47,7 @@ class FilmOut {
|
||||||
private videoExtensions : string[] = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4',
|
private videoExtensions : string[] = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4',
|
||||||
'.gif'];
|
'.gif'];
|
||||||
private stillExtensions : string[] = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
private stillExtensions : string[] = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
||||||
|
private sequenceExtensions : string[] = ['.png', '.jpg', '.jpeg'];
|
||||||
private displays : any[] = [];
|
private displays : any[] = [];
|
||||||
private state : any = {
|
private state : any = {
|
||||||
frame : 0,
|
frame : 0,
|
||||||
|
@ -131,9 +132,10 @@ class FilmOut {
|
||||||
**/
|
**/
|
||||||
async selectFile () {
|
async selectFile () {
|
||||||
const elem : any = $('#digital');
|
const elem : any = $('#digital');
|
||||||
|
const properties : string[] = [`openFile`, `openDirectory`];
|
||||||
const options : any = {
|
const options : any = {
|
||||||
title : `Select video or image sequence`,
|
title : `Select video or image sequence`,
|
||||||
properties : [`openFile`, `openDirectory`], // openDirectory, multiSelection, openFile
|
properties, // openDirectory, multiSelection, openFile
|
||||||
defaultPath: 'c:/',
|
defaultPath: 'c:/',
|
||||||
filters : [
|
filters : [
|
||||||
{
|
{
|
||||||
|
@ -147,6 +149,20 @@ class FilmOut {
|
||||||
let pathStr : string;
|
let pathStr : string;
|
||||||
let displayName : string;
|
let displayName : string;
|
||||||
let ext : string;
|
let ext : string;
|
||||||
|
const linuxMessage : string = `Do you want to use a single file (video or still image) or a folder containing an image sequence?`;
|
||||||
|
const linuxChoices : string[] = ['File', 'Folder', 'Cancel'];
|
||||||
|
let linuxChoice : number = 0;
|
||||||
|
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
linuxChoice = await gui.choice(linuxMessage, linuxChoices);
|
||||||
|
if (linuxChoice === 0) {
|
||||||
|
options.properties = ['openFile'];
|
||||||
|
} else if (linuxChoice === 1) {
|
||||||
|
options.properties = ['openDirectory'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
files = await dialog.showOpenDialog(options);
|
files = await dialog.showOpenDialog(options);
|
||||||
|
@ -195,7 +211,7 @@ class FilmOut {
|
||||||
fileList = fs.readdirSync(pathStr);
|
fileList = fs.readdirSync(pathStr);
|
||||||
fileList = fileList.filter((file : string) => {
|
fileList = fileList.filter((file : string) => {
|
||||||
let ext : string = path.extname(file).toLowerCase();
|
let ext : string = path.extname(file).toLowerCase();
|
||||||
if (this.stillExtensions.indexOf(ext)) {
|
if (this.sequenceExtensions.indexOf(ext)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -227,7 +243,7 @@ class FilmOut {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (filePath && filePath !== '') {
|
if (filePath && filePath !== '') {
|
||||||
proceed = await gui.confirm(`Are you sure you want to use ${fileName}?`);
|
proceed = await gui.confirm(`Are you sure you want to use ${fileName}?`, 'No');
|
||||||
} else {
|
} else {
|
||||||
this.selectFile();
|
this.selectFile();
|
||||||
}
|
}
|
||||||
|
@ -306,7 +322,7 @@ class FilmOut {
|
||||||
let proceed = false;
|
let proceed = false;
|
||||||
|
|
||||||
if (this.state.path && this.state.path !== '') {
|
if (this.state.path && this.state.path !== '') {
|
||||||
proceed = await gui.confirm(`Export all frames of ${this.state.name}? This may take a while, but will allow filmout sequences to run faster.`);
|
proceed = await gui.confirm(`Export all frames of ${this.state.name}? This may take a while, but will allow filmout sequences to run faster.`, 'No');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proceed) {
|
if (proceed) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ class FilmOut {
|
||||||
private id : string = 'filmout';
|
private id : string = 'filmout';
|
||||||
private videoExtensions : string[] = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4'];
|
private videoExtensions : string[] = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4'];
|
||||||
private stillExtensions : string[] = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
private stillExtensions : string[] = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
|
||||||
|
private sequenceExtensions : string[] = ['.png', '.jpg', '.jpeg'];
|
||||||
private gifExtension : string = '.gif';
|
private gifExtension : string = '.gif';
|
||||||
public state : any = {
|
public state : any = {
|
||||||
frame : 0,
|
frame : 0,
|
||||||
|
@ -356,7 +357,7 @@ class FilmOut {
|
||||||
|
|
||||||
frameList = frameList.filter((fileName : string) => {
|
frameList = frameList.filter((fileName : string) => {
|
||||||
let ext : string = extname(fileName);
|
let ext : string = extname(fileName);
|
||||||
if (this.stillExtensions.indexOf(ext) !== -1) {
|
if (this.sequenceExtensions.indexOf(ext) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue