Patch for UI

This commit is contained in:
Chinmay Pandhare
2017-07-28 18:01:22 +05:30
parent ec4459309b
commit 2888c2d735
4 changed files with 70 additions and 36 deletions

View File

@@ -34391,11 +34391,18 @@ function AddStep(ref, image, name, o) {
o.container = o_.container || ref.options.selector; o.container = o_.container || ref.options.selector;
o.image = image; o.image = image;
var UI = ref.UI({ o.identity = {
stepName: o.name, stepName: o.name,
stepID: o.number, stepID: o.number,
imageName: o.image imageName: o.image
}); };
o.UIFs = ref.UI();
var UI = {
onSetup: function(){o.UIFs.onSetup(o.identity);},
onDraw: function(){o.UIFs.onSetup(o.identity);},
onComplete: function(out){o.UIFs.onSetup(o.identity,out);},
onRemove: function(){o.UIFs.onSetup(o.identity);},
}
var module = ref.modules[name](o,UI); var module = ref.modules[name](o,UI);
ref.images[image].steps.push(module); ref.images[image].steps.push(module);
@@ -34782,11 +34789,18 @@ function InsertStep(ref, image, index, name, o) {
if(index==-1) index = ref.images[image].steps.length; if(index==-1) index = ref.images[image].steps.length;
var UI = ref.UI({ o.identity = {
stepName: o.name, stepName: o.name,
stepID: o.number, stepID: o.number,
imageName: o.image imageName: o.image
}); };
o.UIFs = ref.UI();
var UI = {
onSetup: function(){o.UIFs.onSetup(o.identity);},
onDraw: function(){o.UIFs.onSetup(o.identity);},
onComplete: function(out){o.UIFs.onSetup(o.identity,out);},
onRemove: function(){o.UIFs.onSetup(o.identity);},
}
var module = ref.modules[name](o,UI); var module = ref.modules[name](o,UI);
ref.images[image].steps.splice(index,0,module); ref.images[image].steps.splice(index,0,module);
@@ -34952,17 +34966,20 @@ module.exports = Run;
/* /*
* Default UI for each image-sequencer module * Default UI for each image-sequencer module
*/ */
module.exports = function UserInterface(UI,options) { module.exports = function UserInterface(newUI = {},options) {
var UI = newUI;
return function userInterface(identity) { return function userInterface(identity) {
var UI = UI || {}; identity.ui = options.ui;
identity.inBrowser = options.inBrowser;
UI.onSetup = UI.onSetup || function() { UI.onSetup = UI.onSetup || function(identity) {
if(options.ui == false) { if(identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Create and append an HTML Element // Create and append an HTML Element
console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\".");
} }
@@ -34973,11 +34990,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onDraw = UI.onDraw || function() { UI.onDraw = UI.onDraw || function(identity) {
if (options.ui == false) { if (identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Overlay a loading spinner // Overlay a loading spinner
console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
} }
@@ -34987,11 +35004,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onComplete = UI.onComplete || function(output) { UI.onComplete = UI.onComplete || function(identity,output) {
if (options.ui == false) { if (identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Update the DIV Element // Update the DIV Element
// Hide the laoding spinner // Hide the laoding spinner
console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
@@ -35002,11 +35019,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onRemove = UI.onRemove || function(callback) { UI.onRemove = UI.onRemove || function(identity) {
if(options.ui == false){ if(identity.ui == false){
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Remove the DIV Element // Remove the DIV Element
console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\".");
} }

View File

@@ -8,11 +8,18 @@ function AddStep(ref, image, name, o) {
o.container = o_.container || ref.options.selector; o.container = o_.container || ref.options.selector;
o.image = image; o.image = image;
var UI = ref.UI({ o.identity = {
stepName: o.name, stepName: o.name,
stepID: o.number, stepID: o.number,
imageName: o.image imageName: o.image
}); };
o.UIFs = ref.UI();
var UI = {
onSetup: function(){o.UIFs.onSetup(o.identity);},
onDraw: function(){o.UIFs.onSetup(o.identity);},
onComplete: function(out){o.UIFs.onSetup(o.identity,out);},
onRemove: function(){o.UIFs.onSetup(o.identity);},
}
var module = ref.modules[name](o,UI); var module = ref.modules[name](o,UI);
ref.images[image].steps.push(module); ref.images[image].steps.push(module);

View File

@@ -10,11 +10,18 @@ function InsertStep(ref, image, index, name, o) {
if(index==-1) index = ref.images[image].steps.length; if(index==-1) index = ref.images[image].steps.length;
var UI = ref.UI({ o.identity = {
stepName: o.name, stepName: o.name,
stepID: o.number, stepID: o.number,
imageName: o.image imageName: o.image
}); };
o.UIFs = ref.UI();
var UI = {
onSetup: function(){o.UIFs.onSetup(o.identity);},
onDraw: function(){o.UIFs.onSetup(o.identity);},
onComplete: function(out){o.UIFs.onSetup(o.identity,out);},
onRemove: function(){o.UIFs.onSetup(o.identity);},
}
var module = ref.modules[name](o,UI); var module = ref.modules[name](o,UI);
ref.images[image].steps.splice(index,0,module); ref.images[image].steps.splice(index,0,module);

View File

@@ -1,17 +1,20 @@
/* /*
* Default UI for each image-sequencer module * Default UI for each image-sequencer module
*/ */
module.exports = function UserInterface(UI,options) { module.exports = function UserInterface(newUI = {},options) {
var UI = newUI;
return function userInterface(identity) { return function userInterface(identity) {
var UI = UI || {}; identity.ui = options.ui;
identity.inBrowser = options.inBrowser;
UI.onSetup = UI.onSetup || function() { UI.onSetup = UI.onSetup || function(identity) {
if(options.ui == false) { if(identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Create and append an HTML Element // Create and append an HTML Element
console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\".");
} }
@@ -22,11 +25,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onDraw = UI.onDraw || function() { UI.onDraw = UI.onDraw || function(identity) {
if (options.ui == false) { if (identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Overlay a loading spinner // Overlay a loading spinner
console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
} }
@@ -36,11 +39,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onComplete = UI.onComplete || function(output) { UI.onComplete = UI.onComplete || function(identity,output) {
if (options.ui == false) { if (identity.ui == false) {
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Update the DIV Element // Update the DIV Element
// Hide the laoding spinner // Hide the laoding spinner
console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
@@ -51,11 +54,11 @@ module.exports = function UserInterface(UI,options) {
} }
} }
UI.onRemove = UI.onRemove || function(callback) { UI.onRemove = UI.onRemove || function(identity) {
if(options.ui == false){ if(identity.ui == false){
// No UI // No UI
} }
else if(options.inBrowser) { else if(identity.inBrowser) {
// Remove the DIV Element // Remove the DIV Element
console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\".");
} }