From d0413fc6f8d2c004c7d2baac5d174c0502417d70 Mon Sep 17 00:00:00 2001 From: adv Date: Thu, 5 Sep 2013 10:37:38 +0000 Subject: [PATCH] First implementation of python API for HYDRO module. --- src/HYDROPy/CMakeLists.txt | 2 + src/HYDROPy/HYDROData.py.in | 60 ++++++++ src/HYDROPy/HYDROData.sip | 61 ++++++++ src/HYDROPy/HYDROData_Bathymetry.sip | 206 +++++++++++++++++++++++++++ src/HYDROPy/HYDROData_Document.sip | 162 +++++++++++++++++++++ src/HYDROPy/HYDROData_Object.sip | 142 ++++++++++++++++++ src/HYDROPy/configure.py | 111 +++++++++++++++ 7 files changed, 744 insertions(+) create mode 100644 src/HYDROPy/CMakeLists.txt create mode 100644 src/HYDROPy/HYDROData.py.in create mode 100644 src/HYDROPy/HYDROData.sip create mode 100644 src/HYDROPy/HYDROData_Bathymetry.sip create mode 100644 src/HYDROPy/HYDROData_Document.sip create mode 100644 src/HYDROPy/HYDROData_Object.sip create mode 100644 src/HYDROPy/configure.py diff --git a/src/HYDROPy/CMakeLists.txt b/src/HYDROPy/CMakeLists.txt new file mode 100644 index 00000000..49772fd8 --- /dev/null +++ b/src/HYDROPy/CMakeLists.txt @@ -0,0 +1,2 @@ + +ADD_CUSTOM_TARGET( HYDROData.py DEPENDS HYDROData.sip COMMAND ../../../HYDRO_SRC/src/HYDROPy/configure.py ) diff --git a/src/HYDROPy/HYDROData.py.in b/src/HYDROPy/HYDROData.py.in new file mode 100644 index 00000000..a5f37adb --- /dev/null +++ b/src/HYDROPy/HYDROData.py.in @@ -0,0 +1,60 @@ +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from PyQt4 import pyqtconfig + +# These are installation specific values created when HYDROData was configured. +# The following line will be replaced when this template is used to create +# the final configuration module. +# @SIP_CONFIGURATION@ + +class Configuration(pyqtconfig.Configuration): + """The class that represents HYDROData configuration values. + """ + def __init__(self, sub_cfg=None): + """Initialise an instance of the class. + + sub_cfg is the list of sub-class configurations. It should be None + when called normally. + """ + # This is all standard code to be copied verbatim except for the + # name of the module containing the super-class. + if sub_cfg: + cfg = sub_cfg + else: + cfg = [] + + cfg.append(_pkg_config) + + pyqtconfig.Configuration.__init__(self, cfg) + +class HYDRODataModuleMakefile(pyqtconfig.QtGuiModuleMakefile): + """The Makefile class for modules that %Import HYDROData. + """ + def finalise(self): + """Finalise the macros. + """ + # Make sure our C++ library is linked. + self.extra_libs.append("HYDROData") + + # Let the super-class do what it needs to. + pyqtconfig.QtGuiModuleMakefile.finalise(self) \ No newline at end of file diff --git a/src/HYDROPy/HYDROData.sip b/src/HYDROPy/HYDROData.sip new file mode 100644 index 00000000..ae4ec313 --- /dev/null +++ b/src/HYDROPy/HYDROData.sip @@ -0,0 +1,61 @@ + +%Copying +Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE + +Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +%End + +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + +%Module(name=HYDROData, version=1) + + +%Copying +Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE + +Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +%End + +%Import QtCore/QtCoremod.sip + +%Include HYDROData_Object.sip +%Include HYDROData_Bathymetry.sip + + +%Include HYDROData_Document.sip + + diff --git a/src/HYDROPy/HYDROData_Bathymetry.sip b/src/HYDROPy/HYDROData_Bathymetry.sip new file mode 100644 index 00000000..2d5911e0 --- /dev/null +++ b/src/HYDROPy/HYDROData_Bathymetry.sip @@ -0,0 +1,206 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%ExportedHeaderCode + +#include + +#include + +%End + +%ModuleCode + +PyObject* convertToPythonAltitudeList( const HYDROData_Bathymetry::AltitudePoints& thePoints ); +HYDROData_Bathymetry::AltitudePoints convertFromPythonAltitudeList( PyObject* thePythonList ); + +%End + +class HYDROData_Bathymetry : HYDROData_Object +{ + +%ConvertToSubClassCode + if ( !Handle(HYDROData_Bathymetry)::DownCast( sipCpp ).IsNull() ) + sipClass = sipClass_HYDROData_Bathymetry; + else + sipClass = NULL; +%End + +%TypeHeaderCode +#include +%End + +%TypeCode + +PyObject* convertToPythonAltitudeList( const HYDROData_Bathymetry::AltitudePoints& thePoints ) +{ + int aListSize = thePoints.size(); + + PyObject* aPythonList = NULL; + if ( ( aPythonList = PyList_New( aListSize ) ) == NULL ) + return NULL; + + for ( int i = 0; i < aListSize; ++i ) + { + const HYDROData_Bathymetry::AltitudePoint& aPoint = thePoints.at( i ); + + PyObject* aTypleObj = Py_BuildValue( "(ddd)", aPoint.X(), aPoint.Y(), aPoint.Z() ); + + PyList_SET_ITEM( aPythonList, i, aTypleObj ); + } + + return aPythonList; +} + +HYDROData_Bathymetry::AltitudePoints convertFromPythonAltitudeList( PyObject* thePythonList ) +{ + HYDROData_Bathymetry::AltitudePoints aPoints; + if ( thePythonList == NULL ) + return aPoints; + + for ( int i = 0, n = PyList_GET_SIZE( thePythonList ); i < n; ++i ) + { + PyObject* aTypleObj = PyList_GET_ITEM( thePythonList, i ); + + double anArr[ 3 ]; + if ( !PyArg_ParseTuple( aTypleObj, "ddd", &anArr[ 0 ], &anArr[ 1 ], &anArr[ 2 ] ) ) + continue; + + HYDROData_Bathymetry::AltitudePoint aPoint; + aPoint.SetX( anArr[ 0 ] ); + aPoint.SetY( anArr[ 1 ] ); + aPoint.SetZ( anArr[ 2 ] ); + + aPoints.append( aPoint ); + } + + return aPoints; +} + +%End + + +public: + + //virtual const ObjectKind GetKind() const { return KIND_BATHYMETRY; } + + +public: + // Public methods to work with Bathymetry altitudes. + + /** + * Returns altitude points list. + * \return points list + */ + static double GetInvalidAltitude(); + + /** + * Replace current altitude points by new one. + * \param thePoints the altitude points list + */ + virtual void SetAltitudePoints( SIP_PYLIST ) [void (const HYDROData_Bathymetry::AltitudePoints&)] ; + %MethodCode + + // The C++ API takes a list of gp_XYZ objects, + // but we pass a list of python tuples. + + HYDROData_Bathymetry::AltitudePoints aPoints = + convertFromPythonAltitudeList( a0 ); + + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Bathymetry::SetAltitudePoints( aPoints ) : + sipCpp->SetAltitudePoints( aPoints ); + Py_END_ALLOW_THREADS + + %End + %VirtualCatcherCode + + PyObject* aPythonList = convertToPythonAltitudeList( a0 ); + if ( aPythonList != NULL ) + { + sipCallMethod( &sipIsErr, sipMethod, "O", aPythonList ); + Py_DECREF( aPythonList ); + } + + %End + + /** + * Returns altitude points list. + * \return points list + */ + SIP_PYLIST GetAltitudePoints() const [HYDROData_Bathymetry::AltitudePoints ()] ; + %MethodCode + + // The C++ API returns a list of gp_XYZ objects, + // we convert it to list of python tuples. + + HYDROData_Bathymetry::AltitudePoints aPoints; + + Py_BEGIN_ALLOW_THREADS + aPoints = sipSelfWasArg ? sipCpp->HYDROData_Bathymetry::GetAltitudePoints() : sipCpp->GetAltitudePoints(); + Py_END_ALLOW_THREADS + + sipRes = convertToPythonAltitudeList( aPoints ); + + %End + /** + * Remove all altitude points. + */ + void RemoveAltitudePoints(); + + /** + * Returns altitude for given point. + * \param thePoint the point to examine + * \return altitude value + */ + double GetAltitudeForPoint( const QPointF& thePoint ) const; + + +public: + // Public methods to work with files. + + /** + * Imports Bathymetry data from file. The supported file types: + * - xyz + * \param theFileName the path to file + * \return \c true if file has been successfully read + */ + bool ImportFromFile( const QString& theFileName ); + + +protected: + + //friend class HYDROData_Iterator; + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_Bathymetry(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + ~HYDROData_Bathymetry(); +}; + + diff --git a/src/HYDROPy/HYDROData_Document.sip b/src/HYDROPy/HYDROData_Document.sip new file mode 100644 index 00000000..57f60e9b --- /dev/null +++ b/src/HYDROPy/HYDROData_Document.sip @@ -0,0 +1,162 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%ExportedHeaderCode +#include +%End + +enum Data_DocError { + DocError_OK = 0, ///< success + DocError_ResourcesProblem, ///< resources files are invalid or not found + DocError_CanNotOpen, ///< can not open file for reading or writing + DocError_InvalidVersion, ///< version of document is different than expected + DocError_InvalidFormat, ///< format of the document is bad + DocError_UnknownProblem ///< problem has unknown nature +}; + +class HYDROData_Document +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + if ( !Handle(HYDROData_Document)::DownCast( sipCpp ).IsNull() ) + sipClass = sipClass_HYDROData_Document; + else + sipClass = NULL; +%End + +public: + + //! Returns the existing document or creates new if it is not exist + static HYDROData_Document Document( const int theStudyID ) [Handle_HYDROData_Document (const int)] ; + %MethodCode + + Py_BEGIN_ALLOW_THREADS + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( a0 ); + if ( !aDocument.IsNull() ) + { + sipRes = aDocument.operator->(); + } + + Py_END_ALLOW_THREADS + + %End + + //! Returns true if data model contains document for this study + static bool HasDocument( const int theStudyID ); + + //! Loads the OCAF document from the file. + //! \param theFileName full name of the file to load + //! \param theStudyID identifier of the SALOME study to associate with loaded file + //! \returns error status (OK in case of success) + static Data_DocError Load( const char* theFileName, const int theStudyID ); + + //! Saves the OCAF document to the file. + //! \param theFileName full name of the file to store + //! \returns error status (OK in case of success) + Data_DocError Save( const char* theFileName ); + + //! Removes document data + void Close(); + + //! Starts a new operation (opens a tansaction) + void StartOperation(); + + //! Finishes the previously started operation (closes the transaction) + //void CommitOperation( + // const TCollection_ExtendedString& theName = TCollection_ExtendedString() ); + + //! Aborts the operation + void AbortOperation(); + + //! Returns true if operation has been started, but not yet finished or aborted + bool IsOperation(); + + //! Returns true if document was modified (since creation/opening) + bool IsModified(); + + //! Returns True if there are available Undos + bool CanUndo(); + + //! Returns a list of stored undo actions + //const TDF_DeltaList& GetUndos(); + + //! Clears a list of stored undo actions + void ClearUndos(); + + //! Undoes last operation + void Undo(); + + //! Returns True if there are available Redos + bool CanRedo(); + + //! Returns a list of stored undo actions + //const TDF_DeltaList& GetRedos(); + + //! Clears a list of stored undo actions + void ClearRedos(); + + //! Redoes last operation + void Redo(); + + //! Creates and locates in the document a new object + //! \param theKind kind of the created object, can not be UNKNOWN + //! \returns the created object + HYDROData_Object CreateObject( const ObjectKind theKind ) [Handle_HYDROData_Object (const ObjectKind)] ; + %MethodCode + + Py_BEGIN_ALLOW_THREADS + + Handle(HYDROData_Object) anObject = + sipSelfWasArg ? sipCpp->HYDROData_Document::CreateObject( a0 ) : sipCpp->CreateObject( a0 ); + if ( !anObject.IsNull() ) + { + switch( anObject->GetKind() ) + { + case KIND_BATHYMETRY: + { + Handle(HYDROData_Bathymetry) aBathymetry = + Handle(HYDROData_Bathymetry)::DownCast( anObject ); + sipRes = new HYDROData_Bathymetry( *aBathymetry.operator->() ); + break; + } + } + } + + Py_END_ALLOW_THREADS + + %End + +protected: + + //friend class HYDROData_Iterator; + //friend class test_HYDROData_Document; + + //! Creates new document: private because "Document" method must be used instead of direct creation. + HYDROData_Document(); + + //! Deletes all high-level data, managed this document + ~HYDROData_Document(); + +}; diff --git a/src/HYDROPy/HYDROData_Object.sip b/src/HYDROPy/HYDROData_Object.sip new file mode 100644 index 00000000..7d63afcf --- /dev/null +++ b/src/HYDROPy/HYDROData_Object.sip @@ -0,0 +1,142 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + +%ExportedHeaderCode +#include +%End + +typedef int ObjectKind; + +class HYDROData_Object +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + // HYDROData_Object sub-classes provide a unique kind ID. + switch ( sipCpp->GetKind() ) + { + case KIND_BATHYMETRY: + sipClass = sipClass_HYDROData_Bathymetry; + break; + + case KIND_UNKNOWN: + sipClass = sipClass_HYDROData_Object; + break; + + default: + // We don't recognise the type. + sipClass = NULL; + } +%End + +public: + /** + * Visual state data. + */ + struct VisualState + { + bool Visibility; + double Transparency; + double ZValue; + + VisualState(); + }; + + typedef QMap < int, HYDROData_Object::VisualState > ViewId2VisualStateMap; + typedef QMapIterator< int, HYDROData_Object::VisualState > ViewId2VisualStateMapIterator; + +public: + + /** + * Returns the kind of this object. Must be redefined in all objects of known type. + */ + //virtual const ObjectKind GetKind() const {return KIND_UNKNOWN;} + + /** + * Returns the name of this object. + */ + QString GetName() const; + + /** + * Updates the name of this object. + */ + void SetName(const QString& theName); + + /** + * Returns the object visibility state for the view with specified id. + * \param theViewId view id + * \returns visibility state + */ + bool IsVisible( const int theViewId ) const; + + /** + * Sets the object visibility state for the view with specified id. + * \param theViewId view id + * \param theVal visibility state + */ + void SetVisible( const int theViewId, + const bool theVal ); + + /** + * Checks is object exists in the data structure. + * \returns true is object is not exists in the data model + */ + bool IsRemoved() const; + + /** + * Removes object from the data structure. + */ + void Remove(); + + /** + * Returns unique integer identifier of the object (may be used for ordering of objects) + */ + int ID() const; + + /** + * Copies all properties of this to the destinated object. + * Objects must be the same type. + * \param theDestination initialized object (from any document) - target of copying + */ + /* + void CopyTo( HYDROData_Object theDestination ) const; + */ + +protected: + + //friend class HYDROData_Iterator; + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_Object(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + virtual ~HYDROData_Object(); + +}; diff --git a/src/HYDROPy/configure.py b/src/HYDROPy/configure.py new file mode 100644 index 00000000..0bfa936f --- /dev/null +++ b/src/HYDROPy/configure.py @@ -0,0 +1,111 @@ +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import os +import sipconfig +from PyQt4 import pyqtconfig + +# Get the PyQt configuration information. +config = pyqtconfig.Configuration() + +src_path = '.' +installs_path = '.' + +# Set enviroment for make file + +if 'HYDRO_SRC_DIR' in os.environ : + config._macros[ 'INCDIR' ] += ' ' + os.path.join( os.environ[ 'HYDRO_SRC_DIR' ], 'src/HYDROData' ) + src_path = os.path.join( os.environ[ 'HYDRO_SRC_DIR' ], 'src/HYDROPy' ) + +if 'CASROOT' in os.environ : + config._macros[ 'INCDIR' ] += ' ' + os.path.join( os.environ[ 'CASROOT' ], 'inc' ) + +if 'HYDRO_ROOT_DIR' in os.environ : + config._macros[ 'LIBDIR' ] += ' ' + os.path.join( os.environ[ 'HYDRO_ROOT_DIR' ], 'lib/salome' ) + installs_path = os.path.join( os.environ[ 'HYDRO_ROOT_DIR' ], 'lib/python' + os.environ[ 'PYTHON_VERSION' ] + '/site-packages/salome' ) + +config._macros[ 'DEFINES' ] += ' HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS' + +# The name of the SIP build file generated by SIP and used by the build +# system. +build_file = "HYDROData.sbf" + +# Get the extra SIP flags needed by the imported PyQt modules. Note that +# this normally only includes those flags (-x and -t) that relate to SIP's +# versioning system. +pyqt_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, + '-s', '.cxx', + '-c', ".", + '-b', build_file, + '-I', config.pyqt_sip_dir, + pyqt_sip_flags, + os.path.join( src_path, 'HYDROData.sip' ) + ])) + + +# We are going to install the SIP specification file for this module and +# its configuration module. +installs = [] +installs.append( [ 'HYDROData.py', installs_path ] ) + +# Create the Makefile. The QtGuiModuleMakefile 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, + install_dir=installs_path, + installs=installs, + makefile='Makefile' +) + +# 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 = [ 'HYDROData' ] + +# 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. + 'HYDROData_sip_dir': installs_path, + + # 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. + 'HYDROData_sip_flags': pyqt_sip_flags +} + +# This creates the HYDROData.py module from the HYDROData.py.in +# template and the dictionary. +sipconfig.create_config_module( 'HYDROData.py', os.path.join( src_path, 'HYDROData.py.in' ), content ) \ No newline at end of file -- 2.39.2