On Thursday 09 December 2010 17:07:45 Jukka Välimaa wrote:
> Hi Renato,
> 
> Here's a complete example. I run the file containing this, and the only
> message printed is the error I wrote about above; the method is never
> called. If I use int in the test method, everything works fine.
> 
> ---------------------------------------------------------------------------
> ----------- from PySide import QtCore
> from PySide.QtGui import QApplication
> from PySide.QtScript import QScriptEngine, QScriptValue
> 
> app = QApplication([])
> 
> class Test(QtCore.QObject):
>     @QtCore.Slot(list)
>     def test(self, param):
>         print 'test method called, param is', type(param), param
> 
> engine = QScriptEngine()
> test = Test()
> test_qobject = engine.newQObject(test)
> engine.globalObject().setProperty('test', test_qobject)
> 
> val = engine.evaluate("test.test([1, 2, 3])")
> print val.toString()
> ---------------------------------------------------------------------------
> ------------------

It works on C++, so it's definitively a PySide bug, I filed it:

http://bugs.openbossa.org/show_bug.cgi?id=550

Thanks for reporting it.
 
> --Jukka
> 
> 2010/12/9 Renato Araujo Oliveira Filho <[email protected]>
> 
> > Hi Jukka Välimaa,
> > 
> > I created this small example, and this works fine for me.
> > 
> > 
> > -------------------------------------------------------------------------
> > -------------- from PySide.QtCore import QObject, Slot
> > 
> > class Test(QObject):
> >     @Slot(list)
> >    
> >    def test(self, param):
> >        print 'param is', type(param), param
> > 
> > o = Test()
> > o.test([1, 2, 3])
> > 
> > 
> > -------------------------------------------------------------------------
> > --------------
> > 
> > 
> > Can you try reproduce your problem in a complete example. This will be
> > easier to help you, with this problem.
> > 
> > 2010/12/9 Jukka Välimaa <[email protected]>:
> > > Hi all,
> > > I have a question about the use of collection types in slot signatures.
> > > I have a python object of the following kind:
> > > 
> > > class Test(QObject):
> > >     @QtCore.Slot(list)
> > >     
> > >     def test(self, param):
> > >         print 'param is', type(param), param
> > > 
> > > I've set an object of this kind into the script engine context, and try
> > 
> > to
> > 
> > > call it using the following:
> > > val = engine.evaluate("test.test([1, 2, 3])")
> > > The method is not called, and what I get as a result of calling
> > > toString
> > 
> > on
> > 
> > > 'val' is "TypeError: incompatible type of argument(s) in call to
> > > test(); candidates were test(PyObject)".
> > > When the slot signature is string or int, everything works properly. It
> > > seems that the Array type isn't mapped into list or tuple in slot
> > 
> > signature.
> > 
> > > Yet when I call "engine.evaluate('[1, 2, 3]').toVariant()", I get a
> > 
> > python
> > 
> > > list.
> > > What am I doing wrong here? Is there a reference somewhere about how
> > > mappings between various types go?
> > > Regards,
> > > Jukka Välimaa
> > > _______________________________________________
> > > PySide mailing list
> > > [email protected]
> > > http://lists.openbossa.org/listinfo/pyside
> > 
> > --
> > Renato Araujo Oliveira Filho
> > Instituto Nokia de Tecnologia - INdT
> > Mobile: +55 (81) 8704-2144

-- 
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to