[PyQt] pyqtProperty TypeError
Xinkai
yeled.nova at gmail.com
Sat Jul 19 22:30:17 BST 2014
Hello,
I think I found a bug, test program:
============================================================
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, Q_ENUMS
class Foo(QObject):
propertyChanged = pyqtSignal()
class EEEEE:
A = 0
B = 1
C = 2
D = 3
E = 4
Q_ENUMS(EEEEE)
def __init__(self):
super().__init__()
# @pyqtProperty(int)
@pyqtProperty(int, notify = propertyChanged)
def foo(self):
return 1
print("About 3 out of 10 times, ", end = "")
f = Foo()
print("""this program will fail with
'TypeError: an integer is required (got type str)' or
'TypeError: an integer is required (got type getset_descriptor)'
Removing 'notify = ???' fixes the problem
Removing 'Q_ENUM' also fixes the problem.
""")
============================================================
Tested under Archlinux x64 with Python 3.4.1, PyQt 5.3.1.
It looks like pyqtProperty doesn't wait for the extra loading time of
"Q_ENUMS" and "notify", causing TypeError.
Thanks in advance,
Xinkai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140720/b560adf8/attachment.html>
More information about the PyQt
mailing list