Ok so I've stopped trying to do the weird and wacky custom hand
written Python C Extension and gone for the pure Shiboken generated
module, as you guys suggested, which is much much nicer indeed.
However I'm still seeing the same crash, although I think I might have
narrowed it down further. It looks like it's failing when trying to
produce a python wrapper for a C++ QWidget which is actually a C++
subclass of QWidget i.e: My module works fine and produces the correct
results for pointers to 'raw' QWidget / QMenu / QCheckBox etc
instances.

So, I have a small repeatable test case, however its currently
dependent on Maya 2012. I don't suppose you guys would have access to
a copy to test my example on?

Thanks a million again for the help!

Cheers,
Daniel

On Jun 21, 10:37 am, kungfuelmosan <kungfuelmo...@gmail.com> wrote:
> Hey Renato,
>
> Derived class? I'm not creating any new python types or anything I'm
> literally just trying to take a C++ pointer to an existing QWidget and
> return a PySide PyObject wrapper for that widget, to a python
> instance :
>
> PyObject * py_findControl_(PyObject *self, PyObject *args) {
>
>     // Parse Args
>     char *controlName;
>     PyObject *py_ancestor = NULL;
>     if (!PyArg_ParseTuple(args, "s|O", &controlName, &py_ancestor))
>         return NULL;
>
>     QWidget *ancestor = NULL;
>     if (py_ancestor != NULL)
>         ancestor = Shiboken::Converter<QWidget*>::toCpp(py_ancestor);
>
>     // Find the named QWidget in maya
>     QWidget *control = MQtUtil::findControl(MString(controlName),
> ancestor);
>
>     // Get PySide wrapper
>     PyObject *wrapper =
> Shiboken::Converter<QWidget*>::toPython(control);
>
>     return wrapper;
>
> }
>
> I'll try and get a small repeatable test case together today.
>
> On Jun 18, 12:37 am, Renato Araujo Oliveira Filho
>
>
>
>
>
>
>
> <renato.fi...@openbossa.org> wrote:
> > Did you check if you are calling the base constructor on your derived class?
>
> > On Thu, Jun 16, 2011 at 9:02 PM, kungfuelmosan <kungfuelmo...@gmail.com> 
> > wrote:
> > > Yep, It should already be initialized by Maya on startup.
>
> > > On Jun 17, 8:47 am, Hugo Parente Lima <hugo.l...@openbossa.org> wrote:
> > >> On Thursday 16 June 2011 17:31:13 kungfuelmosan wrote:
>
> > >> > Hey Hugo,
>
> > >> > Yep I'm calling :
>
> > >> >     if (!Shiboken::importModule("PySide.QtCore",
> > >> > &SbkPySide_QtCoreTypes)) {
> > >> >         PyErr_SetString(PyExc_ImportError,"could not import
> > >> > PySide.QtCore");
> > >> >         return;
> > >> >     }
>
> > >> >     if (!Shiboken::importModule("PySide.QtGui",
> > >> > &SbkPySide_QtGuiTypes)) {
> > >> >         PyErr_SetString(PyExc_ImportError,"could not import
> > >> > PySide.QtGui");
> > >> >         return;
> > >> >     }
>
> > >> > In my extension modules init function and I have these globally
> > >> > defined in my .cc file aswell :
>
> > >> > #include <pyside_qtgui_python.h>
> > >> > PyTypeObject** SbkPySide_QtCoreTypes;
> > >> > PyTypeObject** SbkPySide_QtGuiTypes;
>
> > >> > Does that look right to you?
>
> > >> Yes it does, nothing wrong. Did you call Py_Initialize() before all 
> > >> this? or
> > >> the python interpreter was already initialized by someone?
>
> > >> Regards.
>
> > >>  signature.asc
> > >> < 1KViewDownload
>
> > >> _______________________________________________
> > >> PySide mailing list
> > >> PyS...@lists.pyside.orghttp://lists.pyside.org/listinfo/pyside
> > > _______________________________________________
> > > PySide mailing list
> > > pys...@lists.pyside.org
> > >http://lists.pyside.org/listinfo/pyside
>
> > --
> > Renato Araujo Oliveira Filho
> > Instituto Nokia de Tecnologia - INdT
> > _______________________________________________
> > PySide mailing list
> > PyS...@lists.pyside.orghttp://lists.pyside.org/listinfo/pyside
>
> _______________________________________________
> PySide mailing list
> PyS...@lists.pyside.orghttp://lists.pyside.org/listinfo/pyside
_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to