Thanks Renato,
I converted to new style and now it works:
I added:
rpc_response = Signal(str)
to the emitter class (outside init)
and I emit the signal this way:
self.rpc_response.emit(unicode(resp))
as you can see I force unicode to match the str signal argument,
on the receiver:
self.xmlcalls.rpc_response.connect(self.onXmlResponse)
and
@Slot(str)
def onXmlResponse(self,resp):
print 'xmlresponse'
print type(resp)
print resp
v=eval(resp)
print type(v)
print v
so with this hack I can pass any python object converting to string and
using eval when I receive the argument
in my use case "resp" can be any python object, I get it calling an
xmlrpc server that can respond with dict,list,bool ecc.., is there a
native way to pass a generic python object when emitting a signal?
thanks
Nicola
Il giorno sab, 25/09/2010 alle 11.53 -0300, Renato Araujo Oliveira Filho
ha scritto:
> Hi Nicola,
>
>
> to connect signals in the old way on PySide you need use the full
> signature on SIGNAL('function_name(arguments_types)') call. Try
> replace your code with something like that
>
> << self.connect(self.xmlcalls, SIGNAL('rpc_response'),self.onXmlResponse)
> >> self.connect(self.xmlcalls, SIGNAL('rpc_response(object)'),
> >> self.onXmlResponse)
>
> There is a bug reported about this problem in:
> http://bugs.openbossa.org/show_bug.cgi?id=314.
> We did not decide yet, if this feature will be implemented or not
> because this is a deprecated API, then the best solution is update
> your code to use the new API, if you have problems with the new API
> you can use the ml or pyside irc channel to ask about that.
>
> Thanks
>
>
> On Sat, Sep 25, 2010 at 5:08 AM, Mailing List SVR
> <[email protected]> wrote:
> > Hi,
> >
> > I'm experiencing some problems passing arguments when emitting signals
> > in pyside,
> >
> > code such this:
> >
> > self.xmlcalls=XmlCalls(parent=self)
> > self.connect(self.xmlcalls, SIGNAL('rpc_response'),self.onXmlResponse)
> >
> > def onXmlResponse(self,resp):
> > print 'xmlresponse'
> > print resp
> >
> > and then in the XmlCalls:
> >
> > self.emit(SIGNAL('rpc_response'),resp)
> >
> > works fine in PyQt, but in PySide I have the following error:
> >
> > Error calling slot "onXmlResponse"
> > TypeError: onXmlResponse() takes exactly 2 arguments (1 given)
> >
> > I tryed to follow this guide
> >
> > http://www.pyside.org/docs/pyside/newsigslot.html
> >
> > with no success is this updated?
> >
> > any help would be appreciated,
> >
> > thanks
> > Nicola
> >
> > _______________________________________________
> > PySide mailing list
> > [email protected]
> > http://lists.openbossa.org/listinfo/pyside
> >
>
>
>
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside