See also: http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt
if args['pyside']:
from PySide import QtCore, QtGui
if args['pyside']:
from PySide import QtCore, QtGui
- qt_signal = QtCore.Signal
+ # Use version 2 API in all cases, because that's what PySide uses.
+ import sip
+ sip.setapi('QVariant', 2)
+ sip.setapi('QDate', 2)
+ sip.setapi('QDateTime', 2)
+ sip.setapi('QString', 2)
+ sip.setapi('QTextStream', 2)
+ sip.setapi('QTime', 2)
+ sip.setapi('QUrl', 2)
+ sip.setapi('QVariant', 2)
+
from PyQt4 import QtCore, QtGui
from PyQt4 import QtCore, QtGui
- qt_signal = QtCore.pyqtSignal
+
+ # Add PySide compatible names.
+ QtCore.Signal = QtCore.pyqtSignal
+ QtCore.Slot = QtCore.pyqtSlot
except:
sys.stderr.write('import of PyQt4 failed, using PySide\n')
from PySide import QtCore, QtGui
except:
sys.stderr.write('import of PyQt4 failed, using PySide\n')
from PySide import QtCore, QtGui
- qt_signal = QtCore.Signal
class SamplingThread(QtCore.QObject):
'''A class that handles the reception of sigrok packets in the background.'''
class SamplingThread(QtCore.QObject):
'''A class that handles the reception of sigrok packets in the background.'''
'''Helper class that does the actual work in another thread.'''
'''Signal emitted when new data arrived.'''
'''Helper class that does the actual work in another thread.'''
'''Signal emitted when new data arrived.'''
- measured = qt_signal(object)
+ measured = QtCore.Signal(object, object)
'''Signal emmited in case of an error.'''
'''Signal emmited in case of an error.'''
+ error = QtCore.Signal(str)
def __init__(self, drivers, loglevel):
super(self.__class__, self).__init__()
def __init__(self, drivers, loglevel):
super(self.__class__, self).__init__()
self.thread().msleep(100)
# signal used to start the worker across threads
self.thread().msleep(100)
# signal used to start the worker across threads
- _start_signal = qt_signal()
+ _start_signal = QtCore.Signal()
def __init__(self, drivers, loglevel):
super(self.__class__, self).__init__()
def __init__(self, drivers, loglevel):
super(self.__class__, self).__init__()