Matt,

 If the target function has been decorated with QtCore.Slot, specifying
>> the signature/s it wants, I also think it would be nice if
>> signal.activated.connect(target) would use that/those rather than
>> raising an error.
>>
>
> I'd like to hear the opinion of the core dev team members here - is this
> feasible to implement?
>

It's easy to implement - here's a proof-of-concept in Python code that would
do it, using the way func._slots is a list of 'void func(type)',
'void<lambda>(type)', 'void func(type,type2,type3)' strings.

class Signal:
    def __getitem__(self, item):
        pass # that's already sorted out, it returns some object with a
connect method

    def connect(self, func):
        if hasattr(func, '_slots'):  # decorated with Slot
            for signature in func._slots:
                self[signature.split('(')[1][:-1]].connect(func)
        else: pass # raise exception, guess no arguments or whatever.

(Note this skips checking if the slot's signatures are valid for the signal;
I couldn't find how a signal lists the signatures it supports.)

This is just a proof of concept, but I think it should show that it's not
really a problem implementing it.  signal.connect and signal[...].connect
can be completely different.


-- Chris Morgan


(I hope I'm not being a pest?  I don't think I have anything else to say on
this point, anyway.  But I do like to try and get PySide as Pythonic as
possible and am very happy with the way it's progressing.)
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to