git: ugly reset to remove 3000 commits that don't exist

--- relevant commits ---
commit fa63c7ec3596c9afb4f07f75583b2357f4ef6c85 (HEAD -> master, origin/master, origin/HEAD)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 19:53:00 2020 +0100

    console: don't submit onBlur

commit b653c2edd3be4991dfcd6ed82c76dd3ed2526edb
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 19:48:24 2020 +0100

    ui: restore left & right panel minWidth

commit 3a1af3f9ec70857548d412ce2971992650fa2899
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 19:45:42 2020 +0100

    console: seamless input

commit ec2d49379431a5a6b54968f4dc15bc28286e3741
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 15:08:22 2020 +0100

    console: css tweaks

commit 5248fbe4241134ddf56697180a62f8f89c5f382c
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 14:58:03 2020 +0100

    console: history tweak

commit 8c49baf8d7f9546ab3ab19f9296e5acbf60a364f
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 14:57:47 2020 +0100

    server: allow console osc out

commit 152c6f7276055492bf4a637d5a7a678164d6513b
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 12:32:14 2020 +0100

    lint

commit 1158118db89bb3b14fb2972d020371aac3d8f198
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 12:30:18 2020 +0100

    ipc: set samesite attr on client_id cookie

commit 25fd79474da4ecba8e80e8d00ac63d4dfb62ca66
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 12:24:55 2020 +0100

    console: tweaks

commit 3d39ea9c0a3a28a7344abb023acb76df75f59ba9
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 11:57:45 2020 +0100

    console: add interpreter

commit 961ebe7518
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Thu Nov 12 08:16:22 2020 +0100

    widget: lazy load uiConsole

commit 96f0d3c00f (tag: v1.7.0-beta2)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 22:46:38 2020 +0100

    ios: clone widget not laid out properly in horizontal panels

commit a8e0ac344a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 19:56:35 2020 +0100

    console: unified widget error, with quick edit link from the console

commit 6000d1a67a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 17:31:33 2020 +0100

    package: beta 2

commit d8b1fc298f
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 17:30:06 2020 +0100

    ui: overflow hidden on workspaces introduces some overflow scroll with the console panel

commit 35374a7c1c
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 17:24:22 2020 +0100

    session: compat: increment toolbar() usages (new console item)

commit ff78df42b6
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 17:17:33 2020 +0100

    console: tweaks

commit 33581804ac
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Wed Nov 11 16:28:18 2020 +0100

    ui: move console to full bottom panel

commit dd6b85f6ff
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 16:09:31 2020 +0100

    session: v0 label compat tweak

commit 42c4b0f6cd
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 15:50:56 2020 +0100

    session: v0 label conversion fix on tabs

commit 9431fd722e (tag: v1.7.0-beta1)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 13:05:06 2020 +0100

    docs, log & restore user rpi build

commit c9e3641332
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 11:13:56 2020 +0100

    python: resolve bin path

commit 8030744325
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 11:13:45 2020 +0100

    docs: add link

commit 4ce960139a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 10:18:31 2020 +0100

    package: wrong path on osx

commit 2bc507a17b
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 09:48:14 2020 +0100

    package: 1.7.0 beta 1

commit 16579241ce
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 09:45:32 2020 +0100

    package: document midi support and install process

commit b8173294aa
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 09:24:54 2020 +0100

    package: reduce number of prebuilt binaries (keep 64bit linux/windows/osx + node)

commit df215612c5
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date:   Tue Nov 10 08:39:27 2020 +0100

    midi: bump version
This commit is contained in:
bordun 2020-11-12 20:01:17 +01:00
parent 43b0ab9fea
commit 82361e2f60
30 changed files with 480 additions and 205 deletions

View file

