#include <QPaintEvent>
#include <QCoreApplication>
+#include <utilities.h>
namespace
{
/*!
return sel;
}
+
/*!
\brief Constructor.
\param p parent object
return ProcessEvent( new TGetSelectionEvent() );
}
+/*!
+ \fn QStringList* SalomePyQt::setSelection(const QStringList& );
+ \brief Send local selection for notification.
+
+ The list of locally selected objects (study entries) is sent for notification of
+ other listening entities (modules, viewers...).
+*/
+
+class TSetSelectionEvent: public SALOME_Event
+{
+ QStringList myEntryList;
+public:
+ TSetSelectionEvent(const QStringList& entryList) : myEntryList(entryList) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( !module ) return;
+ module->setLocalSelected(myEntryList);
+ }
+};
+void SalomePyQt::setSelection( const QStringList& entryList)
+{
+ return ProcessVoidEvent( new TSetSelectionEvent(entryList) );
+}
+
/*!
\fn void SalomePyQt::putInfo( const QString& msg, const int sec );
\brief Put an information message to the current application's
return ProcessEvent( new THasSettingEvent( section, name ) );
}
+/*!
+ \fn QStringList SalomePyQt::parameters( const QString& section );
+ \brief Get names of preference items stored within the given section.
+ \param section resources file section's name
+ \return \c list of preferences items
+*/
+
+/*!
+ \fn QStringList SalomePyQt::parameters( const QStringList& section );
+ \brief Get names of preference items stored within the given section.
+ \param section resources file section's name
+ \return \c list of preferences items
+*/
+
+class TParametersEvent: public SALOME_Event
+{
+public:
+ typedef QStringList TResult;
+ TResult myResult;
+ QStringList mySection;
+ TParametersEvent( const QString& section )
+ {
+ mySection << section;
+ }
+ TParametersEvent( const QStringList& section )
+ : mySection( section )
+ {}
+ virtual void Execute()
+ {
+ if ( SUIT_Session::session() ) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ myResult = resMgr->parameters( mySection );
+ }
+ }
+};
+QStringList SalomePyQt::parameters( const QString& section )
+{
+ return ProcessEvent( new TParametersEvent( section ) );
+}
+QStringList SalomePyQt::parameters( const QStringList& section )
+{
+ return ProcessEvent( new TParametersEvent( section ) );
+}
+
/*!
\fn QString SalomePyQt::getFileName( QWidget* parent,
const QString& initial,
for ( int i = 0, n = vec.size(); i < n; i++ ) {
SUIT_ViewWindow* wnd = vec[ i ];
if ( wnd )
- myResult.append( wnd->getId() );
+ {
+ MESSAGE("SUIT_ViewWindow*: "<< wnd << " id: " << wnd->getId());
+ myResult.append( wnd->getId() );
+ }
}
}
}
virtual void Execute()
{
SUIT_ViewWindow* wnd = getWnd( myWndId );
+ MESSAGE("window id:" << myWndId << " SUIT_ViewWindow*: " << wnd);
if ( wnd ) {
wnd->setFocus();
myResult = true;
return ProcessEvent( new TActivateView( id ) );
}
+/*!
+ *
+ */
+
+class TActivateViewManagerAndView: public SALOME_Event
+{
+public:
+ typedef bool TResult;
+ TResult myResult;
+ int myWndId;
+ TActivateViewManagerAndView( const int id )
+ : myResult( false ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ MESSAGE("window id:" << myWndId << " SUIT_ViewWindow*: " << wnd);
+ if ( wnd )
+ {
+ LightApp_Application* app = getApplication();
+ app->setActiveViewManager(wnd->getViewManager());
+ wnd->setFocus();
+ myResult = true;
+ }
+ }
+};
+bool SalomePyQt::activateViewManagerAndView( const int id )
+{
+ return ProcessEvent( new TActivateViewManagerAndView( id ) );
+}
+
+/*!
+ *
+ */
+
+class TGetViewWidget: public SALOME_Event
+{
+public:
+ typedef QWidget* TResult;
+ TResult myResult;
+ int myWndId;
+ TGetViewWidget( const int id )
+ : myResult( 0 ),
+ myWndId( id ) {}
+ virtual void Execute()
+ {
+ SUIT_ViewWindow* wnd = getWnd( myWndId );
+ if ( wnd ) {
+ myResult = (QWidget*)wnd;
+ }
+ }
+};
+QWidget* SalomePyQt::getViewWidget( const int id)
+{
+ return ProcessEvent( new TGetViewWidget( id ) );
+}
+
+
/*!
\fn int SalomePyQt::createView( const QString& type, bool visible = true, const int width = 0, const int height = 0 );
\brief Create new view and activate it
}
+/*!
+ \fn void SalomePyQt::createRoot();
+ \brief Initialize root data object.
+
+ Does nothing if root is already initialized.
+*/
+
+void SalomePyQt::createRoot()
+{
+ class TEvent: public SALOME_Event
+ {
+ public:
+ TEvent() {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ SALOME_PYQT_DataModelLight* dm =
+ dynamic_cast<SALOME_PYQT_DataModelLight*>( module->dataModel() );
+ if ( dm )
+ dm->getRoot();
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.createRoot() function is not supported for the current module.\n" );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
+
/*!
\fn QString SalomePyQt::createObject( const QString& parent );
\brief Create empty data object