[PyQt] Trying to learn ...

Hans-Peter Jansen hpj at urpla.net
Wed Aug 3 09:38:24 BST 2011


Dear BigAl,

On Wednesday 03 August 2011, 01:27:55 Algis Kabaila wrote:
>
> Hi, Pete!
>
> Looking at testui.py it seems to me that it should/would work without
> the decorator @pyqtSlot().  This suggests two questions:
>
> 1. What is the advantage, if any, to use the decorator in this case?

In short: none. I opted to mangle Magnus' file in a minimum invasive 
fashion, and @pyqtSlot was one weapon in his quest to get the thing 
behave... 

IMHO, after getting used to it, it's usefulness is two fold: it nicely 
documents the slots in your classes, and helps to disambiguate/fix 
those cases, were it is needed. E.g. there are some not so obvious 
cases in esoteric usage pattern of webkit with javascript/PyQt 
interaction:

http://www.riverbankcomputing.com/pipermail/pyqt/2010-November/028600.html

> 2. Where could one look up the code for this decorator?

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/new_style_signals_slots.html#the-pyqtslot-decorator

> Thanks for your forever careful care of "simple" questions - there is
> nothing simple when one does not know how to get it working!  Good
> work!
>
> OldAl.

I dimly remember my own PyQt quest ten years ago. ;-)

BTW, I talked to someone lately, who was involved in a web based ERP 
system in about the same time span. Finally, they've given up, since 
they failed to cope with the need to redesign/rewrite the whole thing 
for the third time (in order to deal with the 
html/java/javascript/browser evolution).. I cannot qualify their 
development process, but I imagine, that sustainability of PyQt code is 
a couple of magnitudes above that level, even if factoring in sip v2 to 
v4, (Py)Qt v3 to v4 and python v2 to v3 advancements from that time.

Pete


More information about the PyQt mailing list