57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
--- support/mixer-qt4/ffado/import_pyqt.py 2017-06-03 10:34:29.000000000 +0200
|
|
+++ support/mixer-qt4/ffado/import_pyqt.py 2018-03-06 17:19:15.024087729 +0100
|
|
@@ -20,27 +20,37 @@
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
+import sys
|
|
+ffado_python3 = sys.version_info >= (3,)
|
|
ffado_pyqt_version = 4
|
|
|
|
-# This module handles the importing of PyQt modules for both PyQt4 and PyQt5.
|
|
-# The idea is to first try importing PyQt4. If there's an import error it's
|
|
+# This module handles the importing of PyQt modules for both PyQt4 and PyQt5 on
|
|
+# python2 or python3.
|
|
+# Using python2 the first try is to import PyQt4. If there's an import error it's
|
|
# assumed PyQt5 is present instead and that is tried.
|
|
+# Using python3 PyQt5 is assumed (PyQt4 is missing the old APIs and can
|
|
+# therefore not be used).
|
|
#
|
|
# All modules used by any part of ffado-mixer are imported. This greatly
|
|
# simplifies the process. Otherwise the modules to import would be delivered
|
|
# by string variables, and there isn't a supported way to do this across
|
|
# Python2 and Python3.
|
|
-try:
|
|
- from PyQt4 import QtGui, QtCore, Qt, uic
|
|
- from PyQt4.QtCore import QByteArray, QObject, QTimer, Qt, pyqtSignal, QString, pyqtSlot
|
|
- from PyQt4.QtGui import *
|
|
- ffado_pyqt_version = 4
|
|
-except ImportError:
|
|
- from PyQt5 import QtGui, Qt, QtCore, Qt, QtWidgets, uic
|
|
- from PyQt5.QtCore import QByteArray, QObject, pyqtSignal, pyqtSlot, QTimer, Qt
|
|
- from PyQt5.QtGui import *
|
|
- from PyQt5.QtWidgets import *
|
|
- ffado_pyqt_version = 5
|
|
+if ffado_python3:
|
|
+ from PyQt5 import QtGui, Qt, QtCore, Qt, QtWidgets, uic
|
|
+ from PyQt5.QtCore import QByteArray, QObject, pyqtSignal, pyqtSlot, QTimer, Qt
|
|
+ from PyQt5.QtGui import *
|
|
+ from PyQt5.QtWidgets import *
|
|
+ ffado_pyqt_version = 5
|
|
+else:
|
|
+ try:
|
|
+ from PyQt4 import QtGui, QtCore, Qt, uic
|
|
+ from PyQt4.QtCore import QByteArray, QObject, QTimer, Qt, pyqtSignal, QString, pyqtSlot
|
|
+ from PyQt4.QtGui import *
|
|
+ ffado_pyqt_version = 4
|
|
+ except ImportError:
|
|
+ from PyQt5 import QtGui, Qt, QtCore, Qt, QtWidgets, uic
|
|
+ from PyQt5.QtCore import QByteArray, QObject, pyqtSignal, pyqtSlot, QTimer, Qt
|
|
+ from PyQt5.QtGui import *
|
|
+ from PyQt5.QtWidgets import *
|
|
+ ffado_pyqt_version = 5
|
|
|
|
-import sys
|
|
-ffado_python3 = sys.version_info >= (3,)
|
|
|