Initia QtCore port to python3.

This commit is contained in:
Renato Filho 2011-10-03 18:49:42 -03:00 • committed by Hugo Parente Lima
commit 1e29ab6592
52 changed files with 380 additions and 286 deletions

View file

@ -4,9 +4,16 @@
import unittest
import types
from PySide.QtCore import QObject, QEvent
import sys
from PySide.QtCore import QObject
from helper import UsesQCoreApplication
def MethodType(func, instance, instanceType):
if sys.version_info[0] == 3:
return types.MethodType(func, instance)
else:
return types.MethodType(func, instance, instanceType)
class Duck(QObject):
def __init__(self):
QObject.__init__(self)
@ -32,7 +39,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
parent = QObject()
def childEvent(obj, event):
self.duck_childEvent_called = True
parent.childEvent = types.MethodType(childEvent, parent, QObject)
parent.childEvent = MethodType(childEvent, parent, QObject)
child = QObject()
child.setParent(parent)
self.assert_(self.duck_childEvent_called)
@ -51,7 +58,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
self.duck_childEvent_called = True
child = QObject()
child.setParent(parent)
parent.childEvent = types.MethodType(childEvent, parent, QObject)
parent.childEvent = MethodType(childEvent, parent, QObject)
child = QObject()
child.setParent(parent)
self.assert_(self.duck_childEvent_called)