From: vsr Date: Mon, 27 Feb 2006 15:09:24 +0000 (+0000) Subject: Dynamic menus in Python: X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e79b5352d5ee50b1606beae6a8fc6695c7fb824b;p=modules%2Fgui.git Dynamic menus in Python: * support an additional "id" parameter for createMenu() method in Python --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index d7b887fe6..4385a6def 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -1045,10 +1045,10 @@ int SalomePyQt::createTool( QtxAction* a, const QString& tBar, const int id, con class CrMenu { public: - CrMenu( const QString& subMenu, const int menu, const int group, const int idx ) - : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {} - CrMenu( const QString& subMenu, const QString& menu, const int group, const int idx ) - : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {} + CrMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx ) + : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} + CrMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx ) + : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} CrMenu( const int id, const int menu, const int group, const int idx ) : myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {} CrMenu( const int id, const QString& menu, const int group, const int idx ) @@ -1063,9 +1063,9 @@ public: if ( module ) { switch ( myCase ) { case 0: - return module->createMenu( mySubMenuName, myMenuId, -1, myGroup, myIndex ); + return module->createMenu( mySubMenuName, myMenuId, myId, myGroup, myIndex ); case 1: - return module->createMenu( mySubMenuName, myMenuName, -1, myGroup, myIndex ); + return module->createMenu( mySubMenuName, myMenuName, myId, myGroup, myIndex ); case 2: return module->createMenu( myId, myMenuId, myGroup, myIndex ); case 3: @@ -1104,14 +1104,14 @@ public: } } }; -int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int group, const int idx ) +int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx ) { - return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) ); + return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) ); } -int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int group, const int idx ) +int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx ) { - return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, group, idx ) ) ); + return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) ); } int SalomePyQt::createMenu( const int id, const int menu, const int group, const int idx ) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 51f245f23..b623cc14f 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -109,9 +109,9 @@ public: static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ); static int createMenu( const QString&, const int = -1, - const int = -1, const int = -1 ); + const int = -1, const int = -1, const int = -1 ); static int createMenu( const QString&, const QString& = QString::null, - const int = -1, const int = -1 ); + const int = -1, const int = -1, const int = -1 ); static int createMenu( const int, const int = -1, const int = -1, const int = -1 ); static int createMenu( const int, const QString& = QString::null, diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 3824647dd..5fa6e87fa 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -88,9 +88,9 @@ public: static int createTool( QtxAction*, const QString&, int = -1, int = -1 ); static int createMenu( const QString&, const int, - int = -1, int = -1 ); + int = -1, int = -1, int = -1 ); static int createMenu( const QString&, const QString&, - int = -1, int = -1 ); + int = -1, int = -1, int = -1 ); static int createMenu( const int, const int, int = -1, int = -1 ); static int createMenu( const int, const QString&, diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip index f306399b1..dbf98f4e5 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip @@ -74,8 +74,8 @@ public: static void updateObjBrowser( const int = 0, bool = true ); static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ; - static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ); - static QString getExistingDirectory( QWidget*, const QString&, const QString& ); + static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ; + static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ; static void helpContext( const QString&, const QString& ); @@ -88,9 +88,9 @@ public: static int createTool( QtxAction*, const QString&, const int = -1, const int = -1 ); static int createMenu( const QString&, const int, - const int = -1, const int = -1 ); + const int = -1, const int = -1, const int = -1 ); static int createMenu( const QString&, const QString&, - const int = -1, const int = -1 ); + const int = -1, const int = -1, const int = -1 ); static int createMenu( const int, const int, const int = -1, const int = -1 ); static int createMenu( const int, const QString&,