From: <hba...@us...> - 2009-06-06 23:24:28
|
Revision: 10043 http://plplot.svn.sourceforge.net/plplot/?rev=10043&view=rev Author: hbabcock Date: 2009-06-06 23:24:06 +0000 (Sat, 06 Jun 2009) Log Message: ----------- Move the pyqt4 bindings into bindings/python/pyqt4. Initial progress on adding these bindings to the PLplot build process. Modified Paths: -------------- trunk/bindings/python/CMakeLists.txt trunk/cmake/modules/drivers.cmake trunk/cmake/modules/plplot.cmake Added Paths: ----------- trunk/bindings/python/pyqt4/ trunk/bindings/python/pyqt4/CMakeLists.txt trunk/bindings/python/pyqt4/config.py trunk/bindings/python/pyqt4/plplot_pyqt.sip trunk/cmake/modules/pyqt4.cmake Removed Paths: ------------- trunk/examples/python/plplot_pyqt/config.py trunk/examples/python/plplot_pyqt/plplot_pyqt.sip Modified: trunk/bindings/python/CMakeLists.txt =================================================================== --- trunk/bindings/python/CMakeLists.txt 2009-06-06 19:19:49 UTC (rev 10042) +++ trunk/bindings/python/CMakeLists.txt 2009-06-06 23:24:06 UTC (rev 10043) @@ -115,4 +115,7 @@ DESTINATION ${PYTHON_INSTDIR} ) +# This is for building the pyqt4 bindings to plplot +add_subdirectory(pyqt4) + endif(ENABLE_python) Added: trunk/bindings/python/pyqt4/CMakeLists.txt =================================================================== --- trunk/bindings/python/pyqt4/CMakeLists.txt (rev 0) +++ trunk/bindings/python/pyqt4/CMakeLists.txt 2009-06-06 23:24:06 UTC (rev 10043) @@ -0,0 +1,29 @@ +# bindings/python/CMakeLists.txt +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Hazen Babcock +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +if(ENABLE_pyqt4) + message(" ENABLE_pyqt4") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.py.in "") + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ + COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/config.py + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(ENABLE_pyqt4) Copied: trunk/bindings/python/pyqt4/config.py (from rev 10042, trunk/examples/python/plplot_pyqt/config.py) =================================================================== --- trunk/bindings/python/pyqt4/config.py (rev 0) +++ trunk/bindings/python/pyqt4/config.py 2009-06-06 23:24:06 UTC (rev 10043) @@ -0,0 +1,63 @@ +import os +import sipconfig +from PyQt4 import pyqtconfig + +# The name of the SIP build file generated by SIP and used by the build +# system. +build_file = "plplot_pyqt.sbf" + +# Get the PyQt configuration information. +config = pyqtconfig.Configuration() + +# Get the extra SIP flags needed by the imported qt module. Note that +# this normally only includes those flags (-x and -t) that relate to SIP's +# versioning system. +qt_sip_flags = config.pyqt_sip_flags + +# Run SIP to generate the code. Note that we tell SIP where to find the qt +# module's specification files using the -I flag. +os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I", config.pyqt_sip_dir, qt_sip_flags, "plplot_pyqt.sip"])) + +# We are going to install the SIP specification file for this module and +# its configuration module. +installs = [] + +installs.append(["plplot_pyqt.sip", os.path.join(config.default_sip_dir, "plplot_pyqt")]) + +installs.append(["plplot_pyqtconfig.py", config.default_mod_dir]) + +# Create the Makefile. The QtModuleMakefile class provided by the +# pyqtconfig module takes care of all the extra preprocessor, compiler and +# linker flags needed by the Qt library. +makefile = pyqtconfig.QtGuiModuleMakefile( + configuration=config, + build_file=build_file, + installs=installs +) + +# Add the library we are wrapping. The name doesn't include any platform +# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the +# ".dll" extension on Windows). +makefile.extra_libs = ["plplotd", "qt"] + +# Generate the Makefile itself. +makefile.generate() + +# Now we create the configuration module. This is done by merging a Python +# dictionary (whose values are normally determined dynamically) with a +# (static) template. +content = { + # Publish where the SIP specifications for this module will be + # installed. + "plplot_pyqt_sip_dir": config.default_sip_dir, + + # Publish the set of SIP flags needed by this module. As these are the + # same flags needed by the qt module we could leave it out, but this + # allows us to change the flags at a later date without breaking + # scripts that import the configuration module. + "plplot_pyqt_sip_flags": qt_sip_flags +} + +# This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in +# template and the dictionary. +sipconfig.create_config_module("plplot_pyqtconfig.py", "config.py.in", content) Property changes on: trunk/bindings/python/pyqt4/config.py ___________________________________________________________________ Added: svn:mergeinfo + Copied: trunk/bindings/python/pyqt4/plplot_pyqt.sip (from rev 10042, trunk/examples/python/plplot_pyqt/plplot_pyqt.sip) =================================================================== --- trunk/bindings/python/pyqt4/plplot_pyqt.sip (rev 0) +++ trunk/bindings/python/pyqt4/plplot_pyqt.sip 2009-06-06 23:24:06 UTC (rev 10043) @@ -0,0 +1,60 @@ + +%Module plplot_pyqt 0 + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip + +class QtPLDriver { + +%TypeHeaderCode +#include "plplot/qt.h" +%End + + public: + QtPLDriver(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y); + virtual ~QtPLDriver(); +}; + +class QtPLWidget: QWidget, QtPLDriver { + +%TypeHeaderCode +#include "plplot/qt.h" +%End + + public: + QtPLWidget(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y, QWidget* parent=0); + virtual ~QtPLWidget(); + + void clearWidget(); + + protected: + void mouseReleaseEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); + void closeEvent(QCloseEvent *event); + void nextPage(); + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *); + void getPlotParameters(double &io_dXFact, double &io_dYFact, double &io_dXOffset, double &io_dYOffset); +}; + +class QtExtWidget: QtPLWidget { + +%TypeHeaderCode +#include "plplot/qt.h" +%End + + public: + QtExtWidget(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y, QWidget* parent=0); + virtual ~QtExtWidget(); + + void captureMousePlotCoords(double *x, double *y); + void mouseMoveEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + + protected: + void paintEvent(QPaintEvent *event); +}; + +void plsetqtdev(QtExtWidget* widget); +void plfreeqtdev(); Property changes on: trunk/bindings/python/pyqt4/plplot_pyqt.sip ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/cmake/modules/drivers.cmake =================================================================== --- trunk/cmake/modules/drivers.cmake 2009-06-06 19:19:49 UTC (rev 10042) +++ trunk/cmake/modules/drivers.cmake 2009-06-06 23:24:06 UTC (rev 10043) @@ -92,6 +92,7 @@ include(aqt) include(wxwidgets) include(pdf) +include(pyqt4) # Finalize device options. include(drivers-finish) Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-06-06 19:19:49 UTC (rev 10042) +++ trunk/cmake/modules/plplot.cmake 2009-06-06 23:24:06 UTC (rev 10043) @@ -423,3 +423,5 @@ # ======================================================================= include(docbook) include(summary) + + Added: trunk/cmake/modules/pyqt4.cmake =================================================================== --- trunk/cmake/modules/pyqt4.cmake (rev 0) +++ trunk/cmake/modules/pyqt4.cmake 2009-06-06 23:24:06 UTC (rev 10043) @@ -0,0 +1,38 @@ +# bindings/python/CMakeLists.txt +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Hazen Babcock +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# Options to enable PyQt4 bindings +if(DEFAULT_NO_BINDINGS) + option(ENABLE_pyqt4 "Enable PyQt4 bindings" OFF) +else(DEFAULT_NO_BINDINGS) + option(ENABLE_pyqt4 "Enable PyQt4 bindings" ON) +endif(DEFAULT_NO_BINDINGS) + +if(NOT ENABLE_python AND NOT PLD_extqt) + set(ENABLE_pyqt4 OFF CACHE BOOL "Enable PyQt4 bindings" FORCE) +endif(NOT ENABLE_python AND NOT PLD_extqt) + +set(ENABLE_pyqt4 OFF CACHE BOOL "Enable PyQt4 bindings" FORCE) + +if(ENABLE_pyqt4) + message(STATUS "Checking for PyQt4") +endif(ENABLE_pyqt4) + + Deleted: trunk/examples/python/plplot_pyqt/config.py =================================================================== --- trunk/examples/python/plplot_pyqt/config.py 2009-06-06 19:19:49 UTC (rev 10042) +++ trunk/examples/python/plplot_pyqt/config.py 2009-06-06 23:24:06 UTC (rev 10043) @@ -1,63 +0,0 @@ -import os -import sipconfig -from PyQt4 import pyqtconfig - -# The name of the SIP build file generated by SIP and used by the build -# system. -build_file = "plplot_pyqt.sbf" - -# Get the PyQt configuration information. -config = pyqtconfig.Configuration() - -# Get the extra SIP flags needed by the imported qt module. Note that -# this normally only includes those flags (-x and -t) that relate to SIP's -# versioning system. -qt_sip_flags = config.pyqt_sip_flags - -# Run SIP to generate the code. Note that we tell SIP where to find the qt -# module's specification files using the -I flag. -os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I", config.pyqt_sip_dir, qt_sip_flags, "plplot_pyqt.sip"])) - -# We are going to install the SIP specification file for this module and -# its configuration module. -installs = [] - -installs.append(["plplot_pyqt.sip", os.path.join(config.default_sip_dir, "plplot_pyqt")]) - -installs.append(["plplot_pyqtconfig.py", config.default_mod_dir]) - -# Create the Makefile. The QtModuleMakefile class provided by the -# pyqtconfig module takes care of all the extra preprocessor, compiler and -# linker flags needed by the Qt library. -makefile = pyqtconfig.QtGuiModuleMakefile( - configuration=config, - build_file=build_file, - installs=installs -) - -# Add the library we are wrapping. The name doesn't include any platform -# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the -# ".dll" extension on Windows). -makefile.extra_libs = ["plplotd", "qt"] - -# Generate the Makefile itself. -makefile.generate() - -# Now we create the configuration module. This is done by merging a Python -# dictionary (whose values are normally determined dynamically) with a -# (static) template. -content = { - # Publish where the SIP specifications for this module will be - # installed. - "plplot_pyqt_sip_dir": config.default_sip_dir, - - # Publish the set of SIP flags needed by this module. As these are the - # same flags needed by the qt module we could leave it out, but this - # allows us to change the flags at a later date without breaking - # scripts that import the configuration module. - "plplot_pyqt_sip_flags": qt_sip_flags -} - -# This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in -# template and the dictionary. -sipconfig.create_config_module("plplot_pyqtconfig.py", "config.py.in", content) Deleted: trunk/examples/python/plplot_pyqt/plplot_pyqt.sip =================================================================== --- trunk/examples/python/plplot_pyqt/plplot_pyqt.sip 2009-06-06 19:19:49 UTC (rev 10042) +++ trunk/examples/python/plplot_pyqt/plplot_pyqt.sip 2009-06-06 23:24:06 UTC (rev 10043) @@ -1,63 +0,0 @@ - -%Module plplot_pyqt 0 - -%Import QtCore/QtCoremod.sip -%Import QtGui/QtGuimod.sip - -class QtPLDriver { - -%TypeHeaderCode -#include "plplot/my_qt.h" -%End - - public: - QtPLDriver(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y); - virtual ~QtPLDriver(); -}; - -class QtPLWidget: QWidget, QtPLDriver { - -%TypeHeaderCode -#include "plplot/my_qt.h" -%End - - public: - QtPLWidget(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y, QWidget* parent=0); - virtual ~QtPLWidget(); - - void clearWidget(); - - protected: - void mouseReleaseEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void closeEvent(QCloseEvent *event); - void nextPage(); - void resizeEvent(QResizeEvent *); - void paintEvent(QPaintEvent *); - void getPlotParameters(double &io_dXFact, double &io_dYFact, double &io_dXOffset, double &io_dYOffset); - - - -}; - -class QtExtWidget: QtPLWidget { - -%TypeHeaderCode -#include "plplot/my_qt.h" -%End - - public: - QtExtWidget(int i_iWidth=QT_DEFAULT_X, int i_iHeight=QT_DEFAULT_Y, QWidget* parent=0); - virtual ~QtExtWidget(); - - void captureMousePlotCoords(double *x, double *y); - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - - protected: - void paintEvent(QPaintEvent *event); -}; - -void plsetqtdev(QtExtWidget* widget); -void plfreeqtdev(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |