Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Show proper error message for PyQt6 not found

Freya Lupenff9f95146413
diff --git a/plugins/extensions/pykrita/plugin/krita/__init__.py b/plugins/extensions/pykrita/plugin/krita/__init__.py
index 9ce40f2cd2..a51202f1a5 100644
--- a/plugins/extensions/pykrita/plugin/krita/__init__.py
+++ b/plugins/extensions/pykrita/plugin/krita/__init__.py
@@ -22,14 +22,14 @@ if (spec := importlib.util.find_spec(pyqt_wrong)):
# Look for PyQt
try:
- from PyQt6 import QtCore
-except ImportError:
- try:
+ if pykrita.qt_major_version() == 5:
from PyQt5 import QtCore
- except ImportError:
- print("Python cannot find the Qt5 bindings.", file=sys.stderr)
- print("Please make sure, that the needed packages are installed.", file=sys.stderr)
- raise
+ else:
+ from PyQt6 import QtCore
+except ImportError:
+ print("Python cannot find the Qt%d bindings." % pykrita.qt_major_version(), file=sys.stderr)
+ print("Please make sure that the needed packages are installed.", file=sys.stderr)
+ raise
from .api import *
from .decorators import *