+
+
+/*!
+ \fn QString SalomePyQt::createObject( const QString& parent );
+ \brief Create empty data object
+ \param parent entry of parent data object
+ \return entry of created data object
+*/
+
+class TCreateEmptyObjectEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myParent;
+ TCreateEmptyObjectEvent( const QString& parent )
+ : myParent( parent ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->createObject( myParent );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.createObject() function is not supported for the current module.\n" );
+ }
+ }
+};
+QString SalomePyQt::createObject( const QString& parent )
+{
+ return ProcessEvent( new TCreateEmptyObjectEvent( parent ) );
+}
+
+/*!
+ \fn QString SalomePyQt::createObject( const QString& name, const QString& icon,
+ const QString& tooltip,const QString& parent );
+ \brief Create new data object with specified name, icon and tooltip
+ \param name data object name
+ \param icon data object icon
+ \param toolTip data object tooltip
+ \param parent entry of parent data object
+ \return entry of created data object
+*/
+
+class TCreateObjectEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myParent;
+ QString myName;
+ QString myIcon;
+ QString myToolTip;
+ TCreateObjectEvent( const QString& name,
+ const QString& icon,
+ const QString& tooltip,
+ const QString& parent )
+ : myName( name ),
+ myIcon( icon ),
+ myToolTip( tooltip ),
+ myParent( parent ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->createObject( myName, myIcon, myToolTip, myParent );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.createObject() function is not supported for the current module.\n" );
+ }
+ }
+};
+QString SalomePyQt::createObject( const QString& name,
+ const QString& icon,
+ const QString& toolTip,
+ const QString& parent )
+{
+ return ProcessEvent( new TCreateObjectEvent( name, icon, toolTip, parent ) );
+}
+
+
+/*!
+ \fn void SalomePyQt::setName( const QString& entry, const QString& name );
+ \brief Set data object name
+ \param entry data object entry
+ \param name data object name
+*/
+class TSetNameEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ QString myName;
+ TSetNameEvent( const QString& entry,
+ const QString& name )
+ : myEntry( entry ),
+ myName( name ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->setName( myEntry, myName );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.setName() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::setName( const QString& entry, const QString& name )
+{
+ ProcessVoidEvent( new TSetNameEvent( entry, name ) );
+}
+
+/*!
+ \fn void SalomePyQt::setIcon( const QString& entry, const QString& icon );
+ \brief Set data object icon
+ \param entry data object entry
+ \param icon data object icon file name (icon is loaded from module resources)
+*/
+
+class TSetIconEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ QString myIcon;
+ TSetIconEvent( const QString& entry,
+ const QString& icon )
+ : myEntry( entry ),
+ myIcon( icon ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->setIcon( myEntry, myIcon );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.setIcon() function is not supported for the current module.\n" );
+ }
+ }
+};
+
+void SalomePyQt::setIcon( const QString& entry, const QString& icon )
+{
+ ProcessVoidEvent( new TSetIconEvent( entry, icon ) );
+}
+
+/*!
+ \fn void SalomePyQt::setToolTip( const QString& entry, const QString& toolTip );
+ \brief Set data object tooltip
+ \param entry data object entry
+ \param toolTip data object tooltip
+*/
+
+class TSetToolTipEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ QString myToolTip;
+ TSetToolTipEvent( const QString& entry,
+ const QString& toolTip )
+ : myEntry( entry ),
+ myToolTip( toolTip ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->setToolTip( myEntry, myToolTip );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.setToolTip() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::setToolTip( const QString& entry, const QString& toolTip )
+{
+ ProcessVoidEvent( new TSetToolTipEvent( entry, toolTip ) );
+}
+
+/*!
+ \fn void SalomePyQt::setReference( const QString& entry, const QString& refEntry );
+ \brief Set reference to another data object
+ \param entry data object entry
+ \param refEntry referenced data object entry
+*/
+
+class TSetRefEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ QString myRefEntry;
+ TSetRefEvent( const QString& entry,
+ const QString& refEntry )
+ : myEntry( entry ),
+ myRefEntry( refEntry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->setReference( myEntry, myRefEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.setReference() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::setReference( const QString& entry, const QString& refEntry )
+{
+ ProcessVoidEvent( new TSetRefEvent( entry, refEntry ) );
+}
+
+/*!
+ \fn void SalomePyQt::setColor( const QString& entry, const QColor& color );
+ \brief Set data object color
+ \param entry data object entry
+ \param color data object color
+ */
+
+class TSetColorEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ QColor myColor;
+ TSetColorEvent( const QString& entry,
+ const QColor& color )
+ : myEntry( entry ),
+ myColor( color ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->setColor( myEntry, myColor );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.setColor() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::setColor( const QString& entry, const QColor& color )
+{
+ ProcessVoidEvent( new TSetColorEvent( entry, color ) );
+}
+
+/*!
+ \fn QString SalomePyQt::getName( const QString& entry );
+ \brief Get data object name
+ \param entry data object entry
+ \return data object name
+*/
+
+class TGetNameEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetNameEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getName( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getName() function is not supported for the current module.\n" );
+ }
+ }
+};
+QString SalomePyQt::getName( const QString& entry )
+{
+ return ProcessEvent( new TGetNameEvent( entry ) );
+}
+
+/*!
+ \fn QString SalomePyQt::getToolTip( const QString& entry );
+ \brief Get data object tooltip
+ \param entry data object entry
+ \return data object tooltip
+*/
+
+class TGetToolTipEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetToolTipEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getToolTip( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getToolTip() function is not supported for the current module.\n" );
+ }
+ }
+};
+QString SalomePyQt::getToolTip( const QString& entry )
+{
+ return ProcessEvent( new TGetToolTipEvent( entry ) );
+}
+
+/*
+ \fn QString SalomePyQt::getReference( const QString& entry );
+ \brief Get entry of the referenced object (if there's any)
+ \param entry data object entry
+ \return referenced data object entry
+*/
+
+class TGetRefEvent: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetRefEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getReference( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getReference() function is not supported for the current module.\n" );
+ }
+ }
+};
+QString SalomePyQt::getReference( const QString& entry )
+{
+ return ProcessEvent( new TGetRefEvent( entry ) );
+}
+
+/*!
+ \fn QColor SalomePyQt::getColor( const QString& entry );
+ \brief Get data object color
+ \param entry data object entry
+ \return data object color
+*/
+
+class TGetColorEvent: public SALOME_Event
+{
+public:
+ typedef QColor TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetColorEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getColor( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getColor() function is not supported for the current module.\n" );
+ }
+ }
+};
+QColor SalomePyQt::getColor( const QString& entry )
+{
+ return ProcessEvent( new TGetColorEvent( entry ) );
+}
+
+/*!
+ \fn void SalomePyQt::removeChildren( const QString& entry );
+ \brief Remove all child data objects from specified data object
+ \param entry data object entry
+*/
+
+class TRemoveChildEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+ TRemoveChildEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->removeChildren( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.removeChildren() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::removeChildren( const QString& entry )
+{
+ ProcessVoidEvent( new TRemoveChildEvent( entry ) );
+}
+void SalomePyQt::removeChild( const QString& entry )
+{
+ if ( verbose() ) printf( "SalomePyQt.removeChild() function is obsolete. Use SalomePyQt.removeChildren() instead." );
+ removeChildren( entry );
+}
+
+/*!
+ \fn void SalomePyQt::removeObject( const QString& entry );
+ \brief Remove object by entry
+ \param entry data object entry
+*/
+
+class TRemoveObjectEvent: public SALOME_Event
+{
+public:
+ QString myEntry;
+
+ TRemoveObjectEvent( const QString& entry )
+ : myEntry( entry ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ module->removeObject( myEntry );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.removeObject() function is not supported for the current module.\n" );
+ }
+ }
+};
+void SalomePyQt::removeObject( const QString& entry )
+{
+ ProcessVoidEvent( new TRemoveObjectEvent( entry ) );
+}
+
+/*!
+ \fn QStringList SalomePyQt::getChildren( const QString& entry, const bool recursive );
+ \brief Get entries of all child data objects of specified data object
+ \param entry data object entry
+ \param recursive \c true for recursive processing
+*/
+
+class TGetChildrenEvent: public SALOME_Event
+{
+public:
+ typedef QStringList TResult;
+ TResult myResult;
+ QString myEntry;
+ bool myRecursive;
+ TGetChildrenEvent( const QString& entry, const bool recursive )
+ : myEntry( entry ),
+ myRecursive( recursive ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getChildren( myEntry, myRecursive );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getChildren() function is not supported for the current module.\n" );
+ }
+ }
+};
+QStringList SalomePyQt::getChildren( const QString& entry, const bool recursive )
+{
+ return ProcessEvent( new TGetChildrenEvent( entry, recursive ) );
+}
+
+
+/*!
+ \fn void SalomePyQt::displayCurve( const int id, Plot2d_Curve* theCurve )
+ \brief Display theCurve in view
+ \param id window identifier
+ \param theCurve curve to display
+*/
+
+class TDisplayCurve: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ TDisplayCurve(const int id, Plot2d_Curve* theCurve) : myWndId(id), myCurve(theCurve) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ wnd->getViewFrame()->displayCurve(myCurve);
+ }
+ }
+};
+void SalomePyQt::displayCurve(const int id, Plot2d_Curve* theCurve)
+{
+ ProcessVoidEvent( new TDisplayCurve(id, theCurve) );
+}
+
+/*!
+ \fn void SalomePyQt::eraseCurve( const int id, Plot2d_Curve* theCurve )
+ \brief Erase theCurve in view
+ \param id window identifier
+ \param theCurve curve to erase
+*/
+
+class TEraseCurve: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ TEraseCurve(const int id, Plot2d_Curve* theCurve) : myWndId(id), myCurve(theCurve) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ wnd->getViewFrame()->eraseCurve(myCurve);
+ }
+ }
+};
+void SalomePyQt::eraseCurve(const int id, Plot2d_Curve* theCurve)
+{
+ ProcessVoidEvent( new TEraseCurve(id, theCurve) );
+}
+
+/*!
+ \fn void SalomePyQt::deleteCurve( Plot2d_Curve* theCurve )
+ \brief Delete theCurve from all views
+ \param theCurve curve to delete
+*/
+
+class TDeleteCurve: public SALOME_Event
+{
+public:
+ Plot2d_Curve* myCurve;
+ TDeleteCurve(Plot2d_Curve* theCurve) : myCurve(theCurve) {}
+ virtual void Execute() {
+ LightApp_Application* app = getApplication();
+ if ( app )
+ {
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( tabDesk )
+ {
+ QList<SUIT_ViewWindow*> wndlist = tabDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndlist )
+ {
+ Plot2d_ViewWindow* aP2d = dynamic_cast<Plot2d_ViewWindow*>(wnd);
+ if(aP2d)
+ {
+ aP2d->getViewFrame()->eraseObject(myCurve);
+ }
+ }
+ }
+ }
+ }
+};
+void SalomePyQt::eraseCurve(Plot2d_Curve * theCurve)
+{
+ ProcessVoidEvent( new TDeleteCurve(theCurve) );
+}
+
+/*!
+ \brief updateCurves (repaint) curves in view window.
+*/
+void SalomePyQt::updateCurves(const int id)
+{
+ class TEvent: public SALOME_Event
+ {
+ public:
+ int myWndId;
+ TEvent( const int id ) : myWndId( id ) {}
+ virtual void Execute()
+ {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ wnd->getViewFrame()->DisplayAll();
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent(id) );
+}
+
+/*!
+ \fn QString SalomePyQt::getPlot2dTitle( const int id, ObjectType type = MainTitle )
+ \brief Get title of corresponding type
+ \param id window identifier
+ \param type is type of title
+ \return title of corresponding type
+*/
+
+class TGetPlot2dTitle: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ int myWndId;
+ ObjectType myType;
+ TGetPlot2dTitle(const int id, ObjectType type) :
+ myWndId(id),
+ myType(type) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ myResult = wnd->getViewFrame()->getTitle((Plot2d_ViewFrame::ObjectType)myType);
+ }
+ }
+};
+QString SalomePyQt::getPlot2dTitle(const int id, ObjectType type)
+{
+ return ProcessEvent( new TGetPlot2dTitle(id, type) );
+}
+
+
+/*!
+ \fn void SalomePyQt::setPlot2dTitle( const int id, const QString& title, ObjectType type = MainTitle, bool show = true )
+ \brief Set title of corresponding type
+ \param id window identifier
+ \param title
+ \param type is type of title
+ \param show
+*/
+
+class TSetPlot2dTitle: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ QString myTitle;
+ ObjectType myType;
+ bool myShow;
+ TSetPlot2dTitle(const int id, const QString& title, ObjectType type, bool show) :
+ myWndId(id),
+ myTitle(title),
+ myType(type),
+ myShow(show) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ wnd->getViewFrame()->setTitle(myShow, myTitle, (Plot2d_ViewFrame::ObjectType)myType, false);
+ }
+ }
+};
+void SalomePyQt::setPlot2dTitle(const int id, const QString& title, ObjectType type, bool show)
+{
+ ProcessVoidEvent( new TSetPlot2dTitle(id, title, type, show) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::getPlot2dFitRangeByCurves( const int id )
+ \brief Get list of Plot2d view ranges
+ \param id window identifier
+ \return list of view ranges (XMin, XMax, YMin, YMax)
+*/
+
+class TFitRangeByCurves: public SALOME_Event
+{
+public:
+ typedef QList<double> TResult;
+ TResult myResult;
+ int myWndId;
+ TFitRangeByCurves( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ double XMin, XMax, YMin, YMax, Y2Min, Y2Max;
+ wnd->getViewFrame()->getFitRangeByCurves(XMin, XMax, YMin, YMax, Y2Min, Y2Max);
+ myResult.append(XMin);
+ myResult.append(XMax);
+ myResult.append(YMin);
+ myResult.append(YMax);
+ }
+ }
+};
+QList<double> SalomePyQt::getPlot2dFitRangeByCurves( const int id )
+{
+ return ProcessEvent( new TFitRangeByCurves( id ) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::getPlot2dFitRangeCurrent( const int id )
+ \brief Get list of current Plot2d view ranges
+ \param id window identifier
+ \return list of view ranges (XMin, XMax, YMin, YMax)
+*/
+
+class TFitRangeCurrent: public SALOME_Event
+{
+public:
+ typedef QList<double> TResult;
+ TResult myResult;
+ int myWndId;
+ TFitRangeCurrent( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ double XMin, XMax, YMin, YMax, Y2Min, Y2Max;
+ wnd->getViewFrame()->getFitRanges(XMin, XMax, YMin, YMax, Y2Min, Y2Max);
+ myResult.append(XMin);
+ myResult.append(XMax);
+ myResult.append(YMin);
+ myResult.append(YMax);
+ }
+ }
+};
+QList<double> SalomePyQt::getPlot2dFitRangeCurrent( const int id )
+{
+ return ProcessEvent( new TFitRangeCurrent( id ) );
+}
+
+/*!
+ \fn void SalomePyQt::setPlot2dFitRange( const int id, const double XMin, const double XMax, const double YMin, const double YMax )
+ \brief Set range of Plot2d view
+ \param id window identifier
+ \param XMin
+ \param XMax
+ \param YMin
+ \param YMax
+*/
+
+class TPlot2dFitRange: public SALOME_Event
+{
+public:
+ int myWndId;
+ double myXMin;
+ double myXMax;
+ double myYMin;
+ double myYMax;
+ TPlot2dFitRange(const int id, const double XMin, const double XMax, const double YMin, const double YMax) :
+ myWndId(id),
+ myXMin(XMin),
+ myXMax(XMax),
+ myYMin(YMin),
+ myYMax(YMax) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>(getWnd( myWndId ));
+ if ( wnd )
+ {
+ wnd->getViewFrame()->fitData(0, myXMin, myXMax, myYMin, myYMax);
+ }
+ }
+};
+void SalomePyQt::setPlot2dFitRange(const int id, const double XMin, const double XMax, const double YMin, const double YMax)
+{
+ ProcessVoidEvent( new TPlot2dFitRange(id, XMin, XMax, YMin, YMax) );
+}
+
+//class TInitParaview: public SALOME_Event
+//{
+//public:
+// TInitParaview() {}
+// virtual void Execute() {
+// LightApp_Application* anApp = getApplication();
+// // Create PVViewer_ViewManager, which will initialize ParaView stuff
+// PVViewer_ViewManager* viewMgr =
+// dynamic_cast<PVViewer_ViewManager*>( anApp->getViewManager( PVViewer_Viewer::Type(), true ) );
+// }
+//};
+//void SalomePyQt::initializeParaViewGUI()
+//{
+// ProcessVoidEvent( new TInitParaview() );
+//}
+
+void SalomePyQt::processEvents()
+{
+ QCoreApplication::processEvents();
+}
+
+void SalomePyQt::setVisibilityState( const QString& theEntry, VisibilityState theState)
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myEntry;
+ int myState;
+ public:
+ TEvent( const QString& theEntry, int theState):
+ myEntry(theEntry), myState(theState) {}
+ virtual void Execute()
+ {
+ LightApp_Study* aStudy = getActiveStudy();
+ if ( !aStudy )
+ return;
+ aStudy->setVisibilityState(myEntry, (Qtx::VisibilityState)myState);
+ }
+ };
+ ProcessVoidEvent( new TEvent(theEntry, theState ) );
+}
+
+class TGetVisibilityStateEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetVisibilityStateEvent(const QString& theEntry) : myResult( 0 ), myEntry(theEntry) {}
+ virtual void Execute()
+ {
+ LightApp_Study* aStudy = getActiveStudy();
+ if ( aStudy )
+ myResult = aStudy->visibilityState(myEntry);
+ }
+};
+
+VisibilityState SalomePyQt::getVisibilityState( const QString& theEntry )
+{
+ return (VisibilityState) ProcessEvent( new TGetVisibilityStateEvent(theEntry) );
+}
+
+
+void SalomePyQt::setObjectPosition( const QString& theEntry, int thePos )
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myEntry;
+ int myPos;
+ public:
+ TEvent( const QString& theEntry, int thePos):
+ myEntry(theEntry), myPos(thePos) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module )
+ module->setObjectPosition(myEntry, myPos );
+ }
+ };
+ ProcessVoidEvent( new TEvent(theEntry, thePos ) );
+}
+
+
+
+class TGetObjectPositionEvent: public SALOME_Event
+{
+public:
+ typedef int TResult;
+ TResult myResult;
+ QString myEntry;
+ TGetObjectPositionEvent(const QString& theEntry) : myResult( 0 ), myEntry(theEntry) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module )
+ myResult = module->getObjectPosition(myEntry);
+ }
+};
+
+int SalomePyQt::getObjectPosition( const QString& theEntry )
+{
+ return ProcessEvent( new TGetObjectPositionEvent(theEntry) );
+}
+
+void SalomePyQt::startPyLog(const QString& theFileName)
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myFileName;
+ public:
+ TEvent( const QString& theFileName ):
+ myFileName( theFileName ) {}
+ virtual void Execute()
+ {
+ if ( getApplication() ) {
+ PyConsole_Console* pyConsole = getApplication()->pythonConsole( false );
+ if ( pyConsole ) pyConsole->startLog( myFileName );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theFileName ) );
+}
+
+void SalomePyQt::stopPyLog()
+{
+ class TEvent: public SALOME_Event
+ {
+ public:
+ TEvent() {}
+ virtual void Execute()
+ {
+ if ( getApplication() ) {
+ PyConsole_Console* pyConsole = getApplication()->pythonConsole( false );
+ if ( pyConsole ) pyConsole->stopLog();
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}