def __init__(self): # On init we must check dependencies: if it raises no error, it's used. try: from PyQt4 import QtCore, QtGui except: from PySide import QtCore, QtGui class CallbackEvent(QtCore.QEvent): def __init__(self, cb=None): QtCore.QEvent.__init__(self, QtCore.QEvent.User) self.cb = cb self.CallbackEvent = CallbackEvent class Receiver(QtCore.QObject): def event(self, ev): if type(ev) is CallbackEvent: ev.cb() return True return False self._receiver = Receiver() self.app = pydev_guisupport.get_app_qt4() assert hasattr(self.app, "postEvent") # Check post-conditions
def __init__(self): # On init we must check dependencies: if it raises no error, it's used. try: from PyQt4 import QtCore, QtGui except: from PySide import QtCore, QtGui class CallbackEvent(QtCore.QEvent): def __init__(self, cb=None): QtCore.QEvent.__init__(self, QtCore.QEvent.User) self.cb = cb self.CallbackEvent = CallbackEvent class Receiver(QtCore.QObject): def event(self, ev): if type(ev) is CallbackEvent: ev.cb() return True return False self._receiver = Receiver() self.app = pydev_guisupport.get_app_qt4() assert hasattr(self.app, 'postEvent') # Check post-conditions
def __init__(self): #On init we must check dependencies: if it raises no error, it's used. # try: from PyQt4 import QtCore, QtGui # except: # from PySide import QtCore, QtGui self.ping = type('Ping', (QtCore.QThread,), {'call': QtCore.pyqtSignal(object)})() self.ping.call.connect(lambda cb: cb(), type=QtCore.Qt.BlockingQueuedConnection) self.app = pydev_guisupport.get_app_qt4()
def __init__(self): #On init we must check dependencies: if it raises no error, it's used. # try: from PyQt4 import QtCore, QtGui # except: # from PySide import QtCore, QtGui self.ping = type('Ping', (QtCore.QThread, ), {'call': QtCore.pyqtSignal(object)})() self.ping.call.connect(lambda cb: cb(), type=QtCore.Qt.BlockingQueuedConnection) self.app = pydev_guisupport.get_app_qt4()