root/trunk/libffado/support/mixer-qt4/ffado/import_pyqt.py

Revision 2696, 1.7 kB (checked in by jwoithe, 7 years ago)

import_pyqt.py: make licence format consistent with the rest of FFADO.

Line 
1 #
2 # Copyright (C) 2017 by Jonathan Woithe
3 #
4 # This file is part of FFADO
5 # FFADO = Free Firewire (pro-)audio drivers for linux
6 #
7 # FFADO is based upon FreeBoB.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 #
22
23 ffado_pyqt_version = 4
24
25 # This module handles the importing of PyQt modules for both PyQt4 and PyQt5.
26 # The idea is to first try importing PyQt4.  If there's an import error it's
27 # assumed PyQt5 is present instead and that is tried.
28 #
29 # All modules used by any part of ffado-mixer are imported.  This greatly
30 # simplifies the process.  Otherwise the modules to import would be delivered
31 # by string variables, and there isn't a supported way to do this across
32 # Python2 and Python3.
33 try:
34     from PyQt4 import QtGui, QtCore, Qt, uic
35     from PyQt4.QtCore import QByteArray, QObject, QTimer, Qt, pyqtSignal, QString, pyqtSlot
36     from PyQt4.QtGui import *
37     ffado_pyqt_version = 4
38 except ImportError:
39     from PyQt5 import QtGui, Qt, QtCore, Qt, QtWidgets, uic
40     from PyQt5.QtCore import QByteArray, QObject, pyqtSignal, pyqtSlot, QTimer, Qt
41     from PyQt5.QtGui import *
42     from PyQt5.QtWidgets import *
43     ffado_pyqt_version = 5
44
45 import sys
46 ffado_python3 = sys.version_info >= (3,)
Note: See TracBrowser for help on using the browser.