@ -24,28 +24,23 @@ before_deploy:
- npm run build-docs
- npm run package -- --all
- npm run package-node
- npm run deb32
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-linux-x64/resources/app/server/
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-win32-x64/resources/app/server/
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx
- cd $TRAVIS_BUILD_DIR
- npm run deb64
- npm run debarm
- cd dist
- mkdir packages
- mv open-stage-control-linux-ia32/*.deb packages/open-stage-control-${VERSION}-i386.deb
- mv open-stage-control-linux-x64/*.deb packages/open-stage-control-${VERSION}-amd64.deb
- mv open-stage-control-linux-armv7l/*.deb packages/open-stage-control-${VERSION}-armv7l.deb
- mv open-stage-control-node open-stage-control-${VERSION}-node
- mv open-stage-control-win32-ia32 open-stage-control-${VERSION}-win32-ia32
- mv open-stage-control-win32-x64 open-stage-control-${VERSION}-win32-x64
- mv open-stage-control-linux-ia32 open-stage-control-${VERSION}-linux-ia32
- mv open-stage-control-linux-x64 open-stage-control-${VERSION}-linux-x64
- mv open-stage-control-linux-armv7l open-stage-control-${VERSION}-linux-armv7l
- mv open-stage-control-linux-arm64 open-stage-control-${VERSION}-linux-arm64
- zip -q -r --symlinks packages/open-stage-control-${VERSION}-osx.zip open-stage-control-darwin-x64/open-stage-control.app
- zip -q -r packages/open-stage-control-${VERSION}-node.zip open-stage-control-${VERSION}-node
- zip -q -r packages/open-stage-control-${VERSION}-win32-ia32.zip open-stage-control-${VERSION}-win32-ia32
- zip -q -r packages/open-stage-control-${VERSION}-win32-x64.zip open-stage-control-${VERSION}-win32-x64
- zip -q -r packages/open-stage-control-${VERSION}-linux-ia32.zip open-stage-control-${VERSION}-linux-ia32
- zip -q -r packages/open-stage-control-${VERSION}-linux-x64.zip open-stage-control-${VERSION}-linux-x64
- zip -q -r packages/open-stage-control-${VERSION}-linux-armv7l.zip open-stage-control-${VERSION}-linux-armv7l
- zip -q -r packages/open-stage-control-${VERSION}-linux-arm64.zip open-stage-control-${VERSION}-linux-arm64
- ls packages
- cd ..

View file

@ -1,20 +1,33 @@
# Changelog
## 1.6.3
## 1.7.0
**Important change**
Prebuilt binaries are now supplied only for 64bit Linux/MacOs/Windows. Other platforms should use the `node` package or build it from sources.
**MIDI support**
As of this version, packages except the `node` package are bundled with a midi binary that will be used whenever midi's `path` option is not set. It is no longer necessary to install `python` and `python-rtmidi`.
**Changelog**
- bug fixes
- missing context menu (copy, paste) in inspector inputs
- osc listeners not resolving "auto" address
- `ELECTRON_RUN_AS_NODE` headless mode not working without `--no-gui` option
- ios: clone widget not laid out properly in horizontal panels
- editor
- add console panel under the inspector to ease debugging
- ui
- add console bottom panel with a simple script interpreter
- widgets
- keyboard: add `velocity` property (allows mapping the touch coordinates between `off` (top) and `on` (bottom))
- input: add `validation` property (allows defining a regular expression that the valud must match)
- input: add `validation` property (allows defining a regular expression that the value must match)
- midi
- accept sending sysex strings without spaces between the bytes
- load prebuilt midi binary on 64bit linux/windows/osx
- misc
- sessions converted from v0 will use the widget's html property to display the former label property

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.6.2",
"version": "1.7.0-beta2",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"
@ -83,11 +83,8 @@
"start": "electron app/",
"build": "npm run build-css && npm run build-js && node scripts/copy-assets.js && echo '\\033[36m=> JS and CSS assets built successfully. Run \"npm run package\" to build an executable or \"npm start\" to run the app.\\033[0m\n'",
"package": "node scripts/package.js",
"package-rpi": "node scripts/package.js --old-rpi",
"package-node": "node scripts/package-node.js",
"deb32": "electron-installer-debian --src dist/open-stage-control-linux-ia32/ --arch i386 --dest dist/open-stage-control-linux-ia32/ --icon resources/images/logo.png",
"deb64": "electron-installer-debian --src dist/open-stage-control-linux-x64/ --arch amd64 --dest dist/open-stage-control-linux-x64/ --icon resources/images/logo.png",
"debarm": "electron-installer-debian --src dist/open-stage-control-linux-armv7l/ --arch armv7l --dest dist/open-stage-control-linux-armv7l/ --icon resources/images/logo.png",
"build-css": "node scripts/build-css.js",
"build-js": "npm run build-launcher-js && npm run build-client-js && npm run build-server-js",
"build-client-js": "node scripts/build-client.js",

View file

@ -28,11 +28,11 @@ iOS devices must be of version `10.3` or higher.
## Installation
??? example "Linux"
??? example "Linux 64bit"
**Ubuntu / Debian**
- [Download](/download) `open-stage-control-VERSION-ARCH.deb`
- [Download](/download) `open-stage-control-VERSION-amd64.deb`
- Install it by running this as root in a terminal:
```bash
dpkg -i path/to/open-stage-control-VERSION-ARCH.deb
@ -40,18 +40,25 @@ iOS devices must be of version `10.3` or higher.
**Other linux distributions**
- [Download](/download) `open-stage-control-VERSION-linux-ARCH.zip`
- [Download](/download) `open-stage-control-VERSION-linux-x64.zip`
- Extract it in the location of your choice
- The file inside it named `open-stage-control` is the app's main executable
??? example "Mac"
??? example "Mac 64bit"
- [Download](/download) `open-stage-control-VERSION-osx.zip`
- Extract it in the location of your choice
- Drag `open-stage-control.app` in your `Application` folder
??? example "Windows"
??? example "Windows 64bit"
- [Download](/download) `open-stage-control-VERSION-win32-ARCH.zip`
- [Download](/download) `open-stage-control-VERSION-win32-x64.zip`
- Extract it in the location of your choice
- The file inside it named `open-stage-control.exe` is the app's main executable
??? example "Other systems"
- Install [Node.js](https://nodejs.org/en/download/package-manager/)
- Download `open-stage-control-VERSION-node.zip`
- Extract it in the location of your choice
- In a terminal, run `node /path/to/open-stage-control-VERSION-node --help`

View file

@ -21,6 +21,13 @@ npm install
npm run build
```
!!! tip "Raspberry systems"
Run this instead of `npm install` if the architecture is `armv7l`
```
npm install --arch=armv7l
```
!!! info "Updating from sources"
```bash
git pull
@ -51,12 +58,9 @@ npm run build-docs
## Package from sources
Follow the "Run from sources" instructions, then:
```bash
git clone https://github.com/jean-emmanuel/open-stage-control
cd open-stage-control/
# uncomment next line if you want the latest release
# instead of the current development version
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
# TARGET_PLATFORM can be linux, win32 (windows) or darwin (os x)
export PLATFORM=TARGET_PLATFORM
@ -64,21 +68,8 @@ export PLATFORM=TARGET_PLATFORM
export ARCH=TARGET_ARCH
npm install
# run this instead if ARCH is armv7l
# npm install --arch=armv7l
npm run build
npm run package
# Do one of the following if you want a deb package for debian/ubuntu
npm run deb32
npm run deb64
npm run debarm
# The node-only package can be built with
npm run package-node
@ -89,3 +80,10 @@ This will build the app in `dist/open-stage-control-PLATFORM-ARCH`.
!!! info ""
Building the app for windows from a linux system requires wine to be installed.
## Debian/Ubuntu installer
```
npm run deb64
```

View file

@ -1,46 +1,55 @@
## Installation
Enabling MIDI support in Open Stage Control requires additional softwares to be installed on the server's system:
- [python 3](https://www.python.org/downloads/)
- python package [python-rtmidi](https://spotlightkid.github.io/python-rtmidi/installation.html#from-pypi)
=== "Linux / Windows / OSX"
??? example "Linux"
Since version `1.7.0`, Open Stage Control comes bundled with built-in MIDI support if you're using the 64bit package for Linux, OSX or Windows.
- Install `python3` and `python3-pip` from your distribution's package repository
- Install `python-rtmidi` from a terminal by executing this command
```bash
python3 -m pip install python-rtmidi --upgrade
```
??? example "Mac"
=== "Other systems"
- Download and install [Python 3 for Mac OS](https://www.python.org/downloads/mac-osx/)
- Open a terminal
- Install `pip` (package installer for python) by executing these commands
```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
- Install `python-rtmidi` by executing this command
```bash
python -m pip install python-rtmidi --upgrade
```
Enabling MIDI support on other systems or when building Open Stage Control from sources requires additional softwares to be installed on the server's system:
??? example "Windows"
- [python 3](https://www.python.org/downloads/)
- python package [python-rtmidi](https://spotlightkid.github.io/python-rtmidi/installation.html#from-pypi)
- Download and install [Python 3 for Windows](https://www.python.org/downloads/windows/)
- **make sure to check the option** "Add Python 3.x to PATH"
- Open a terminal (++win+r++)
- Install `pip` (package installer for python) by executing these commands
```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
- Install `python-rtmidi` by executing this command
```bash
python -m pip install python-rtmidi --upgrade
```
??? example "Linux"
- Install `python3` and `python3-pip` from your distribution's package repository
- Install `python-rtmidi` from a terminal by executing this command
```bash
python3 -m pip install python-rtmidi --upgrade
```
??? example "Mac"
- Download and install [Python 3 for Mac OS](https://www.python.org/downloads/mac-osx/)
- Open a terminal
- Install `pip` (package installer for python) by executing these commands
```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
- Install `python-rtmidi` by executing this command
```bash
python -m pip install python-rtmidi --upgrade
```
??? example "Windows"
- Download and install [Python 3 for Windows](https://www.python.org/downloads/windows/)
- **make sure to check the option** "Add Python 3.x to PATH"
- Open a terminal (++win+r++)
- Install `pip` (package installer for python) by executing these commands
```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
- Install `python-rtmidi` by executing this command
```bash
python -m pip install python-rtmidi --upgrade
```
## Configuration
@ -73,17 +82,17 @@ Enable parsing of midi time code messages (disabled by default). These will be r
Send program changes with a `-1` offset to match some software/hardware implementations
**`path=/path/to/python`**
Indicates where to find python binary in case open stage control doesn't (`Error: spawn python3 ENOENT`).
**`device_name:virtual`** (*Linux / Mac only*): creates a virtual midi device with one input port and one output port
**`jack`** (*Linux only*): use JACK MIDI instead of ALSA. `python-rtmidi` must be compiled with [jack support](https://spotlightkid.github.io/python-rtmidi/installation.html#linux) for this to work.
**`path=/path/to/python`**
Indicates where to find python binary in case open stage control doesn't (`Error: spawn python3 ENOENT`). *Only use this if you know what you are doing.*
## Widget setup
In order to send MIDI messages, a widget must have at least one `target` formatted as follows:

View file

@ -1,5 +1,8 @@
# Download the latest release
!!! tip ""
[*Click here*](/docs/getting-started/introduction/#installation) to read the installation guide.
<a href="https://github.com/jean-emmanuel/open-stage-control/releases/latest"> Open Stage Control <span id="osc-version"span></a>
<div id="osc-assets">Loading assets...</div>

View file

@ -5,16 +5,14 @@ const packager = require('electron-packager'),
licensePath = path.resolve(__dirname + '/../LICENSE'),
fs = require('fs')
var rpi = process.argv.includes('--old-rpi'),
all = process.argv.includes('--all')
var all = process.argv.includes('--all')
packager({
dir: path.resolve(__dirname + '/../app'),
name: appData.name,
all: all ? true : undefined,
platform: rpi ? 'linux' : process.env.PLATFORM,
arch: rpi ? 'armv7l' : process.env.ARCH,
electronVersion: rpi ? '1.7.11' : require('../package.json').optionalDependencies.electron,
platform: all ? ['linux', 'win32', 'darwin'] : process.env.PLATFORM,
arch: process.env.ARCH || 'x64',
electronVersion: process.env.ARCH === 'armv7l' ? '1.7.11' : require('../package.json').optionalDependencies.electron,
overwrite: true,
out: path.resolve(__dirname + '/../dist'),
icon: path.resolve(__dirname + '/../resources/images/logo'),

View file

@ -52,7 +52,7 @@ class Editor {
w.props[propName] = previousValue
updateWidget(w, {changedProps: [propName], preventSelect: this.selectedWidgets.length > 1})
if (uiConsole.minimized || rightUiSidePanel.minimized) notifications.add({
if (uiConsole.minimized) notifications.add({
class: 'error',
message: locales('inspector_error'),
duration: 7000

View file

@ -44,7 +44,7 @@ class Ipc extends EventEmitter {
this.socket.send('["pong"]')
})
document.cookie = 'client_id=' + uuid
document.cookie = 'client_id=' + uuid + ';samesite=strict'
try {
this.open()

View file

@ -1,7 +1,8 @@
module.exports = {
// console
console_title: 'Console',
console: 'Console',
console_enabled: 'Enabled',
console_clear: 'Clear console',

View file

@ -1,7 +1,8 @@
module.exports = {
// console
console_title: 'Console',
console: 'Console',
console_enabled: 'Activée',
console_clear: 'Vider la console',
// editor

View file

@ -212,7 +212,7 @@ var converters = [
}
var label = data.label === undefined ? 'auto' : data.label
if (label !== false && data.type && !data.type.match(/button|menu|modal|clone|html/)) {
if (label !== false && data.type && data.type && !data.type.match(/button|menu|modal|clone|html|tab/)) {
label = label === 'auto' ? '@{this.id}' : label
data.html = label
}
@ -239,6 +239,17 @@ var converters = [
}
}
},
{
version: '1.6.2',
widget: (data)=>{
if (data.script && String(data.script).includes('toolbar(')) {
// new "console" submenu in toolbar at index 3
data.script = String(data.script).replace('toolbar(4)', 'toolbar(5)').replace('toolbar(3)', 'toolbar(4)')
}
}
}
]

View file

@ -159,11 +159,6 @@ var menuEntries = [
action: ()=>{return rightUiSidePanel.minimized ? rightUiSidePanel.restore() : rightUiSidePanel.minimize()},
shortcut: 'mod + i'
},
{
label: locales('console_title'),
class: ()=>{return 'toggle ' + (uiConsole.minimized ? 'off' : 'on')},
action: ()=>{return uiConsole.minimized ? uiConsole.restore() : uiConsole.minimize()}
},
{
separator: true
},
@ -174,6 +169,24 @@ var menuEntries = [
}
]
},
{
label: locales('console'),
action: [
{
label: locales('console_enabled'),
class: ()=>{return 'toggle ' + (uiConsole.minimized ? 'off' : 'on')},
action: ()=>{return uiConsole.minimized ? uiConsole.restore() : uiConsole.minimize()},
shortcut: 'mod + k'
},
{
separator: true
},
{
label: locales('console_clear'),
action: uiConsole.clear.bind(uiConsole),
},
]
},
{
separator: true
},

View file

@ -2,7 +2,9 @@ var UiSidePanel = require('./ui-sidepanel'),
html = require('nanohtml'),
raw = require('nanohtml/raw'),
locales = require('../locales'),
{icon} = require('./utils')
{icon} = require('./utils'),
Script = require('../widgets/scripts/script'),
widgetManager = require('../managers/widgets')
class UiConsole extends UiSidePanel {
@ -12,10 +14,11 @@ class UiConsole extends UiSidePanel {
this.header = DOM.get(this.container, 'osc-panel-header')[0]
this.header.appendChild(html`<label>${locales('console_title')}</label>`)
this.header.appendChild(html`<label>${locales('console')}</label>`)
this.messages = this.content.appendChild(html`<osc-console></osc-console>`)
// this.inputWrapper = this.container.appendChild(html`<osc-console-input></osc-console-inpu>`)
// this.input = this.inputWrapper.appendChild(html`<textarea></textarea>`)
this.inputWrapper = this.content.appendChild(html`<osc-console-input></osc-console-inpu>`)
this.input = this.inputWrapper.appendChild(html`<textarea rows="1"></textarea>`)
this.actions = this.header.appendChild(html`<div class="actions"></div>`)
this.clearBtn = this.actions.appendChild(html`<div class="clear" title="${locales('console_clear')}">${raw(icon('trash'))}</div>`)
@ -26,44 +29,102 @@ class UiConsole extends UiSidePanel {
this.length = 0
this.maxLength = 200
var _this = this,
log = console.log,
error = console.error
this.history = ['']
this.cursor = 0
var _this = this
console._log = console.log
console.log = function(message){
_this.log('log', message)
log(...arguments)
console._log(...arguments)
}
console._error = console.error
console.error = function(message){
_this.log('error', message)
error(...arguments)
console._error(...arguments)
}
// this.input.addEventListener('keydown', (event)=>{
// if (event.keyCode === 13 && !event.shiftKey) {
//
// event.preventDefault()
// DOM.dispatchEvent(event.target, 'change')
//
// }
// })
//
// this.input.addEventListener('change', (event)=>{
// try {
// console.log(eval(this.input.value))
// } catch (err) {
// console.error(err)
// }
// this.input.value = ''
// })
this.script = new Script({props:{
id: 'CONSOLE',
script: 'return eval(value)',
event: 'value'
}, parent: widgetManager})
this.script._not_editable = true
this.script.hash = 'CONSOLE'
this.input.addEventListener('keydown', (event)=>{
if (event.keyCode === 13 && !event.shiftKey) {
event.preventDefault()
this.inputValidate()
} else if (event.keyCode === 38) {
if (this.cursor < this.history.length - 1) {
if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== 1) return
this.cursor += 1
this.input.value = this.history[this.cursor]
event.preventDefault()
}
} else if (event.keyCode === 40) {
if (this.cursor > 0) {
var nLines = this.input.value.split('\n').length
if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== nLines) return
this.cursor -= 1
this.input.value = this.history[this.cursor]
event.preventDefault()
}
} else if (event.keyCode === 9) {
var cur = this.input.selectionStart,
val = this.input.value
this.input.value = val.slice(0, cur) + ' ' + val.slice(cur)
event.preventDefault()
}
this.inputSize()
})
this.input.addEventListener('input', (event)=>{
this.inputSize()
})
this.enable()
}
log(type, message) {
inputSize() {
this.input.setAttribute('rows',0)
this.input.setAttribute('rows', this.input.value.split('\n').length)
}
inputValidate() {
if (this.input.value == '') return
this.log('input', `${this.input.value}`)
var returnValue = this.script.setValue(this.input.value, {sync: true, send: true})
if (returnValue === undefined) {
this.log('output undefined', 'undefined')
} else {
this.log('output value', returnValue)
}
if (this.input.value !== this.history[this.cursor] && this.input.value !== this.history[1]) {
this.history.splice(1, 0, this.input.value)
if (this.history.length > 10) this.history.pop()
}
this.input.value = ''
this.cursor = 0
}
log(type, message, html) {
var node = this.messages.appendChild(html`
<osc-console-message class="${type}">
@ -81,7 +142,12 @@ class UiConsole extends UiSidePanel {
}
}
node.textContent = message
if (html) {
node.innerHTML = message
} else {
node.textContent = message
}
if (type !== 'error' && node.textContent.match(/error/i)) node.classList.add('error')
node.scrollIntoView()
@ -105,9 +171,10 @@ class UiConsole extends UiSidePanel {
this.messages.innerHTML = ''
this.length = 0
this.script.onRemove()
}
}
module.exports = new UiConsole({selector: '#osc-console', size: 40})
module.exports = new UiConsole({selector: '#osc-console', minSize: 40, size: 200, minimized: true})

View file

@ -17,11 +17,13 @@ class UiSidePanel extends UiWidget {
this.cacheKey = 'ui.' + options.selector
this.minWidth = options.size === undefined ? 250 : options.size
this.width = cache.get(this.cacheKey + '.width') || options.size || 250
var size = cache.get(this.cacheKey + '.width') || 250
this.minWidth = options.minSize !== undefined ? options.minSize : (options.size !== undefined ? options.size : 250)
this.width = size !== undefined ? size : (options.size !== undefined ? options.size : 250)
this.disabled = false
this.minimized = cache.get(this.cacheKey + '.minimized') || false
var minimized = cache.get(this.cacheKey + '.minimized')
this.minimized = minimized !== null ? minimized : (options.minimized || false)
this.init = false

View file

@ -13,7 +13,7 @@ var EventEmitter = require('../../events/event-emitter'),
morph = require('nanomorph'),
sanitizeHtml = require('sanitize-html'),
updateWidget = ()=>{},
Script
Script, uiConsole
var oscReceiverState = {}
@ -35,6 +35,7 @@ DOM.ready(()=>{
setTimeout(()=>{
updateWidget = require('../../editor/data-workers').updateWidget
uiConsole = require('../../ui/ui-console')
})
class Widget extends EventEmitter {
@ -215,6 +216,7 @@ class Widget extends EventEmitter {
script: this.getProp('script'),
event: 'value'
}, builtIn: true, parent: this})
this.script._not_editable = true
this.on('change', (e)=>{
if (e.widget === this && this.mounted && !e.options.fromEdit) {
this.script.setValue(e.options.widget ? e.options.widget.value : this.value, {...e.options, id: e.options.id || e.id})
@ -659,9 +661,7 @@ class Widget extends EventEmitter {
})
} catch (err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': JS{{}} error:\n' + err + line)
this.errorProp(propName, 'JS{{}}', err)
}
try {
@ -680,9 +680,7 @@ class Widget extends EventEmitter {
})
} catch (err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err + line)
this.errorProp(propName, '#{}', err)
}
for (let k in variables) {
@ -878,6 +876,25 @@ class Widget extends EventEmitter {
}
errorProp(name, type, error) {
let stackline = error.stack ? (error.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - (type.includes('{}') ? 1 : 0)) : '',
id = this.getProp('id') || this.props.id,
widget = this // used for edit link in console
while (widget._not_editable && widget.parent !== widgetManager) {
// ignore non editable
widget = widget.parent
}
// ignore clone wrapper
if (widget.parent !== widgetManager && widget.parent.getProp('type') === 'clone') widget = widget.parent
console._error(`${id}.${name} ${type} error${line}: ${error}`)
uiConsole.log('error', `<span class="edit-widget" data-widget="${widget.hash}">${id}</span>.${name} ${type} error${line}: ${error}`, true)
}
setContainerStyles(styles = ['geometry', 'css', 'visibility']) {
if (styles.includes('geometry')) {

View file

@ -27,7 +27,7 @@ class Clone extends Container() {
value: null,
osc: null
})
defaults.style = {css: defaults.style.css}
return defaults
@ -98,6 +98,7 @@ class Clone extends Container() {
if (e.widget !== this) {
e.widget.container.classList.add('not-editable')
e.widget._not_editable = true
}
})

View file

@ -133,6 +133,7 @@ class Keyboard extends Panel {
key._index = i - start
key.container.classList.add('not-editable')
key._not_editable = true
key.container.classList.add('key')
if (pattern[i % 12] == 'w') {

View file

@ -80,6 +80,7 @@ class Matrix extends Panel {
widget._index = i
widget.container.classList.add('not-editable')
widget._not_editable = true
this.value[i] = widget.getValue()
@ -152,6 +153,7 @@ class Matrix extends Panel {
this.children[i].updateProps(Object.keys(data), this, options)
// this.children[i] might have been recreated
this.children[i].container.classList.add('not-editable')
this.children[i]._not_editable = true
}

View file

@ -150,6 +150,7 @@ class PatchBay extends Container(Canvas) {
parent: this
})
w.container.classList.add('not-editable')
w._not_editable = true
this.inputsWidgets.push(w)
this.inputNodes.push(w.container)
}

View file

@ -271,7 +271,7 @@ class ScriptVm extends Vm {
try {
callback()
} catch(e) {
console.log(e)
this.errorProp('script', 'setTimeout', e)
}
this.setWidget()
this.setValueOptions()
@ -309,7 +309,7 @@ class ScriptVm extends Vm {
try {
callback()
} catch(e) {
console.log(e)
this.errorProp('script', 'setInterval', e)
}
this.setWidget()
this.setValueOptions()

View file

@ -89,9 +89,7 @@ class Script extends Widget {
} catch(err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
this.errorProp('script', 'javascript', err)
this.script = ()=>{}
}
@ -105,17 +103,17 @@ class Script extends Widget {
scriptVm.setWidget(this)
this.scriptLock = true
var returnValue
try {
this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
returnValue = this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
} catch(err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
this.errorProp('script', 'javascript', err)
}
this.scriptLock = false
scriptVm.setWidget()
return returnValue
}
@ -125,7 +123,7 @@ class Script extends Widget {
scriptVm.setValueOptions(options)
this.run({
var returnValue = this.run({
value: v,
id: options.id,
touch: options.touch
@ -133,6 +131,8 @@ class Script extends Widget {
scriptVm.setValueOptions(options)
return returnValue
}
}

View file

@ -17,40 +17,42 @@
</head>
<body>
<osc-workspace>
<osc-toolbar id="main-menu"></osc-toolbar>
<osc-panel-container class="left">
<div class="resize-handle left"></div>
<div class="toggle-button left"></div>
<osc-panel-inner class="left">
<osc-workspace class="vertical">
<osc-panel-container class="horizontal" id="main">
<osc-toolbar id="main-menu"></osc-toolbar>
<osc-panel-container class="left">
<div class="resize-handle left"></div>
<div class="toggle-button left"></div>
<osc-panel-inner class="left">
<osc-panel-header></osc-panel-header>
<osc-panel-content class="left" id="osc-tree"></osc-panel-content>
</osc-panel-inner>
</osc-panel-container>
<osc-panel-container class="center">
<osc-panel-header id="osc-greeting-header"></osc-panel-header>
<osc-panel-inner id="osc-container"></osc-panel-inner>
</osc-panel-container>
<osc-panel-container class="right">
<div class="resize-handle right"></div>
<div class="toggle-button right"></div>
<osc-panel-inner class="right">
<osc-panel-header></osc-panel-header>
<osc-panel-content class="right" id="osc-inspector"></osc-panel-content>
</osc-panel-inner>
</osc-panel-container>
<osc-modal-container></osc-modal-container>
</osc-panel-container>
<osc-panel-container class="bottom minimized" id="osc-console">
<div class="resize-handle bottom"></div>
<div class="toggle-button bottom"></div>
<osc-panel-inner class="bottom">
<osc-panel-header></osc-panel-header>
<osc-panel-content class="left" id="osc-tree"></osc-panel-content>
<osc-panel-content></osc-panel-content>
</osc-panel-inner>
</osc-panel-container>
<osc-panel-container class="center">
<osc-panel-header id="osc-greeting-header"></osc-panel-header>
<osc-panel-inner id="osc-container"></osc-panel-inner>
</osc-panel-container>
<osc-panel-container class="right">
<div class="resize-handle right"></div>
<div class="toggle-button right"></div>
<osc-panel-inner class="right">
<osc-panel-header></osc-panel-header>
<osc-panel-content class="right" id="osc-inspector"></osc-panel-content>
<osc-panel-container class="bottom" id="osc-console">
<div class="resize-handle bottom"></div>
<div class="toggle-button bottom"></div>
<osc-panel-inner class="bottom">
<osc-panel-header></osc-panel-header>
<osc-panel-content></osc-panel-content>
</osc-panel-inner>
</osc-panel-container>
</osc-panel-inner>
</osc-panel-container>
<osc-modal-container></osc-modal-container>
</osc-workspace>
<div id="notifications"></div>
</body>

View file

@ -2,7 +2,7 @@ from head import *
from list import *
from utils import *
ipc_send('version', '1.2.0')
ipc_send('version', '1.7.0')
if 'list' in argv:
list()

View file

@ -1,7 +1,9 @@
$padding: 8rem;
#osc-console {
background: var(--color-background);
osc-panel-header {
background: var(--color-ui-background);
border-top: 1rem solid var(--color-background);
}
.toggle-button {
@ -33,15 +35,19 @@ $padding: 8rem;
pointer-events: none;
}
}
osc-panel-content {
display: flex;
flex-direction: column;
font-family: $font-mono;
}
}
osc-console {
display: block;
height: 100%;
padding: $padding;
overflow-y: auto;
background: var(--color-background);
border-bottom: 1rem solid var(--color-background);
}
osc-console-message {
@ -49,24 +55,113 @@ osc-console-message {
cursor: text;
display: block;
white-space: pre;
position: relative;
padding-left: 10rem;
&:before {
content: "▮";
font-family: FontAwesome;
width: 6rem;
display: inline-block;
text-align: center;
position: absolute;
left: 0;
}
&.error {
color: var(--color-error);
&:before {
content: "▮"
}
}
&.input {
&:before {
content: "\f105"
}
}
&.output {
&:before {
content: "\f104"
}
&.undefined {
opacity: 0.5;
}
&.value {
opacity: 0.5;
// &:before {
// opacity: 0.5;
// }
}
}
margin-bottom: 4rem;
.edit-widget {
cursor: pointer;
display: inline-block;
padding: 2rem;
border-radius: 2rem;
&.editing {
background: var(--color-ui-background);
}
&[data-widget="CONSOLE"] {
cursor: default;
background: none;
padding: 1rem;
}
}
* {
user-select: inherit;
}
flex:1;
}
osc-console-input {
display: block;
padding: 4rem;
background: var(--color-ui-background);
height: 30rem;
$field-height: 24rem;
padding-left: 10rem;
&:before {
content: "\f105";
font-family: FontAwesome;
width: 6rem;
display: inline-block;
text-align: center;
position: absolute;
left: 0;
line-height: $field-height - 8rem;
padding: 4rem 6rem;
color: var(--color-accent);
}
textarea {
padding: 4rem;
font-family: $font-mono;
line-height: $field-height - 8rem;
padding: 4rem 6rem;
flex: 1;
overflow-x: auto;
overflow-y: hidden;
resize: none;
white-space: pre;
display: block;
background: var(--color-background);
width: 100%;
height: 100%;
resize: none;
cursor: text;
user-select: initial;
--scrollbar-size: 6rem;
// Chromium scrollbar
&::-webkit-scrollbar-thumb:horizontal {
cursor: normal;
}
// Firefox scrollbar (hidden to preserve height)
scrollbar-width: thin;
&[rows="1"] {
scrollbar-width: none;
}
}
}

View file

@ -6,7 +6,7 @@ osc-workspace {
--color-stroke: var(--color-widget);
// optimize layout recalc
position: absolute;
position: fixed;
top:0;
left:0;
right:0;
@ -14,7 +14,13 @@ osc-workspace {
display: flex;
flex-direction: row;
overflow: hidden;
&.vertical {
flex-direction: column;
}
&.horizontal {
flex-direction: row;
}
}
@ -24,6 +30,12 @@ osc-panel-container {
display:flex;
flex-direction: column;
&.vertical {
flex-direction: column;
}
&.horizontal {
flex-direction: row;
}
&.center {
flex: 1;
@ -328,6 +340,10 @@ osc-panel-content {
}
#main {
flex: 1;
min-height: 40rem;
}
#osc-greeting-header {
--alpha-fill: 0.75;

View file

@ -369,17 +369,20 @@
--widget-spacing: 0;
flex: 1;
position: relative;
> .widget {
border:0!important;
box-shadow: none!important;
position: relative!important;
left:auto!important;
bottom:auto!important;
right:auto!important;
top: auto!important;
width: 100%!important;
height: 100%!important;
// on ios, relative position + 100% size and auto position
// does not work well in flex panels
position: absolute!important;
left:0!important;
bottom:0!important;
right:0!important;
top: 0!important;
width: auto!important;
height: auto!important;
min-height: initial!important;
max-height: initial!important;
min-width: initial!important;

View file

@ -361,7 +361,7 @@ module.exports = {
// cache widget osc data to reduce bandwidth usage
if (!widgetHashTable[clientId]) {
widgetHashTable[clientId] = {}
widgetHashTable[clientId] = {CONSOLE: {}}
}
if (!widgetHashTable[clientId][data.hash]) {

View file

@ -1,24 +1,38 @@
var {PythonShell} = require('python-shell'),
fs = require('fs'),
path = require('path'),
settings = require('./settings'),
midiVersion = '1.2.0'
midiVersion = '1.7.0'
var pythonOptions = {
scriptPath:__dirname,
mode:'text',
}
var midiBinaries = {
linux: 'osc-midi-linux',
darwin: 'osc-midi-osx',
win32: 'osc-midi-windows.exe'
}
var pythonPathOverride
if (process.arch === 'x64' && midiBinaries[process.platform]) {
var p = path.resolve(__dirname, midiBinaries[process.platform])
if (fs.existsSync(p)) {
pythonPathOverride = p
}
}
class MidiConverter {
constructor() {
var pythonPath = settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0]
this.py = new PythonShell('python/midi.py', Object.assign({
args: [
settings.read('debug') ? 'debug' : '',
...settings.read('midi')
],
pythonPath
pythonPath: MidiConverter.getPythonPath()
}, pythonOptions))
this.py.childProcess.on('error', (e)=>{
@ -85,9 +99,7 @@ class MidiConverter {
static list() {
var pythonPath = settings.read('midi') ? settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0] : undefined
PythonShell.run('python/midi.py', Object.assign({pythonPath: pythonPath, args: ['list-only']}, pythonOptions), function(e, results) {
PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['list-only']}, pythonOptions), function(e, results) {
if (e) {
if (e.code === 'ENOENT') {
console.error(`(ERROR, MIDI) Could not find python binary: ${e.message.replace(/spawn (.*) ENOENT/, '$1')}`)
@ -103,6 +115,16 @@ class MidiConverter {
}
static getPythonPath() {
var pythonPath = settings.read('midi') ? settings.read('midi').filter(x=>x.includes('path=')).map(x=>x.split('=')[1])[0] : undefined
if (!pythonPath && pythonPathOverride) pythonPath = pythonPathOverride
return pythonPath
}
}
module.exports = MidiConverter