]> sigrok.org Git - sigrok-meter.git/blame - qtcompat.py
MultimeterDelegate: Align the units of multiple values.
[sigrok-meter.git] / qtcompat.py
CommitLineData
48723bbb
JS
1##
2## This file is part of the sigrok-meter project.
3##
4## Copyright (C) 2014 Jens Steinhauser <jens.steinhauser@gmail.com>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
20
21def load_modules(force_pyside):
22 if force_pyside:
23 import PySide.QtCore as _QtCore
24 import PySide.QtGui as _QtGui
25 else:
26 try:
27 # Use version 2 API in all cases, because that's what PySide uses.
28 import sip
29 sip.setapi('QVariant', 2)
30 sip.setapi('QDate', 2)
31 sip.setapi('QDateTime', 2)
32 sip.setapi('QString', 2)
33 sip.setapi('QTextStream', 2)
34 sip.setapi('QTime', 2)
35 sip.setapi('QUrl', 2)
36 sip.setapi('QVariant', 2)
37
38 import PyQt4.QtCore as _QtCore
39 import PyQt4.QtGui as _QtGui
40
41 # Add PySide compatible names.
42 _QtCore.Signal = _QtCore.pyqtSignal
43 _QtCore.Slot = _QtCore.pyqtSlot
44 except:
45 sys.stderr.write('import of PyQt4 failed, using PySide\n')
46 import PySide.QtCore as _QtCore
47 import PySide.QtGui as _QtGui
48
49 global QtCore
50 global QtGui
51 QtCore = _QtCore
52 QtGui = _QtGui