[PyQt] sip fails with "[CLASSNAME] has not been defined"
tuxor1337 at web.de
tuxor1337 at web.de
Tue May 1 08:57:38 BST 2012
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 tuxor1337 at 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 at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list