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

Revision 2803, 2.0 kB (checked in by jwoithe, 3 years ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

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 # This module handles the importing of PyQt modules for both PyQt4 and PyQt5
24 # under Python2 or Python3.  If Python3 is installed it is assumed that
25 # PyQt5 is in use (this is reasonable because PyQt5 is what everyone wants
26 # to use under Python3).  Otherwise (that is, under Python2), an import of
27 # PyQt4 is tried first; if an import error occurs then PyQt5 is assumed.
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
34 import sys
35 ffado_python3 = sys.version_info >= (3,)
36
37 if ffado_python3:
38     ffado_pyqt_version = 5
39 else:
40     try:
41         from PyQt4 import QtGui
42         ffado_pyqt_version = 4
43     except ImportError:
44         ffado_pyqt_version = 5
45
46 if ffado_pyqt_version == 4:
47     from PyQt4 import QtGui, QtCore, Qt, uic
48     from PyQt4.QtCore import QByteArray, QObject, QTimer, Qt, pyqtSignal, QString, pyqtSlot
49     from PyQt4.QtGui import *
50 else:
51     from PyQt5 import QtGui, Qt, QtCore, Qt, QtWidgets, uic
52     from PyQt5.QtCore import QByteArray, QObject, pyqtSignal, pyqtSlot, QTimer, Qt
53     from PyQt5.QtGui import *
54     from PyQt5.QtWidgets import *
Note: See TracBrowser for help on using the browser.