Re: [PyQt] pyqtSlot, getting undefined return values when called from qml javascript

2012-05-01 Thread Ville M. Vainio
On Sun, Apr 29, 2012 at 5:47 PM, Phil Thompson
p...@riverbankcomputing.com wrote:

 I have tried passing return value in the decorator (return=int...).

 Any clues where to look?

 Have you got a complete test that demonstrates the problem?

Now I do, but when I went about to create that minimal example it
started working ;-).

So, thanks and sorry about the noise.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] sip fails with [CLASSNAME] has not been defined

2012-05-01 Thread tuxor1337
I think, I can answer my own question. But only with respect to the 
_reason_ for this behaviour. I have to admit, that I don't like this 
behaviour:


The problem is the namespace ui. Because OnyxDialog is defined in that 
namespace, it has to be referred to as ui::OnyxDialog in 
message_dialog.sip, even though it's being referred to in the very 
same namespace.


What I don't like about that revelation: It seems like there is no way 
to teach SIP to cut off the ui from the namespace. In Python, I will 
always have to refer to the classes via PyOnyx.ui.ui.MessageDialog. Of 
course, that alone is not the problem. But the problem is, that I can do 
things like from PyOnyx.ui import ui, but not something like from 
PyOnyx.ui.ui import *. And later, when I have a namespace called sys, 
this is even going to conflict with the Python module of the same name.


I would love to have a module called PyOnyx.ui and the classes 
MessageDialog and OnyxDialog as direct parts of that module. Is 
there any possibility to achieve this with SIP 4.12.2?


Am 01.05.2012 00:32, schrieb tuxor1...@web.de:

Hi all,

maybe somebody can help me with this. I'm using SIP 4.12.2.

My configure.py script is executing the following sip command line:

/opt/python/bin/sip -c . -b ui/ui.sbf -I /opt/python/share/sip/PyQt4 -x
PyQt_Accessibility -x PyQt_Cursor -x PyQt_ImageFormat_JPEG -x
PyQt_Picture -x PyQt_PrintDialog -x PyQt_Printer -x PyQt_ProgressDialog
-x PyQt_QWS_Cursor -x PyQt_SessionManager -x PyQt_Sound -x VendorID -t
WS_QWS -x PyQt_Accessibility -x PyQt_SessionManager -x PyQt_PrintDialog
-x PyQt_Printer -x PyQt_PrintPreviewDialog -x PyQt_PrintPreviewWidget -x
PyQt_NoPrintRangeBug -x PyQt_qreal_double -t Qt_4_7_2 -x Py_v3 -g
ui/uimod.sip

... which looks okay to me.

But it fails with this error message:

sip: OnyxDialog has not been defined

The sip-file ui/uimod.sip looks like this:


%Module PyOnyx.ui

%Include onyx_dialog.sip
%Include message_dialog.sip


The error is obviously related to the file message_dialog.sip, because
when I leave out that file, everything is fine.

## message_dialog.sip 
%Import QtGui/QtGuimod.sip

namespace ui
{

class MessageDialog : OnyxDialog
{

%TypeHeaderCode
#include onyx/ui/message_dialog.h
%End

public:
MessageDialog(QMessageBox::Icon icon,
const QString  title,
const QString  text,
QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
QWidget * parent = 0);
~MessageDialog();

public:
int exec();
void updateInformation(const QString  text);
};

};
## End: message_dialog.sip 


## onyx_dialog.sip 
%Import QtGui/QtGuimod.sip

namespace ui
{

class OnyxDialog : QDialog
{

%TypeHeaderCode
#include onyx/ui/onyx_dialog.h
%End

public:
OnyxDialog(QWidget *parent, bool show_shadow = true);
~OnyxDialog();
};

};
## End: onyx_dialog.sip 
___
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Segmentation fault. What could be the cause?

2012-05-01 Thread tuxor1337

Hi all,

in one of my SIP files I have this line (a class constructor):

MessageDialog(QMessageBox::Icon icon /TransferThis/,
   const QString  title /TransferThis/,
   const QString  text /TransferThis/,
   QMessageBox::StandardButtons buttons /TransferThis/ = 
QMessageBox::NoButton,

   QWidget * parent /TransferThis/ = 0);

When refering to this constructor later in my Python code, the following 
lines will cause a segmentation fault


app = QApplication(argv)
about = ui.MessageDialog(QMessageBox.Icon(QMessageBox.Information), 
app.tr(argv[1]), app.tr(argv[2]), QMessageBox.No | QMessageBox.Yes)


Can this be caused by the TransferThis annotation? Or by the  C++ 
reference to the QString? Or do you see something else, that's wrong 
with this?



##
If you want to have a closer look at the project, see here:

https://github.com/tuxor1337/PyOnyx

The problematic line is in ui/message_dialog.sip.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] ANN: eric 4.5.3 released

2012-05-01 Thread Detlev Offenbach
Hi,

I just uploaded eric 4.5.3. It is a maintenance release fixing some bugs. It 
is available via the eric web site.

http://eric-ide.python-projects.org/index.html

Regards,
Detlev
--
Detlev Offenbach
det...@die-offenbachs.de



___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Segmentation fault. What could be the cause?

2012-05-01 Thread Phil Thompson
On Tue, 01 May 2012 12:04:19 +0200, tuxor1...@web.de wrote:
 Hi all,
 
 in one of my SIP files I have this line (a class constructor):
 
 MessageDialog(QMessageBox::Icon icon /TransferThis/,
 const QString  title /TransferThis/,
 const QString  text /TransferThis/,
 QMessageBox::StandardButtons buttons /TransferThis/ = 
 QMessageBox::NoButton,
 QWidget * parent /TransferThis/ = 0);
 
 When refering to this constructor later in my Python code, the following

 lines will cause a segmentation fault
 
 app = QApplication(argv)
 about = ui.MessageDialog(QMessageBox.Icon(QMessageBox.Information), 
 app.tr(argv[1]), app.tr(argv[2]), QMessageBox.No | QMessageBox.Yes)
 
 Can this be caused by the TransferThis annotation? Or by the  C++ 
 reference to the QString? Or do you see something else, that's wrong 
 with this?
 
 
 ##
 If you want to have a closer look at the project, see here:
 
 https://github.com/tuxor1337/PyOnyx
 
 The problematic line is in ui/message_dialog.sip.

You definitely need to remove all the /TransferThis/ except for the one on
the parent argument.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Segmentation fault. What could be the cause?

2012-05-01 Thread tuxor1337

Thanks, that worked :) Now everything is running fine.


You definitely need to remove all the /TransferThis/ except for the
one on the parent argument.

Phil


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] sip fails with [CLASSNAME] has not been defined

2012-05-01 Thread tuxor1337
You are right, that's indeed a rather obvious option. Thanks again for 
your patience :)



You use SIP to describe the bindings you want to create - this is not
necessarily the same as the API of the underlying library. In other words
you don't teach SIP to cut off the ui from the namespace, just don't tell
it about it in the first place. The issue then is to make sure that the
generated code compiles - probably by including appropriate using
statements in the right places. Take a look at the use of the
%UnitPostIncludeCode directive in the PyQtMobility bindings.

Phil


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt