On Monday 07 March 2011 12:32:33 Alberto Soto wrote: > Hi, > > I'm currently working with shiboken to create a binding of a plot > facility for our sofware written in Qt/C++. Shiboken works pretty well > and it's easy to use (even though I had to add a lot of tricky and low > level code injections using typesystem files), but I have > questions/remarks about some features in Shiboken. > > First of all, regarding the keywords support in Shiboken: When a C++ > function uses some default arguments, shiboken introduces a keywords > dictionnary in the wrapped function. It checks that the keyword argument > is not already given by a "non-keyword" argument, but the user is not > warned if a wrong keyword was given. It would be nice for Shiboken to > throw an exception when the entered keyword is unknown; like the config > method of a Tkinter Label, for example, that throws a TclError when an > unknown option is used. > > Furhermore, Shiboken takes the default value of the C++ function when > the associated keyword is not given. But, could it be possible to > implement a mechanism that allows more flexibility? For example, a way > to specify in the typesystem files a function that retrieves the > argument value to use: For a function using a Qt::Penstyle as an > argument with Qt::SolideLine as default value, we could tell shiboken to > use a C++ function that returns the current line style: > > Currently generated by Shiboken: Qt::PenStyle cppArg1 = pyargs[1] ? > Shiboken::Converter<Qt::PenStyle >::toCpp(pyargs[1]) : Qt::SolidLine; > Here it would be preferable to have: Qt::PenStyle cppArg1 = pyargs[1] ? > Shiboken::Converter<Qt::PenStyle >::toCpp(pyargs[1]) : > cppself->lineStyle();
If you set the default-value expression to "cppself->lineStyle()" it may work, you need to test it to check, anyway for sure variable substitution wont work there, but a patch to do this isn't complicated. > Also, regarding the documentation, is it possible to inject some doc > string inside a python function using the typesystem files, in order to > have documentation at runtime using the the "__doc__" attribute or help > function? The generator doesn't support doc strings yet, although this feature is easy to implement. > BTW, felicitation for the release, you did a great job! > > BR Alberto Soto -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
