Show More
@@ -19,17 +19,17 b' def inputhook(context):' | |||||
19 | global _appref |
|
19 | global _appref | |
20 | app = QtCore.QCoreApplication.instance() |
|
20 | app = QtCore.QCoreApplication.instance() | |
21 | if not app: |
|
21 | if not app: | |
22 |
if sys.platform == |
|
22 | if sys.platform == 'linux': | |
23 |
if not os.environ.get( |
|
23 | if not os.environ.get('DISPLAY') \ | |
|
24 | and not os.environ.get('WAYLAND_DISPLAY'): | |||
24 | import warnings |
|
25 | import warnings | |
25 |
|
||||
26 | global _already_warned |
|
26 | global _already_warned | |
27 | if not _already_warned: |
|
27 | if not _already_warned: | |
28 | _already_warned = True |
|
28 | _already_warned = True | |
29 | warnings.warn( |
|
29 | warnings.warn( | |
30 |
|
|
30 | 'The DISPLAY or WAYLAND_DISPLAY environment variable is ' | |
31 |
|
|
31 | 'not set or empty and Qt5 requires this environment ' | |
32 |
|
|
32 | 'variable. Deactivate Qt5 code.' | |
33 | ) |
|
33 | ) | |
34 | return |
|
34 | return | |
35 | QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) |
|
35 | QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) | |
@@ -43,7 +43,7 b' def inputhook(context):' | |||||
43 |
|
43 | |||
44 | event_loop = QtCore.QEventLoop(app) |
|
44 | event_loop = QtCore.QEventLoop(app) | |
45 |
|
45 | |||
46 |
if sys.platform == |
|
46 | if sys.platform == 'win32': | |
47 | # The QSocketNotifier method doesn't appear to work on Windows. |
|
47 | # The QSocketNotifier method doesn't appear to work on Windows. | |
48 | # Use polling instead. |
|
48 | # Use polling instead. | |
49 | timer = QtCore.QTimer() |
|
49 | timer = QtCore.QTimer() | |
@@ -55,7 +55,8 b' def inputhook(context):' | |||||
55 | else: |
|
55 | else: | |
56 | # On POSIX platforms, we can use a file descriptor to quit the event |
|
56 | # On POSIX platforms, we can use a file descriptor to quit the event | |
57 | # loop when there is input ready to read. |
|
57 | # loop when there is input ready to read. | |
58 |
notifier = QtCore.QSocketNotifier(context.fileno(), |
|
58 | notifier = QtCore.QSocketNotifier(context.fileno(), | |
|
59 | QtCore.QSocketNotifier.Read) | |||
59 | try: |
|
60 | try: | |
60 | # connect the callback we care about before we turn it on |
|
61 | # connect the callback we care about before we turn it on | |
61 | # lambda is necessary as PyQT inspect the function signature to know |
|
62 | # lambda is necessary as PyQT inspect the function signature to know |
General Comments 0
You need to be logged in to leave comments.
Login now