From 8c1a74e23c5c2ce2561e4ea3ecbb144c124f4ad8 Mon Sep 17 00:00:00 2001 From: vtn Date: Wed, 6 Mar 2013 14:03:12 +0000 Subject: [PATCH] Porting to Paraview 3.98.1 --- getwrapclasses.py | 22 ++++++-- idl/vtkWrapIDL.c | 71 +++++++++++++++++++++----- src/PVGUI/PVGUI_Module.cxx | 67 ++++++++++++++++++------ src/PVGUI/PVGUI_Module.h | 1 + test/VisuPrs/Animation/C8.py | 2 +- test/VisuPrs/Animation/D1.py | 2 +- test/VisuPrs/Animation/D2.py | 2 +- test/VisuPrs/Util/paravistesthelper.py | 13 ++++- 8 files changed, 143 insertions(+), 37 deletions(-) diff --git a/getwrapclasses.py b/getwrapclasses.py index db2b747c..076806d0 100644 --- a/getwrapclasses.py +++ b/getwrapclasses.py @@ -35,6 +35,22 @@ from vtkPVServerManagerApplicationPython import * from vtkPVServerManagerCorePython import * from vtkPVServerManagerDefaultPython import * from vtkPVServerManagerRenderingPython import * +try: + from vtkPVVTKExtensionsCorePython import * +except: + pass +try: + from vtkPVVTKExtensionsDefaultPython import * +except: + pass +try: + from vtkPVVTKExtensionsRenderingPython import * +except: + pass +try: + from vtkPVVTKExtensionsWebGLExporterPython import * +except: + pass l1 = dir() for a in l1: @@ -72,21 +88,21 @@ while len(pv_classes_new): m=re.match('\s*class\s+(vtk\w+)\s*;',line) if m is not None: cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk: + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): pv_classes_new.append(cn) continue m=re.match('\s*struct\s+(vtk\w+)\s*;',line) if m is not None: cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk: + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): pv_classes_new.append(cn) continue m=re.match('\s*#include\s+"(vtk\w+)\.h"',line) if m is not None: cn=m.group(1) - if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk: + if cn not in dic.keys() and cn not in pv_classes_new and cn in classeslistvtk and issubclass(globals()[cn], vtkObjectBase): pv_classes_new.append(cn) continue diff --git a/idl/vtkWrapIDL.c b/idl/vtkWrapIDL.c index 784bb072..9b121398 100644 --- a/idl/vtkWrapIDL.c +++ b/idl/vtkWrapIDL.c @@ -192,6 +192,10 @@ void AddCharAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { AddAtomArg(I,Type,"char","Char",Result,CurrPos); } +void AddCharArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { + AddArrayArg(I,Type,"char",Result,CurrPos); +} + void AddStringArg(int I, char *Result, int *CurrPos) { #if defined(IDL_I_HH) || defined(IDL_I_CC) add_to_sig(Result,"char ",CurrPos); @@ -242,11 +246,22 @@ int IsvtkIdType(ValueInfo* theType) { int IsShort(ValueInfo* theType) { //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); int aVal = theType->Type & VTK_PARSE_BASE_TYPE; - return (aVal == VTK_PARSE_SHORT) || (aVal == VTK_PARSE_INT) || - (aVal == VTK_PARSE_ID_TYPE) || (aVal == VTK_PARSE_UNSIGNED_INT) || (aVal == VTK_PARSE_UNSIGNED_SHORT) || + return (aVal == VTK_PARSE_SHORT) || (aVal == VTK_PARSE_UNSIGNED_SHORT); +} + +int IsInt(ValueInfo* theType) { + //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); + int aVal = theType->Type & VTK_PARSE_BASE_TYPE; + return (aVal == VTK_PARSE_INT) || + (aVal == VTK_PARSE_ID_TYPE) || (aVal == VTK_PARSE_UNSIGNED_INT) || (aVal == VTK_PARSE_SSIZE_T) || (aVal == VTK_PARSE_SIZE_T); } +int IsShortInt(ValueInfo* theType) { + //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA); + return (IsShort(theType) || IsInt(theType)); +} + void AddShortAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { AddAtomArg(I,Type,"short","Short",Result,CurrPos); } @@ -255,6 +270,10 @@ int IsShortArray(ValueInfo* Type) { return (IsShort(Type) && IsArray(Type)); } +int IsIntArray(ValueInfo* Type) { + return (IsInt(Type) && IsArray(Type)); +} + void AddShortArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) { AddArrayArg(I,Type,"short",Result,CurrPos); } @@ -347,7 +366,7 @@ void AddVoidArg(int I, char *Result, int *CurrPos, ValueInfo* Type) { } void AddTypeArray(ValueInfo* Type, char *Result, int *CurrPos) { - if(IsShort(Type)) + if(IsShortInt(Type)) add_to_sig(Result,"short",CurrPos); if(IsLong(Type)) add_to_sig(Result,"long",CurrPos); @@ -394,7 +413,7 @@ void output_type(char* result, int *currPos, int i, ValueInfo* aType, const char } } - if(IsShort(aType)) { + if(IsShortInt(aType)) { if(IsArray(aType)) { if (IsUnsigned(aType)) add_to_sig(result,"unsigned ",currPos); @@ -427,7 +446,13 @@ void output_type(char* result, int *currPos, int i, ValueInfo* aType, const char add_to_sig(result,"char",currPos); } } else if(IsChar(aType)) { - add_to_sig(result,"CORBA::Char",currPos); + if(IsArray(aType)) { + if (IsUnsigned(aType)) + add_to_sig(result,"unsigned ",currPos); + add_to_sig(result,"char",currPos); + } else { + add_to_sig(result,"CORBA::Char",currPos); + } } if(IsBoolean(aType)) { @@ -503,8 +528,8 @@ void output_temp(char* result, int *currPos, int i, ValueInfo* aType, const char } } - if(IsShort(aType)) { - if(IsShortArray(aType)) { + if(IsShortInt(aType)) { + if(IsArray(aType)) { AddShortArrayArg(i,aType,result,currPos); } else { AddShortAtomArg(i,aType,result,currPos); @@ -523,7 +548,11 @@ void output_temp(char* result, int *currPos, int i, ValueInfo* aType, const char if(IsString(aType)) { AddStringArg(i,result,currPos); } else { - AddCharAtomArg(i,aType,result,currPos); + if(IsCharArray(aType)) { + AddCharArrayArg(i,aType,result,currPos); + } else { + AddCharAtomArg(i,aType,result,currPos); + } } } else if (IsString(aType)) //!!! VSV AddStringArg(i,result,currPos); @@ -862,7 +891,7 @@ void get_signature(const char* num, ClassInfo *data) if(IsClass(aArgVal) && IsPtr(aArgVal)) { add_to_sig(result,"*",&currPos); } - if (IsString(aArgVal) && IsConst(aArgVal)) + if (IsString(aArgVal) && IsConst(aArgVal) && strcmp(aArgVal->Class, "vtkStdString") != 0) sprintf(buf,"checkNullStr(myParam%d)",i); else sprintf(buf,"myParam%d",i); @@ -939,12 +968,18 @@ void get_signature(const char* num, ClassInfo *data) if(IsDouble(aArgVal)) add_to_sig(result,"double",&currPos); + if(IsChar(aArgVal)) { + if (IsUnsigned(aArgVal)) + add_to_sig(result,"unsigned ",&currPos); + add_to_sig(result,"char",&currPos); + } + if(IsvtkIdType(aArgVal)) { if (IsUnsigned(aArgVal)) add_to_sig(result,"unsigned ",&currPos); add_to_sig(result,"vtkIdType",&currPos); } else { - if(IsShort(aArgVal)) { + if(IsShortInt(aArgVal)) { if (IsUnsigned(aArgVal)) add_to_sig(result,"unsigned ",&currPos); add_to_sig(result,"int",&currPos); @@ -965,12 +1000,18 @@ void get_signature(const char* num, ClassInfo *data) if(IsDouble(aArgVal)) add_to_sig(result,"double",&currPos); + if(IsChar(aArgVal)) { + if (IsUnsigned(aArgVal)) + add_to_sig(result,"unsigned ",&currPos); + add_to_sig(result,"char",&currPos); + } + if(IsvtkIdType(aArgVal)) { if (IsUnsigned(aArgVal)) add_to_sig(result,"unsigned ",&currPos); add_to_sig(result,"vtkIdType",&currPos); } else { - if(IsShort(aArgVal)) { + if(IsShortInt(aArgVal)) { if (IsUnsigned(aArgVal)) add_to_sig(result,"unsigned ",&currPos); add_to_sig(result,"int",&currPos); @@ -1042,12 +1083,16 @@ void get_signature(const char* num, ClassInfo *data) } } - if(IsShort(aRetVal)) { + if(IsShortInt(aRetVal)) { if(IsArray(aRetVal)) { if(IsvtkIdType(aRetVal)) { add_to_sig(result,"vtkIdType",&currPos); } else { - add_to_sig(result,"int",&currPos); + if(IsShort(aRetVal)) { + add_to_sig(result,"short",&currPos); + } else { + add_to_sig(result,"int",&currPos); + } } add_to_sig(result,"* a_ret = ",&currPos); } else { diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 548982eb..fa3cfb7e 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -417,6 +417,9 @@ void PVGUI_Module::initialize( CAM_Application* app ) pvCreateToolBars(); pvCreateMenus(); + QList activeDocks = aDesktop->findChildren(); + QList activeMenus = aDesktop->findChildren(); + // new pqParaViewBehaviors(anApp->desktop(), this); // Has to be replaced in order to exclude using of pqQtMessageHandlerBehaviour // Start pqParaViewBehaviors @@ -465,6 +468,24 @@ void PVGUI_Module::initialize( CAM_Application* app ) pqApplicationCore::instance(), SLOT(quickLaunch())); // End pqParaViewBehaviors + // Find Plugin Dock Widgets + QList currentDocks = aDesktop->findChildren(); + QList::iterator i; + for (i = currentDocks.begin(); i != currentDocks.end(); ++i) { + if(!activeDocks.contains(*i)) { + myDockWidgets[*i] = false; // hidden by default + (*i)->hide(); + } + } + + // Find Plugin Menus + QList currentMenus = aDesktop->findChildren(); + QList::iterator im; + for (im = currentMenus.begin(); im != currentMenus.end(); ++im) { + if(!activeMenus.contains(*im)) { + myMenus.append(*im); + } + } SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); QString aPath = resMgr->stringValue("resources", "PARAVIS", QString()); @@ -848,15 +869,22 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) restoreDockWidgetsState(); - QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId ); - if(aMenu) { - QList anActns = aMenu->actions(); - for (int i = 0; i < anActns.size(); ++i) { - QAction* a = anActns.at(i); - if(a) - a->setVisible(true); - } + QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId ); + if(aMenu) { + QList anActns = aMenu->actions(); + for (int i = 0; i < anActns.size(); ++i) { + QAction* a = anActns.at(i); + if(a) + a->setVisible(true); } + } + + QList::iterator it; + for (it = myMenus.begin(); it != myMenus.end(); ++it) { + QAction* a = (*it)->menuAction(); + if(a) + a->setVisible(true); + } if ( myRecentMenuId != -1 ) menuMgr()->show(myRecentMenuId); @@ -874,15 +902,22 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) */ bool PVGUI_Module::deactivateModule( SUIT_Study* study ) { - QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId ); - if(aMenu) { - QList anActns = aMenu->actions(); - for (int i = 0; i < anActns.size(); ++i) { - QAction* a = anActns.at(i); - if(a) - a->setVisible(false); - } + QMenu* aMenu = menuMgr()->findMenu( myRecentMenuId ); + if(aMenu) { + QList anActns = aMenu->actions(); + for (int i = 0; i < anActns.size(); ++i) { + QAction* a = anActns.at(i); + if(a) + a->setVisible(false); } + } + + QList::iterator it; + for (it = myMenus.begin(); it != myMenus.end(); ++it) { + QAction* a = (*it)->menuAction(); + if(a) + a->setVisible(false); + } QList aStreamingViews = application()->desktop()->findChildren("pqStreamingControls"); foreach(QDockWidget* aView, aStreamingViews) { diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 7fe0bf3a..cece9bbf 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -269,6 +269,7 @@ private: WgMap myDockWidgets; WgMap myToolbars; WgMap myToolbarBreaks; + QList myMenus; QStringList myTemporaryFiles; diff --git a/test/VisuPrs/Animation/C8.py b/test/VisuPrs/Animation/C8.py index 00c53e4b..d92d97dc 100644 --- a/test/VisuPrs/Animation/C8.py +++ b/test/VisuPrs/Animation/C8.py @@ -53,7 +53,7 @@ if aView is None : print "Error" else : print "OK" # Gauss Points creation -prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 1 , theMultiplier=0.01) +prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 1 , multiplier=0.01) prs.Visibility=1 aView.ResetCamera() print "Creating an Animation.....................", diff --git a/test/VisuPrs/Animation/D1.py b/test/VisuPrs/Animation/D1.py index d7e40b56..88748a04 100644 --- a/test/VisuPrs/Animation/D1.py +++ b/test/VisuPrs/Animation/D1.py @@ -54,7 +54,7 @@ if aView is None : print "Error" else : print "OK" # Gauss Points creation -prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 2, theMultiplier=0.01) +prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 2, multiplier=0.01) prs.Visibility=1 aView.ResetCamera() print "Creating an Animation.....................", diff --git a/test/VisuPrs/Animation/D2.py b/test/VisuPrs/Animation/D2.py index e67b6bdf..d7f5bd43 100644 --- a/test/VisuPrs/Animation/D2.py +++ b/test/VisuPrs/Animation/D2.py @@ -53,7 +53,7 @@ if aView is None : print "Error" else : print "OK" # Gauss Points creation -prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 2, theMultiplier=0.01) +prs= GaussPointsOnField(aProxy,EntityType.CELL,'pression' , 2, multiplier=0.01) prs.Visibility=1 aView.ResetCamera() print "Creating an Animation.....................", diff --git a/test/VisuPrs/Util/paravistesthelper.py b/test/VisuPrs/Util/paravistesthelper.py index 14fa7c8c..67611a4b 100644 --- a/test/VisuPrs/Util/paravistesthelper.py +++ b/test/VisuPrs/Util/paravistesthelper.py @@ -2,6 +2,7 @@ import searchFreePort import subprocess import sys import signal +import killSalomeWithPort args = {} searchFreePort.searchFreePort(args) @@ -9,10 +10,18 @@ port = args['port'] def timeout_handler(signum, frame): print "FAILED : timeout(" + sys.argv[1] + ") is reached" - import killSalomeWithPort killSalomeWithPort.killMyPort(port) + exit(1) signal.alarm(abs(int(sys.argv[1])-10)) signal.signal(signal.SIGALRM, timeout_handler) -subprocess.check_call([sys.executable]+sys.argv[2:]) +res = 1 +try: + res = subprocess.check_call([sys.executable]+sys.argv[2:]) +except: + pass + +killSalomeWithPort.killMyPort(port) + +exit(res) -- 2.39.2