mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-14 12:19:58 +01:00
Module info.json -based demo UI (WIP) (#219)
* initial work * working with failing test * now should pass test
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
|
// add steps to the sequencer
|
||||||
function AddStep(ref, image, name, o) {
|
function AddStep(ref, image, name, o) {
|
||||||
|
|
||||||
function addStep(image, name, o_) {
|
function addStep(image, name, o_) {
|
||||||
|
var moduleInfo = ref.modules[name][1];
|
||||||
|
|
||||||
var o = ref.copy(o_);
|
var o = ref.copy(o_);
|
||||||
o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step
|
o.number = ref.options.sequencerCounter++; // gives a unique ID to each step
|
||||||
o.name = o_.name || name;
|
o.name = o_.name || name || moduleInfo.name;
|
||||||
|
o.description = o_.description || moduleInfo.description;
|
||||||
o.selector = o_.selector || 'ismod-' + name;
|
o.selector = o_.selector || 'ismod-' + name;
|
||||||
o.container = o_.container || ref.options.selector;
|
o.container = o_.container || ref.options.selector;
|
||||||
o.image = image;
|
o.image = image;
|
||||||
@@ -11,6 +15,7 @@ function AddStep(ref, image, name, o) {
|
|||||||
|
|
||||||
o.step = {
|
o.step = {
|
||||||
name: o.name,
|
name: o.name,
|
||||||
|
description: o.description,
|
||||||
ID: o.number,
|
ID: o.number,
|
||||||
imageName: o.image,
|
imageName: o.image,
|
||||||
inBrowser: ref.options.inBrowser,
|
inBrowser: ref.options.inBrowser,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// insert one or more steps at a given index in the sequencer
|
||||||
function InsertStep(ref, image, index, name, o) {
|
function InsertStep(ref, image, index, name, o) {
|
||||||
|
|
||||||
function insertStep(image, index, name, o_) {
|
function insertStep(image, index, name, o_) {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
module.exports = function GreenChannel(options,UI) {
|
module.exports = function GreenChannel(options,UI) {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.title = "Green channel only";
|
|
||||||
options.description = "Displays only the green channel of an image";
|
|
||||||
|
|
||||||
// Tell UI that a step has been set up
|
// Tell UI that a step has been set up
|
||||||
UI.onSetup(options.step);
|
UI.onSetup(options.step);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Green Channel",
|
"name": "Green Channel",
|
||||||
|
"description": "Displays only the green channel of an image",
|
||||||
"inputs": {
|
"inputs": {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ test('addSteps("image","name") adds a step', function (t) {
|
|||||||
sequencer.addSteps('test','green-channel');
|
sequencer.addSteps('test','green-channel');
|
||||||
t.equal(sequencer.images.test.steps.length, 2, "Length of steps increased")
|
t.equal(sequencer.images.test.steps.length, 2, "Length of steps increased")
|
||||||
t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Added");
|
t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Added");
|
||||||
|
t.equal(sequencer.images.test.steps[1].options.description, "Displays only the green channel of an image", "Step description shown");
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user