Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
bordun 2020-06-25 00:06:54 +02:00
commit ff4cd0b01a
10 changed files with 62 additions and 8 deletions

View file

@ -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

View file

@ -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": {

View file

@ -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)

View file

@ -714,3 +714,6 @@
| <h6 id="script_keyBinding">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation) |
| <h6 id="script_keyRepeat">keyRepeat<a class="headerlink" href="#script_keyRepeat" title="Permanent link">#</a></h6> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |
| <h6 id="script_keyType">keyType<a class="headerlink" href="#script_keyType" title="Permanent link">#</a></h6> | `string` | <code>"keydown"</code> | Determines which key event trigger the script's execution<br/><br/>Choices: `keydown`, `keyup`, `both` |
??? api "<div id="variable">variable<a class="headerlink" href="#variable" title="Permanent link">#</a></div>"
Receives / stores a value, to be used in scripts (using the get function) or in properties (using the @{} syntax).

View file

@ -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.

View file

@ -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 = {}

View file

@ -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'

View file

@ -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)
}
}

View file

@ -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)
}
})
}

View file

@ -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]) {