##// END OF EJS Templates
Added support for ANSI erase codes. Clearing the console via ANSI escape sequences is now supported.
Added support for ANSI erase codes. Clearing the console via ANSI escape sequences is now supported.

File last commit:

r2783:3c79c2e7
r2783:3c79c2e7
Show More
demo.py
63 lines | 2.0 KiB | text/x-python | PythonLexer
epatters
* Implemented "smart paste" for ConsoleWidget. Continuation prompts are now inserted automatically on paste....
r2763 """ A demo of the Qt console-style IPython frontend.
epatters
* The SVG payload matplotlib backend now works....
r2758 """
# Systemm library imports
from PyQt4 import QtCore, QtGui
# Local imports
from IPython.external.argparse import ArgumentParser
from IPython.frontend.qt.kernelmanager import QtKernelManager
def main():
""" Entry point for demo.
"""
# Parse command line arguments.
parser = ArgumentParser()
epatters
* Restored functionality after major merge....
r2778 group = parser.add_mutually_exclusive_group()
group.add_argument('--pure', action='store_true', help = \
'use a pure Python kernel instead of an IPython kernel')
group.add_argument('--pylab', action='store_true',
help='use a kernel with PyLab enabled')
epatters
* The SVG payload matplotlib backend now works....
r2758 parser.add_argument('--rich', action='store_true',
epatters
* Restored functionality after major merge....
r2778 help='use a rich text frontend')
epatters
* The SVG payload matplotlib backend now works....
r2758 namespace = parser.parse_args()
# Don't let Qt or ZMQ swallow KeyboardInterupts.
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
# Create a KernelManager and start a kernel.
kernel_manager = QtKernelManager()
epatters
* Restored functionality after major merge....
r2778 if namespace.pure:
kernel_manager.start_kernel(ipython=False)
elif namespace.pylab:
epatters
* The SVG payload matplotlib backend now works....
r2758 if namespace.rich:
kernel_manager.start_kernel(pylab='payload-svg')
else:
kernel_manager.start_kernel(pylab='qt4')
else:
kernel_manager.start_kernel()
kernel_manager.start_channels()
# Launch the application.
app = QtGui.QApplication([])
epatters
* Restored functionality after major merge....
r2778 if namespace.pure:
from frontend_widget import FrontendWidget
kind = 'rich' if namespace.rich else 'plain'
widget = FrontendWidget(kind=kind)
epatters
* The SVG payload matplotlib backend now works....
r2758 else:
epatters
* Restored functionality after major merge....
r2778 if namespace.rich:
from rich_ipython_widget import RichIPythonWidget
widget = RichIPythonWidget()
else:
from ipython_widget import IPythonWidget
widget = IPythonWidget()
epatters
* The SVG payload matplotlib backend now works....
r2758 widget.kernel_manager = kernel_manager
epatters
Added support for ANSI erase codes. Clearing the console via ANSI escape sequences is now supported.
r2783 widget.setWindowTitle('Python' if namespace.pure else 'IPython')
epatters
* The SVG payload matplotlib backend now works....
r2758 widget.show()
app.exec_()
if __name__ == '__main__':
main()