##// END OF EJS Templates
Added heartbeat support.
Added heartbeat support.

File last commit:

r2910:e4350871
r2910:e4350871
Show More
ipythonqt.py
102 lines | 4.1 KiB | text/x-python | PythonLexer
epatters
Created a proper IPython script from the console frontend demo.
r2801 #!/usr/bin/env python
""" A minimal application using the Qt console-style IPython frontend.
epatters
* The SVG payload matplotlib backend now works....
r2758 """
# Systemm library imports
Brian Granger
Merge branch 'newkernel' into upstream-newkernel...
r2873 from PyQt4 import QtGui
epatters
* The SVG payload matplotlib backend now works....
r2758
# Local imports
from IPython.external.argparse import ArgumentParser
epatters
Created a proper IPython script from the console frontend demo.
r2801 from IPython.frontend.qt.console.frontend_widget import FrontendWidget
from IPython.frontend.qt.console.ipython_widget import IPythonWidget
from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
epatters
* The SVG payload matplotlib backend now works....
r2758 from IPython.frontend.qt.kernelmanager import QtKernelManager
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 # Constants
LOCALHOST = '127.0.0.1'
epatters
* The SVG payload matplotlib backend now works....
r2758
def main():
epatters
Created a proper IPython script from the console frontend demo.
r2801 """ Entry point for application.
epatters
* The SVG payload matplotlib backend now works....
r2758 """
# Parse command line arguments.
parser = ArgumentParser()
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 kgroup = parser.add_argument_group('kernel options')
kgroup.add_argument('-e', '--existing', action='store_true',
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 help='connect to an existing kernel')
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 kgroup.add_argument('--ip', type=str, default=LOCALHOST,
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 help='set the kernel\'s IP address [default localhost]')
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 kgroup.add_argument('--xreq', type=int, metavar='PORT', default=0,
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 help='set the XREQ channel port [default random]')
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 kgroup.add_argument('--sub', type=int, metavar='PORT', default=0,
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 help='set the SUB channel port [default random]')
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 kgroup.add_argument('--rep', type=int, metavar='PORT', default=0,
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 help='set the REP channel port [default random]')
Brian Granger
Added heartbeat support.
r2910 kgroup.add_argument('--hb', type=int, metavar='PORT', default=0,
help='set the heartbeat port [default: random]')
epatters
* Fixed regression from last commit: syntax highlighting works robustly again....
r2866
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 egroup = kgroup.add_mutually_exclusive_group()
egroup.add_argument('--pure', action='store_true', help = \
'use a pure Python kernel instead of an IPython kernel')
Brian Granger
Merge branch 'newkernel' into upstream-newkernel...
r2873 egroup.add_argument('--pylab', type=str, metavar='GUI', nargs='?',
Brian Granger
GUI support for wx, qt and tk.
r2872 const='auto', help = \
epatters
* Added support for Ctrl-L per Fernando's request....
r2880 "Pre-load matplotlib and numpy for interactive use. If GUI is not \
given, the GUI backend is matplotlib's, otherwise use one of: \
['tk', 'gtk', 'qt', 'wx', 'payload-svg'].")
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871
wgroup = parser.add_argument_group('widget options')
wgroup.add_argument('--paging', type=str, default='inside',
choices = ['inside', 'hsplit', 'vsplit', 'none'],
help='set the paging style [default inside]')
wgroup.add_argument('--rich', action='store_true',
help='enable rich text support')
wgroup.add_argument('--tab-simple', action='store_true',
help='do tab completion ala a Unix terminal')
Brian Granger
Merge branch 'newkernel' into upstream-newkernel...
r2873
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 args = parser.parse_args()
Brian Granger
Merge branch 'newkernel' into upstream-newkernel...
r2873
epatters
* The SVG payload matplotlib backend now works....
r2758 # Don't let Qt or ZMQ swallow KeyboardInterupts.
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
# Create a KernelManager and start a kernel.
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 kernel_manager = QtKernelManager(xreq_address=(args.ip, args.xreq),
sub_address=(args.ip, args.sub),
Brian Granger
Added heartbeat support.
r2910 rep_address=(args.ip, args.rep),
hb_address=(args.ip, args.hb))
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 if args.ip == LOCALHOST and not args.existing:
if args.pure:
kernel_manager.start_kernel(ipython=False)
elif args.pylab:
if args.rich:
kernel_manager.start_kernel(pylab='payload-svg')
else:
Brian Granger
GUI support for wx, qt and tk.
r2872 if args.pylab == 'auto':
kernel_manager.start_kernel(pylab='qt4')
else:
kernel_manager.start_kernel(pylab=args.pylab)
epatters
* The SVG payload matplotlib backend now works....
r2758 else:
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 kernel_manager.start_kernel()
epatters
* The SVG payload matplotlib backend now works....
r2758 kernel_manager.start_channels()
epatters
* Tab completion now uses the correct cursor position....
r2841 # Create the widget.
epatters
* The SVG payload matplotlib backend now works....
r2758 app = QtGui.QApplication([])
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 if args.pure:
kind = 'rich' if args.rich else 'plain'
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 widget = FrontendWidget(kind=kind, paging=args.paging)
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 elif args.rich:
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 widget = RichIPythonWidget(paging=args.paging)
epatters
* The SVG payload matplotlib backend now works....
r2758 else:
epatters
Added option to ipythonqt.py for setting the paging style and grouped the options into kernel settings/widget settings.
r2871 widget = IPythonWidget(paging=args.paging)
epatters
* Fixed regression from last commit: syntax highlighting works robustly again....
r2866 widget.gui_completion = not args.tab_simple
epatters
* The SVG payload matplotlib backend now works....
r2758 widget.kernel_manager = kernel_manager
epatters
Added arguments to the Qt console frontend script for connecting to an existing kernel and for specifying an IP and specific ports.
r2823 widget.setWindowTitle('Python' if args.pure else 'IPython')
epatters
* The SVG payload matplotlib backend now works....
r2758 widget.show()
epatters
* Tab completion now uses the correct cursor position....
r2841
# Start the application main loop.
epatters
* The SVG payload matplotlib backend now works....
r2758 app.exec_()
if __name__ == '__main__':
main()