SHARE
TWEET

Untitled

snegovikufa Aug 17th, 2011 122 Never
  1. # -*- coding:utf-8 -*-
  2. import sip
  3. sip.setapi('QString', 2)
  4. from IPython.external.qt import QtCore, QtGui
  5. from IPython.frontend.qt.console.qtconsoleapp import MainWindow, IPythonQtConsoleApp
  6. from IPython.frontend.qt.console.ipython_widget import IPythonWidget
  7. from IPython.utils.localinterfaces import LOCAL_IPS
  8.  
  9. class IPythonApp (IPythonQtConsoleApp):
  10.     def init_qt_elements(self):
  11.         # Create the widget.
  12.         self.app = QtGui.QApplication ([])
  13.         local_kernel = (not self.existing) or self.ip in LOCAL_IPS
  14.         self.widget = self.widget_factory(config=self.config,
  15.                                         local_kernel=local_kernel)
  16.         self.widget.kernel_manager = self.kernel_manager
  17.         self.window = MainWindow(self.app, self.widget, self.existing,
  18.                                 may_close=local_kernel,
  19.                                 confirm_exit=self.confirm_exit)
  20.         self.window.setWindowTitle('Python' if self.pure else 'IPython')
  21.  
  22.        
  23. def test ():
  24.     app = IPythonApp ()
  25.     app.initialize()
  26.     app.start()
  27.  
  28. if __name__ == "__main__" :
  29.     test()
RAW Paste Data
Top