8000 Merge pull request #19316 from anntzer/qtx11 · matplotlib/matplotlib@0d44af3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d44af3

Browse files
authored
Merge pull request #19316 from anntzer/qtx11
Simplify X11 checking for Qt.
2 parents 30b5b24 + b13f091 commit 0d44af3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import functools
2-
import importlib
32
import os
43
import signal
54
import sys
@@ -100,18 +99,9 @@ def _create_qApp():
10099
if qApp is None:
101100
app = QtWidgets.QApplication.instance()
102101
if app is None:
103-
# check for DISPLAY env variable on X11 build of Qt
104-
if QtCore.qVersion() >= "5.":
105-
try:
106-
importlib.import_module(
107-
# i.e. PyQt5.QtX11Extras or PySide2.QtX11Extras.
108-
f"{QtWidgets.__package__}.QtX11Extras")
109-
is_x11_build = True
110-
except ImportError:
111-
is_x11_build = False
112-
else:
113-
is_x11_build = hasattr(QtGui, "QX11Info")
114-
if is_x11_build and not mpl._c_internal_utils.display_is_valid():
102+
# display_is_valid returns False only if on Linux and neither X11
103+
# nor Wayland display can be opened.
104+
if not mpl._c_internal_utils.display_is_valid():
115105
raise RuntimeError('Invalid DISPLAY variable')
116106
try:
117107
QtWidgets.QApplication.setAttribute(

0 commit comments

Comments
 (0)
0