Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jupyter_renderjs_extension
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
jupyter_renderjs_extension
Commits
544f8249
Commit
544f8249
authored
Mar 07, 2017
by
Sebastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renderjs-extension: update README.md to reflect naming-changes
parent
e4c4a70f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
README.md
README.md
+12
-13
No files found.
README.md
View file @
544f8249
...
...
@@ -2,11 +2,10 @@
This repo contains two things:
1.
A
[
jupyter frontend extension
](
http://jupyter-notebook.readthedocs.io/en/latest/extending/frontend_extensions.html
)
also called nbextension containing the javascript and html required to load arbitrary gadgets. See folder
`renderjs_nbextension/`
.
also called nbextension containing the javascript and html required to load arbitrary gadgets. See directory
*renderjs_nbextension*
.
2.
An
[
ipython extension
](
https://ipython.org/ipython-doc/3/config/extensions/index.html
)
providing
necessary python commands to initiate renderjs and control the loaded gadgets.
This happens directly from the notebook (cells). See
folder
*renderjs_ipyextension/
*
.
This happens directly from the notebook (cells). See
directory
*renderjs_ipyextension
*
.
The extension needs both the nbextension and the ipython-extension installed and enabled
in order to function.
...
...
@@ -20,10 +19,10 @@ be used. Instead the ERP5-backend provides the functionality directly.
# Install
## Via slapos
n
othing needs to be done, as the extension is shipped with the
`ipython-notebook`
software.
N
othing needs to be done, as the extension is shipped with the
`ipython-notebook`
software.
## Manual
the whole directoy
*/
renderjs_nbextension/renderjs_nbextension*
needs to be installed
The whole directoy
*
renderjs_nbextension/renderjs_nbextension*
needs to be installed
and enabled as jupyter nbextension. Either use
`$ jupyter nbextension [install/enable]`
, for instance
```
...
...
@@ -32,7 +31,7 @@ $ jupyter nbextension enable renderjs_nbextension/main --user
```
or copy/symlink manually to the appropriate jupyter directories.
Further, copy the file
*
/
renderjs_ipyextension/renderjs_ipyextension/renderjs_extension.py*
into the
Further, copy the file
*renderjs_ipyextension/renderjs_ipyextension/renderjs_extension.py*
into the
ipython directory (usually
*~/.ipython*
for local install). Note, that the file must be placed directly
into the ipython directory and cannot be contained in a directory.
...
...
@@ -59,12 +58,12 @@ The rest of the functionality is the same from bother Kernels.
## Initialize the extension:
```
python
rjs
.
init
_renderjs
()
rjs
.
init
RenderJS
()
```
## Load a renderjs gadget:
```
python
rjs
.
load
_g
adget
(
"my_gadget_reference"
,
"https://my.gadget.url/gadget.html"
)
rjs
.
load
G
adget
(
"my_gadget_reference"
,
"https://my.gadget.url/gadget.html"
)
```
Note, that you need to assign a unique reference for each gadget. This reference
...
...
@@ -72,7 +71,7 @@ is used when calling declared methods and destroying the gadget.
## Destroy a renderjs gadget:
```
python
rjs
.
destroy
(
"my_gadget_reference"
)
rjs
.
destroy
Gadget
(
"my_gadget_reference"
)
```
## Call a declared_method of a loaded gadget:
...
...
@@ -81,7 +80,7 @@ arg1 = "Hello"
arg2
=
'World'
arg3
=
2017
arg4
=
{
"yes"
:
"no!"
}
rjs
.
call
_declared_m
ethod
(
"my_gadget_reference"
,
"method_name"
,
arg1
,
arg2
,
arg3
,
arg4
)
rjs
.
call
DeclaredM
ethod
(
"my_gadget_reference"
,
"method_name"
,
arg1
,
arg2
,
arg3
,
arg4
)
```
The number of arguments can is arbitrary as long as it is python-compatible.
They get converted to js-arguments via pythons
`json.dumps`
. Keep that in mind
...
...
@@ -89,7 +88,7 @@ when passing more complex arguments.
# Development Notes
The extension is split into a ipython extension and a nbextension für jupyter. This is necessary because both
The extension is split into a
n
ipython extension and a nbextension für jupyter. This is necessary because both
JS in the frontend and python in the backend (client-Kernel/ERP5-backend) are required to
use renderjs gadgets.
...
...
@@ -107,14 +106,14 @@ is in place to respond with `text/html` which contains the inline-javascript cod
## nbextension (Frontend)
Nothing happens on-load of the frontend part. Everything is controlled by the backend
(mostly via events fired from
the
ipython). Exception to event-based communication is the initial and controller gadget (loading_gadget)
(mostly via events fired from ipython). Exception to event-based communication is the initial and controller gadget (loading_gadget)
which is injected into the page directly and which is initialized by a manual bootstrap of renderjs (since the page is
already loaded; normal bootstrapping happens on-load).
The loading_gadget is responsible for loading other
(actual) gadgets and pass information from the backend to them.
The loading_gadget declares a renderjs service for each possible event which could be fired from the backend
(such as call
_declared_method, destroy_g
adget, ...).
(such as call
DeclaredMethod, destroyG
adget, ...).
Multiple gadgets are possible but all are controlled by the same loading_gadget. To differentiate between gadgets
each gadget gets assigned a unique reference
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment