Umm... I thought some time ago about trying to connect Leo to IPython
via its ZeroMQ protocol, instead of starting with the .ipynb format (at
that time it was pretty young). So leo DOM could be composed of nodes
that are connected to and IPython kernel and rendered using
QTWebToolkit. May be this idea could be helpful.
Cheers,
Offray
On 24/03/16 14:48, Edward K. Ream wrote:
On Thursday, March 24, 2016 at 1:19:31 PM UTC-5, john lunzer wrote:
Some random searching around the internet seems to indicate it
should be possible
<https://github.com/jbaayen/ipython-notebook-browser>. Though they
used PySide.
Thanks for this. The following also kinda works, when executed as a
Leo script:
|
fromleo.core.leoQt importQtCore,QtWebKit,QtWebKitWidgets,QtWidgets
fromleo.plugins.free_layout importFreeLayoutController
fromleo.plugins.nested_splitter importNestedSplitter
classJupyterWidget(QtWebKitWidgets.QWebView):
def__init__(self):
QtWebKitWidgets.QWebView.__init__(self)
self.load(QtCore.QUrl(
"http://localhost:8888/notebooks/export-neural-networds.ipynb"))
splitter =c.frame.top.splitter
# The splitter containing the outline & log panes.
splitter.insert(1,w=JupyterWidget())
|
This does show the notebook, provided the Jupyter kernel is running
and can access the .ipynb file). However, the page says "not
connected". Some, but not all, of the page works as expected.
Furthermore, replacing the url above with the "main" url:
|
"http://localhost:8888/tree"
|
again does show the page, but it's not possible to load any of the
visible .ipynb files.
There may be an extremely simple explanation for this. As you can see,
the JupyterWidget class doesn't do anything except load a single url.
It may be (probably is) necessary to connect events...
One more thing. The following code makes the JupyterWidget available
to the Easter Egg interface:
|
classJupyterProvider:
defns_provider_id(self):
return'JupyterProvider'
defns_provides(self):
return[('Jupyter','_jupyter_widget_id')]
defns_provide(self,id_):
ifid_ =='_jupyter_widget_id':
returnJupyterWidget()
splitter.register_provider(JupyterProvider())
|
So clearly, it is possible to embed the widget, and I suspect it will
be straightforward to make it fully functional.
--
You received this message because you are subscribed to the Google
Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.