On Wednesday 29 December 2010 08:13:05 机械唯物主义 : linjunhalida wrote: > Hello, I'm creating pyside-qwt binding, here is the project: > http://gitorious.org/pysideqwt#more > > I'm new in shiboken, and everything is fine.... at first. > > here is the issue: QwtPlotItem is a virtual Class like this: > > class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager > { > explicit QwtPlotItem(const QwtText &title = QwtText()); > virtual ~QwtPlotItem(); > .... > } > > after I create PySideQwt.so, I run this python code: > > class MyItem(QwtPlotItem): > pass > > and I got : > > TypeError: Error when calling the metaclass bases > type 'PySideQwt.QwtPlotItem' is not an acceptable base type > > sould I create a ~QwtPlotItem(){} ?
No, the problem isn't related to it.
I downloaded the project, nice work!
I fixed some issues about Qwt detection in the cmakelists.txt, you could apply
the attached patch with "git am" if you want so.
Your code still not compiling here, but due to a minor generator bug, it
produces the line:
Shiboken::TypeResolver::createValueTypeResolver<const QPolygon
>("QwtPolygon");
When it should be:
Shiboken::TypeResolver::createValueTypeResolver<QPolygon >("QwtPolygon");
In QwtPolygon wrapper, this is because QwtPolygon is just a typedef to a const
object we forgot to remove the "const".
As soon as I fix this minor issue I'll try to compile it again to check what's
the problem.
Ah, I saw but your .gitignore that you probably isn't using out of source
builds, try to use it, is nice and clean :-)
cd <project>
mkdir build
cd build
cmake <cmakeopts> ..
make
Regards!
P.S.: If possible, join #pyside on freenode, so you can have faster answers,
at least if you are near Brazil timezone otherwise we will be sleeping =].
--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia
From 081a0a2c4b68fbcc90cf6f7afb32de64c3047ca7 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima <[email protected]> Date: Wed, 29 Dec 2010 08:35:19 -0200 Subject: [PATCH] Fix cmake files to detect Qwt among other minor fixes. --- .gitignore | 3 ++- CMakeLists.txt | 15 ++++++++++----- qwt/CMakeLists.txt | 11 ++++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index f4d006d..9dfbc4f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ Testing/ qwt/PySideQwt/ *.so -*.log \ No newline at end of file +*.log +build diff --git a/CMakeLists.txt b/CMakeLists.txt index 2274e0f..63f25fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,15 +3,20 @@ project(qwtbinding) cmake_minimum_required(VERSION 2.6) find_package(PythonLibs REQUIRED) +find_package(GeneratorRunner REQUIRED) find_package(Shiboken REQUIRED) find_package(PySide REQUIRED) find_package(Qt4 4.6.2 REQUIRED) -set(LIBQWT_DIR ${CMAKE_SOURCE_DIR}/../qwt-5.2) - -find_program(GENERATOR generatorrunner REQUIRED) -if (NOT GENERATOR) - message(FATAL_ERROR "You need to specify GENERATOR variable (-DGENERATOR=value)") +# try to find qwt +if (NOT QWT_INCLUDE_DIR) + find_path(QWT_INCLUDE_DIR qwt.h /usr/include/qwt) +endif() +if (NOT QWT_LIBRARY) + find_library(QWT_LIBRARY qwt) +endif() +if (NOT QWT_INCLUDE_DIR OR NOT QWT_LIBRARY) + message(FATAL "Qwt not found! Set QWT_INCLUDE_DIR and QWT_LIBRARY to the correct location.") endif() if(CMAKE_HOST_UNIX) diff --git a/qwt/CMakeLists.txt b/qwt/CMakeLists.txt index dcb7bc6..3b28a56 100644 --- a/qwt/CMakeLists.txt +++ b/qwt/CMakeLists.txt @@ -94,8 +94,9 @@ set(qwt_SRC ) set(qwt_INCLUDE_DIRECTORIES + ${QWT_INCLUDE_DIR} ${SHIBOKEN_INCLUDE_DIR} - ${PYTHON_INCLUDE_PATH} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} ${PYSIDE_INCLUDE_DIR} ${PYSIDE_INCLUDE_DIR}/QtCore ${PYSIDE_INCLUDE_DIR}/QtGui @@ -109,7 +110,7 @@ set(qwt_LINK_LIBRARIES ${SHIBOKEN_PYTHON_LIBRARIES} ${SHIBOKEN_LIBRARY} ${PYSIDE_LIBRARY} - ${LIBQWT_DIR}/lib/libqwt.so + ${QWT_LIBRARY} ) include_directories(qwt ${qwt_INCLUDE_DIRECTORIES}) @@ -118,10 +119,10 @@ set_property(TARGET PySideQwt PROPERTY PREFIX "") target_link_libraries(PySideQwt ${qwt_LINK_LIBRARIES}) add_custom_command(OUTPUT ${qwt_SRC} - COMMAND ${GENERATOR} + COMMAND ${GENERATORRUNNER_BINARY} --generatorSet=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic - ${CMAKE_SOURCE_DIR}/qwt/global.h - --include-paths=${QT_INCLUDE_DIR}:${LIBQWT_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/global.h + --include-paths=${QT_INCLUDE_DIR}:${QWT_INCLUDE_DIR} --typesystem-paths=${typesystem_path}:${PYSIDE_TYPESYSTEMS} --output-directory=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_qwt.xml -- 1.7.3.3
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.openbossa.org/listinfo/pyside
