On Wed, Nov 24, 2010 at 10:44 AM, Chris Morgan <[email protected]> wrote:
> 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.)
>


Hi Chris,


This solution have already be implemented in the current version of
PySide, but the problem here is:

* In a future version of the QT API you can have a new slot or signal
signature, then you program can stop working without any reason.
* If you more then one signal and slot this logic get a bit
complicated, because you need try all possibilities to connect the
signal -> slot, and which one will have priority?

I think the propose of this PSEP is create a standard to avoid python
program breaks or have different behaviors, when a new signal or slot
was introduced on the API.





-- 
Renato Araujo Oliveira Filho
Instituto Nokia de Tecnologia - INdT
Mobile: +55 (81) 8704-2144
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to