Show More
@@ -1,15 +1,29 b'' | |||
|
1 | 1 | import sys |
|
2 | import os | |
|
2 | 3 | from IPython.external.qt_for_kernel import QtCore, QtGui |
|
3 | 4 | |
|
4 | 5 | # If we create a QApplication, keep a reference to it so that it doesn't get |
|
5 | 6 | # garbage collected. |
|
6 | 7 | _appref = None |
|
7 | ||
|
8 | _already_warned = False | |
|
8 | 9 | |
|
9 | 10 | def inputhook(context): |
|
10 | 11 | global _appref |
|
11 | 12 | app = QtCore.QCoreApplication.instance() |
|
12 | 13 | if not app: |
|
14 | if sys.platform == 'linux': | |
|
15 | if not os.environ.get('DISPLAY') \ | |
|
16 | and not os.environ.get('WAYLAND_DISPLAY'): | |
|
17 | import warnings | |
|
18 | global _already_warned | |
|
19 | if not _already_warned: | |
|
20 | _already_warned = True | |
|
21 | warnings.warn( | |
|
22 | 'The DISPLAY or WAYLAND_DISPLAY enviroment variable is ' | |
|
23 | 'not set or empty and Qt5 requires this enviroment ' | |
|
24 | 'variable. Deactivate Qt5 code.' | |
|
25 | ) | |
|
26 | return | |
|
13 | 27 | _appref = app = QtGui.QApplication([" "]) |
|
14 | 28 | event_loop = QtCore.QEventLoop(app) |
|
15 | 29 |
General Comments 0
You need to be logged in to leave comments.
Login now