diff --git a/.travis.yml b/.travis.yml
index 56582183..9e7dd66e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ anHsudo: required
dist: bionic
language: node_js
node_js:
- - "9"
+ - "12"
before_install:
- sudo dpkg --add-architecture i386
- sudo apt-get update -qq
diff --git a/package.json b/package.json
index e77fe39c..1cf6ffdb 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
- "version": "1.0.0-beta7",
+ "version": "1.0.0-beta8",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"
@@ -97,7 +97,7 @@
"watch-css": "nodemon --watch src/scss -e scss -x \"npm run build-css -- --reload\"",
"watch-server": "nodemon --watch src/server/ -e js -x \"npm run build-server-js\"",
"watch-launcher": "nodemon --watch src/launcher/ -e js -x \"npm run build-launcher-js\"",
- "build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && mkdocs build",
+ "build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && python3 -m mkdocs build",
"test": "eslint src && npm run build && node tests/test.js"
},
"engines": {
diff --git a/resources/docs/docs/midi/midi-configuration.md b/resources/docs/docs/midi/midi-configuration.md
index 173baee4..65bf4aa4 100644
--- a/resources/docs/docs/midi/midi-configuration.md
+++ b/resources/docs/docs/midi/midi-configuration.md
@@ -37,3 +37,7 @@ In order to send MIDI messages, a widget must have at least one `target` formatt
!!! warning
Messages received from a MIDI port only affect widgets that send to this port.
+
+## Debug
+
+Enabling the server's `debug` options will print some extra informations (sent/received midi messages, midi setup informations, etc)
diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md
index cd9e9fe6..9c891583 100644
--- a/resources/docs/docs/widgets/properties-reference.md
+++ b/resources/docs/docs/widgets/properties-reference.md
@@ -714,3 +714,6 @@
|
keyBinding
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation) |
| keyRepeat
| `boolean` | true | Set to `false` to prevent keydown repeats when holding the key combo pressed |
| keyType
| `string` | "keydown" | Determines which key event trigger the script's execution
Choices: `keydown`, `keyup`, `both` |
+
+??? api "variable
"
+ Receives / stores a value, to be used in scripts (using the get function) or in properties (using the @{} syntax).
diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md
index 47bcf805..f75de7ab 100644
--- a/resources/docs/docs/widgets/scripting.md
+++ b/resources/docs/docs/widgets/scripting.md
@@ -5,6 +5,9 @@ The `script` property allows widgets to run javascript code when their value upd
- no `JS{{}}` wrapper, just the code
- `@{}`, `OSC{}`, `JS{{}}` and `#{}` blocks are replaced with their value before the script's compilation
+!!! warning "Avoid advanced syntax in scripts"
+ To avoid syntax errors it is recommended to use `getProp()` and `get()` instead of `@{}` and `OSC{}`. `JS{{}}` and `#{}` blocks should be avoided here as well.
+
## Event-dependent variables
Depending on what triggered the script's execution, a few variables are available to help determine the execution conditions.
diff --git a/src/client/widgets/index.js b/src/client/widgets/index.js
index 7a7ab585..c201c795 100644
--- a/src/client/widgets/index.js
+++ b/src/client/widgets/index.js
@@ -48,6 +48,7 @@ module.exports.widgets = {
// scripts
script: require('./scripts/script'),
+ variable: require('./scripts/variable'),
}
@@ -59,7 +60,7 @@ module.exports.categories = {
'Indicators':['led', 'text'],
'Pads':['xy','rgb','multixy'],
'Sliders':['fader','knob', 'encoder', 'range'],
- 'Scripts':['script'],
+ 'Scripts':['script', 'variable'],
}
var defaults = {}
diff --git a/src/client/widgets/scripts/script.js b/src/client/widgets/scripts/script.js
index 8b478cb4..41f9ce5b 100644
--- a/src/client/widgets/scripts/script.js
+++ b/src/client/widgets/scripts/script.js
@@ -31,7 +31,7 @@ class Script extends Widget {
}, [
- 'visible', 'label', 'interaction',
+ 'visible', 'interaction',
'_geometry', 'left', 'top', 'width', 'height', 'expand',
'_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'css'
diff --git a/src/client/widgets/scripts/variable.js b/src/client/widgets/scripts/variable.js
new file mode 100644
index 00000000..afa114e1
--- /dev/null
+++ b/src/client/widgets/scripts/variable.js
@@ -0,0 +1,41 @@
+var Widget = require('../common/widget'),
+ StaticProperties = require('../mixins/static_properties')
+
+module.exports = class Variable extends StaticProperties(Widget, {bypass: true, interaction: false, visible: false}) {
+
+ static description() {
+
+ return 'Receives / stores a value, to be used in scripts (using the get function) or in properties (using the @{} syntax).'
+
+ }
+
+ static defaults() {
+
+ return super.defaults({
+
+
+ }, [
+ 'visible', 'interaction',
+ '_geometry', 'left', 'top', 'width', 'height', 'expand',
+ '_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'css',
+ 'decimals', 'bypass'
+ ], {})
+
+ }
+
+ constructor(options) {
+
+ super({...options, html: null})
+
+ }
+
+
+ setValue(v, options={}) {
+
+ this.value = v
+
+ if (options.sync) this.changed(options)
+
+ }
+
+}
diff --git a/src/server/midi.js b/src/server/midi.js
index fdcd299b..354e3280 100644
--- a/src/server/midi.js
+++ b/src/server/midi.js
@@ -63,7 +63,7 @@ class MidiConverter {
try {
[name, data] = JSON.parse(message)
} catch (err) {
- // console.log(err)
+ if (settings.read('debug')) console.error(`(DEBUG, MIDI) Unparsed python log:\n ${message}`)
}
if (name == 'log') {
if (data.indexOf('ERROR') > -1) {
@@ -93,7 +93,9 @@ class MidiConverter {
}
}
- MidiConverter.parseIpc(results)
+ for (let r of results) {
+ MidiConverter.parseIpc(r)
+ }
})
}
diff --git a/tests/test.js b/tests/test.js
index 10bf719e..924f455d 100644
--- a/tests/test.js
+++ b/tests/test.js
@@ -16,7 +16,7 @@ var widgets = {
'Indicators':['led', 'text'],
'Pads':['xy','rgb','multixy', 'canvas'],
'Sliders':['fader','knob', 'encoder', 'range'],
- 'Scripts':['script'],
+ 'Scripts':['script', 'variable'],
}
for (let k in widgets) {
for (let type of widgets[k]) {