diff options
author | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2019-07-09 10:20:20 +0200 |
---|---|---|
committer | Alexandre Marie <alexandre.marie@synchrotron-soleil.fr> | 2019-07-09 10:20:20 +0200 |
commit | 654a6ac93513c3cc1ef97cacd782ff674c6f4559 (patch) | |
tree | 3b986e4972de7c57fa465820367602fc34bcb0d3 /silx/gui/console.py | |
parent | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (diff) |
New upstream version 0.11.0+dfsg
Diffstat (limited to 'silx/gui/console.py')
-rw-r--r-- | silx/gui/console.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/silx/gui/console.py b/silx/gui/console.py index b6341ef..5dc6336 100644 --- a/silx/gui/console.py +++ b/silx/gui/console.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2004-2018 European Synchrotron Radiation Facility +# Copyright (c) 2004-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -87,17 +87,26 @@ else: msg = "Module " + __name__ + " cannot be used within an IPython shell" raise ImportError(msg) - try: - from qtconsole.rich_ipython_widget import RichJupyterWidget as \ - RichIPythonWidget + from qtconsole.rich_jupyter_widget import RichJupyterWidget as \ + _RichJupyterWidget except ImportError: - from qtconsole.rich_ipython_widget import RichIPythonWidget + try: + from qtconsole.rich_ipython_widget import RichJupyterWidget as \ + _RichJupyterWidget + except ImportError: + from qtconsole.rich_ipython_widget import RichIPythonWidget as \ + _RichJupyterWidget from qtconsole.inprocess import QtInProcessKernelManager +try: + from ipykernel import version_info as _ipykernel_version_info +except ImportError: + _ipykernel_version_info = None + -class IPythonWidget(RichIPythonWidget): +class IPythonWidget(_RichJupyterWidget): """Live IPython console widget. .. image:: img/IPythonWidget.png @@ -115,6 +124,16 @@ class IPythonWidget(RichIPythonWidget): self.setWindowTitle(self.banner) self.kernel_manager = kernel_manager = QtInProcessKernelManager() kernel_manager.start_kernel() + + # Monkey-patch to workaround issue: + # https://github.com/ipython/ipykernel/issues/370 + if (_ipykernel_version_info is not None and + _ipykernel_version_info[0] > 4 and + _ipykernel_version_info[:3] <= (5, 1, 0)): + def _abort_queues(*args, **kwargs): + pass + kernel_manager.kernel._abort_queues = _abort_queues + self.kernel_client = kernel_client = self._kernel_manager.client() kernel_client.start_channels() @@ -178,5 +197,6 @@ def main(): widget.show() app.exec_() + if __name__ == '__main__': main() |