-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
\param theClassName Python class name
\return Python class object or None object if class is not found
*/
-static PyObject* GetPyClass( const char* theClassName )
+static PyTypeObject* GetPyClass( const char* theClassName )
{
static PyObject* aVTKModule = 0;
PyObject* aPyClass = 0;
if ( aVTKModule ) {
PyObject* aVTKDict = PyModule_GetDict( aVTKModule );
aPyClass = PyDict_GetItemString(aVTKDict, const_cast<char*>( theClassName ) );
+ if (!PyType_Check(aPyClass))
+ return 0;
}
- return aPyClass;
+ return (PyTypeObject *)aPyClass;
}
/*!
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderer" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderer" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderWindow" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderWindow" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderWindowInteractor" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderWindowInteractor" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}
{
if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) {
if ( aVTKViewWindow->isTrihedronDisplayed() != myShow )
- aVTKViewWindow->onViewTrihedron();
+ aVTKViewWindow->onViewTrihedron(myShow);
}
}
};