Skip to content

Commit

Permalink
Add more helping text about ImageJ.JS
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanguage committed Dec 30, 2023
1 parent 95543c1 commit 6146f33
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ await api.restart()
await api.insertHtml("<h1>Hello World</h1>", width="100%", height="100px")
```

### Using in ImageJ.JS

This console can be used in [ImageJ.JS](https://ij.imjoy.io) as a ImJoy plugin.
Click the Upper left ImJoy icon to open the menu, then click `+ ImJoy Plugin` to add a new plugin. Then enter the following URL to install the plugin:

```
https://nanguage.github.io/web-python-console/
```

Editor:

```
https://nanguage.github.io/web-python-console/python-editor.imjoy.html
```

Then click the menu again and click `web-python-console` to open the console, or click `python-editor` to open the editor.

### Integreate with BioImage.IO ChatBot

Install and run the following plugin to register the extension for BioImage.IO ChatBot:
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@

document.pyodideMplTarget = $(".terminal-wrapper")[0]

term.echo("--- Initializing Pyodide ---")
term.echo("--- Initializing ---")
term.pause();
if (initIj) {
await initImJoy();
Expand Down
10 changes: 7 additions & 3 deletions public/python-editor.imjoy.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<config lang="json">
{
"name": "PyEditor",
"name": "python-editor",
"type": "web-worker",
"tags": [],
"ui": "",
Expand All @@ -22,6 +22,9 @@
class ImJoyPlugin {
async setup() {
api.log('initialized')
}

async getPythonConsole() {
let pycon;
if ("getConsole" in api) {
pycon = await api.getConsole("python")
Expand All @@ -36,13 +39,13 @@
})
}
}
this.pycon = pycon
return pycon
}

async run(ctx) {
let pluginInEditor, stopped, editorWindow;
const config = {lang: 'python'}
const pycon = this.pycon
const getPythonConsole = this.getPythonConsole
config.templates = [
{
name: "Matplotlib demo",
Expand Down Expand Up @@ -82,6 +85,7 @@
try {
editorWindow.setLoader(true);
api.showProgress(0);
const pycon = await getPythonConsole()
pycon.exec(content)
} catch (e) {
api.showMessage("Failed to run script, error: " + e.toString());
Expand Down

0 comments on commit 6146f33

Please sign in to comment.