-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from vkottler/dev/ui
Dev/UI
- Loading branch information
Showing
46 changed files
with
760 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ coverage*.xml | |
tags | ||
mklocal | ||
docs | ||
compile_commands.json | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
let g:ale_linters["javascript"] = ["eslint"] | ||
let g:ale_fixers["javascript"] = ["clang-format"] | ||
|
||
let g:ale_c_cc_executable = 'emcc' | ||
let g:ale_c_cc_options = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule config
updated
8 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
major: 3 | ||
minor: 11 | ||
patch: 0 | ||
patch: 1 | ||
entry: runtimepy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.flex-column-scroll-bodge { | ||
height: 100%; | ||
flex-wrap: nowrap; | ||
overflow-y: scroll; | ||
flex-shrink: 0; | ||
} | ||
|
||
.tab-content-scroll-bodge { | ||
width: 100%; | ||
height: 100%; | ||
overflow: scroll; | ||
} | ||
|
||
.button-bodge { | ||
text-align: left; | ||
} | ||
|
||
.collapsing { | ||
transition: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
console.log("env.js"); | ||
|
||
/* | ||
tab.container.querySelector("button").onclick = async event => { | ||
// | ||
tab.send_message({kind : "button.pressed"}); | ||
// | ||
}; | ||
tab.message_handlers.push((data) => { | ||
console.log("-----" + tab.name + "-----"); | ||
console.log(data); | ||
console.log("---------------------------"); | ||
}); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* An array of initialization methods to run. */ | ||
let inits = []; | ||
let tabs = {}; | ||
|
||
/* | ||
* Define class for generated code to use (instead of generating so many | ||
* methods). | ||
*/ | ||
class TabInterface { | ||
constructor(name, _worker) { | ||
this.name = name; | ||
this.worker = _worker; | ||
|
||
/* Relevant elements. */ | ||
this.button = document.getElementById("runtimepy-" + this.name + "-tab"); | ||
this.container = document.getElementById("runtimepy-" + this.name); | ||
|
||
this.message_handlers = []; | ||
|
||
this.button.addEventListener("hidden.bs.tab", | ||
this.hidden_handler.bind(this)); | ||
this.button.addEventListener("shown.bs.tab", this.shown_handler.bind(this)); | ||
|
||
tabs[this.name] = this; | ||
|
||
if (bootstrap.Tab.getInstance(this.button)) { | ||
this.shown_handler(); | ||
} | ||
} | ||
|
||
send_message(data) { | ||
this.worker.postMessage({name : this.name, event : data}); | ||
} | ||
|
||
shown_handler() { this.send_message({kind : "tab.shown"}); } | ||
|
||
hidden_handler() { this.send_message({kind : "tab.hidden"}); } | ||
|
||
onmessage(data) { | ||
for (const handler of this.message_handlers) { | ||
handler(data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Do some heinous sh*t to create a worker from our 'text/js-worker' element. | ||
*/ | ||
const worker = new Worker(window.URL.createObjectURL(new Blob( | ||
Array.prototype.map.call( | ||
document.querySelectorAll("script[type='text\/js-worker']"), | ||
(script) => script.textContent, | ||
), | ||
{type : "text/javascript"}, | ||
))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Just an example. */ | ||
|
||
function import_pyodide() { | ||
importScripts("https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js"); | ||
} | ||
|
||
import_pyodide(); | ||
|
||
const script = ` | ||
import js | ||
import js_local | ||
from runtimepy.primitives import create | ||
print(create("uint8")) | ||
# can send messages to main thread | ||
js.postMessage("What's good bud!") | ||
# can access connection and config state | ||
print(js_local.config.config.app) | ||
`; | ||
|
||
/* Worker entry. */ | ||
async function start(config) { | ||
/* Run pyodide. */ | ||
let pyodide = await loadPyodide(); | ||
await pyodide.loadPackage("micropip"); | ||
const micropip = pyodide.pyimport("micropip"); | ||
|
||
/* Install packages. */ | ||
await micropip.install("runtimepy"); | ||
|
||
/* Register namespace for local state. */ | ||
pyodide.registerJsModule( | ||
"js_local", {config : config, conns : create_connections(config)}); | ||
|
||
await pyodide.runPythonAsync(script); | ||
} |
Oops, something went wrong.