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
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to