##// END OF EJS Templates
load the per kernel kernel.js and kernel.css...
load the per kernel kernel.js and kernel.css As per discussion, each kernel can provide a file name kernel.js that we try to load at kernel switching. If such a file exist we assume that the kernel pathches the javasscript and that this javascript cannot be unpatched, and further switching of the kernel cannot be undone without reloading the page. (separate PR for UI) if a kernel provide kernel.js, the it should consist into a AMD module definition that uses require.js the module shoudl define a function name `onload` that will be called at the appropriate moment before the kernel starts.

File last commit:

r16113:87737521
r19404:106cf164
Show More
inprocess_qtconsole.py
46 lines | 1.2 KiB | text/x-python | PythonLexer
/ examples / Embedding / inprocess_qtconsole.py
Thomas Kluyver
Improve Python 3 compatibility for example scripts.
r13991 from __future__ import print_function
MinRK
add in-process kernel examples
r10305 import os
Martin Spacek
Fix `frontend` deprecation warnings in several examples
r11360 from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
from IPython.qt.inprocess import QtInProcessKernelManager
MinRK
add in-process kernel examples
r10305 from IPython.lib import guisupport
def print_process_id():
Thomas Kluyver
Improve Python 3 compatibility for example scripts.
r13991 print('Process ID is:', os.getpid())
MinRK
add in-process kernel examples
r10305
def main():
# Print the ID of the main process
print_process_id()
app = guisupport.get_app_qt4()
# Create an in-process kernel
# >>> print_process_id()
# will print the same process ID as the main process
MinRK
fix in process qt and in process examples
r10333 kernel_manager = QtInProcessKernelManager()
MinRK
add in-process kernel examples
r10305 kernel_manager.start_kernel()
kernel = kernel_manager.kernel
kernel.gui = 'qt4'
kernel.shell.push({'foo': 43, 'print_process_id': print_process_id})
MinRK
fix in process qt and in process examples
r10333 kernel_client = kernel_manager.client()
MinRK
add in-process kernel examples
r10305 kernel_client.start_channels()
def stop():
kernel_client.stop_channels()
kernel_manager.shutdown_kernel()
app.exit()
control = RichIPythonWidget()
control.kernel_manager = kernel_manager
control.kernel_client = kernel_client
control.exit_requested.connect(stop)
control.show()
guisupport.start_event_loop_qt4(app)
if __name__ == '__main__':
main()