diff options
Diffstat (limited to 'contrib/python/ipython/py2/IPython/terminal')
| -rw-r--r-- | contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/qt.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/qt.py b/contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/qt.py index 74c8c153cdb..7395ac39ebe 100644 --- a/contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/qt.py +++ b/contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/qt.py @@ -1,29 +1,29 @@ import sys -import os +import os from IPython.external.qt_for_kernel import QtCore, QtGui # If we create a QApplication, keep a reference to it so that it doesn't get # garbage collected. _appref = None -_already_warned = False +_already_warned = False def inputhook(context): global _appref app = QtCore.QCoreApplication.instance() if not app: - if sys.platform == 'linux': - if not os.environ.get('DISPLAY') \ - and not os.environ.get('WAYLAND_DISPLAY'): - import warnings - global _already_warned - if not _already_warned: - _already_warned = True - warnings.warn( - 'The DISPLAY or WAYLAND_DISPLAY enviroment variable is ' - 'not set or empty and Qt5 requires this enviroment ' - 'variable. Deactivate Qt5 code.' - ) - return + if sys.platform == 'linux': + if not os.environ.get('DISPLAY') \ + and not os.environ.get('WAYLAND_DISPLAY'): + import warnings + global _already_warned + if not _already_warned: + _already_warned = True + warnings.warn( + 'The DISPLAY or WAYLAND_DISPLAY enviroment variable is ' + 'not set or empty and Qt5 requires this enviroment ' + 'variable. Deactivate Qt5 code.' + ) + return _appref = app = QtGui.QApplication([" "]) event_loop = QtCore.QEventLoop(app) |
