source: sasview/src/sas/qtgui/IPythonWidget.py @ 7d077d1

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 7d077d1 was ff49d4d, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 8 years ago

Added unit test for the new docked widget

  • Property mode set to 100755
File size: 952 bytes
RevLine 
[1af348e]1from qtconsole.rich_jupyter_widget import RichJupyterWidget
2from qtconsole.inprocess import QtInProcessKernelManager
3from IPython.lib import guisupport
4
5MODULES_TO_IMPORT = [
6    ('sas', 'sas'),
7    ('sasmodels', 'sasmodels'),
8    ('numpy', 'np')]
9
10class IPythonWidget(RichJupyterWidget):
11    def __init__(self, parent=None, **kwargs):
12        super(self.__class__, self).__init__(parent)
13        app = guisupport.get_app_qt4()
14
15       # Create an in-process kernel
16        kernel_manager = QtInProcessKernelManager()
17        kernel_manager.start_kernel()
18        kernel = kernel_manager.kernel
19        kernel.gui = 'qt4'
20
21        kernel_client = kernel_manager.client()
22        kernel_client.start_channels()
23
24        self.kernel_manager = kernel_manager
25        self.kernel_client = kernel_client
26
27        self.kernel_manager.kernel.shell.run_code(
28            '\n'.join('import %s as %s' % t for t in MODULES_TO_IMPORT))
Note: See TracBrowser for help on using the repository browser.