[PyQt] pyqtProperty TypeError
Phil Thompson
phil at riverbankcomputing.com
Mon Jul 21 09:40:53 BST 2014
On 19/07/2014 10:30 pm, Xinkai wrote:
> 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.
Should be fixed in tonight's snapshot.
Thanks,
Phil
More information about the PyQt
mailing list