Champion! Thanks Hugo, I'll give this a crack now.
On Apr 7, 10:19 am, Hugo Parente Lima <[email protected]> wrote: > On Wednesday 06 April 2011 19:07:34 kungfuelmosan wrote: > > > Hey Hugo, > > > Yep, I'm writing it by hand. It is bindings for a C library though so > > I am going to look into using Shiboken to generate the extension but > > I'd like to get my current hand written code working first. > > Ok, so you'll need to do what the generated code does: > > Put this in the init function of your module to load the QtGui python module > before loading your module. > > 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; > > } > > and declare a global variables: > > PyTypeObject** SbkPySide_QtCoreTypes; > PyTypeObject** SbkPySide_QtGuiTypes; > > This black magic is needed to have access of types declared in other modules > without linking them. I recommend you to see the implementation of > importModule function to feel more comfortable before paste this code in your > module. > > > When you say depends on QtCore / QtGui, do you mean the standard Qt > > 4.7 libQtCore.so / libQtGui.so or a wrapper lib in PySide? > > Python modules can't link to other python modules, so the big header depends > only on libQtCore.so and libQtGui.so, not the binding! and libshiboken.so. > > > > > > > > > > > Thanks again. > > D > > > On Apr 7, 12:55 am, Hugo Parente Lima <[email protected]> wrote: > > > On Wednesday 06 April 2011 02:44:55 kungfuelmosan wrote: > > > > Hey Hugo, > > > > > Thanks for the reply. I've got it to compile by adding these include > > > > search paths : > > > > > -I.../pyside_qt4.7-1.0.1_64/include > > > > -I.../pyside_qt4.7-1.0.1_64/include/shiboken > > > > -I.../pyside_qt4.7-1.0.1_64/include/PySide > > > > -I.../pyside_qt4.7-1.0.1_64/include/PySide/QtCore > > > > -I.../pyside_qt4.7-1.0.1_64/include/PySide/QtGui > > > > > So pyside_qtgui_python.h includes fine now. > > > > > But when I go to load my python extension module all I ever get is : > > > > > undefined symbol: SbkPySide_QtCoreTypes > > > > Are you writing your extension by hand? or it's generated using Shiboken > > > generator? > > > Anyway you need to tell that your extension depends on QtCore and QtGui, > > > if you are using Shiboken generator a simple load-typesystem tag does > > > the trick. > > > > > And the only place I seem to be able to find that symbol is in the > > > > actual PySide.QtCore python module : > > > > > nm .../pyside_qt4.7-1.0.1_64/lib/python2.6/site-packages/PySide/ > > > > QtCore.so | grep SbkPySide_QtCoreTypes > > > > 0000000000f0d490 b SbkPySide_QtCoreTypes > > > > > Even if I add that to the link list its still not happy. Is that what > > > > I should be linking in? > > > > > Cheers in advance, > > > > D > > > > > On Apr 6, 12:38 am, Hugo Parente Lima <[email protected]> wrote: > > > > > On Monday 04 April 2011 22:48:14 kungfuelmosan wrote: > > > > > > Hey All, > > > > > > > Can anyone point me in the right direction to some info on running > > > > > > PySide embedded in a C++ Qt Application? > > > > > > > I have a Python C Extension library that I'm converting from > > > > > > PyQt/sip to PySide/Shiboken and in one part I have a PyObject* > > > > > > passed into my C Extension function that im expecing to be a > > > > > > PySide QWidget object, is there a way I can get the internal C++ > > > > > > QWidget pointer from the python wrapper? > > > > > > > Some googling led me to try : > > > > > > > #include <pyside_qtgui_python.h> > > > > > > > PyObject *someWrappedObject = ... ; > > > > > > > QWidget *w = > > > > > > Shiboken::Converter<QWidget*>::toCpp(someWrappedObject); > > > > > > > But the #include pyside_qtgui_python.h seems to have a million and > > > > > > one dependencies so I'm not sure if this is what I;m meant to be > > > > > > doing? > > > > > > The only dependency is QtCore, QtGui and Shiboken itself, there are a > > > > > lot of templates for sure, but if you don't instantiate them they > > > > > will behave. > > > > > > > Are there any docs on this / a nicely wrapped up public include.h > > > > > > for Shiboken? > > > > > > > Cheers, > > > > > > Daniel > > > > -- > > > Hugo Parente Lima > > > INdT - Instituto Nokia de Tecnologia > > > > signature.asc > > > < 1KViewDownload > > > > _______________________________________________ > > > PySide mailing list > > > [email protected]http://lists.pyside.org/listinfo/pyside > > > _______________________________________________ > > PySide mailing list > > [email protected] > >http://lists.pyside.org/listinfo/pyside > > -- > Hugo Parente Lima > INdT - Instituto Nokia de Tecnologia > > signature.asc > < 1KViewDownload > > _______________________________________________ > PySide mailing list > [email protected]http://lists.pyside.org/listinfo/pyside _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
