From: adv Date: Fri, 13 Sep 2013 12:48:57 +0000 (+0000) Subject: Python console has been added for HYDRO module (Bug #22). X-Git-Tag: BR_hydro_v_0_1~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc73e2b2e8db52dbea7aab9ade159daef696d95f;p=modules%2Fhydro.git Python console has been added for HYDRO module (Bug #22). --- diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 62eb052e..f011cfe9 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -53,6 +53,7 @@ #include +#include #include #include @@ -110,9 +111,17 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) { bool aRes = LightApp_Module::activateModule( theStudy ); + LightApp_Application* anApp = getApp(); + SUIT_Desktop* aDesktop = anApp->desktop(); + setMenuShown( true ); setToolShown( true ); +#ifndef DISABLE_PYCONSOLE + aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ), + HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) ); +#endif + update( UF_All ); updateCommandsStatus(); @@ -140,6 +149,9 @@ void HYDROGUI_Module::windows( QMap& theMap ) const { theMap.clear(); theMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea ); +#ifndef DISABLE_PYCONSOLE + theMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +#endif theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); } diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index e224ff80..29d053f0 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -44,6 +44,7 @@ #include #include +#include // Definition of this id allows to use 'latin1' (Qt alias for 'ISO-8859-1') // encoding instead of default 'System' @@ -392,3 +393,19 @@ void HYDROGUI_Tool::GetObjectBackReferences( HYDROGUI_Module* theModule, } } } + + +QDockWidget* HYDROGUI_Tool::WindowDock( QWidget* wid ) +{ + if ( !wid ) + return 0; + + QDockWidget* dock = 0; + QWidget* w = wid->parentWidget(); + while ( w && !dock ) + { + dock = ::qobject_cast( w ); + w = w->parentWidget(); + } + return dock; +} diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 35ab6474..7c959d85 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -39,6 +39,8 @@ class HYDROGUI_DataModel; class HYDROGUI_Module; class HYDROGUI_Prs; +class QDockWidget; + /** * \class HYDROGUI_Tool * \brief This class contains several useful methods. @@ -211,6 +213,14 @@ public: const Handle(HYDROData_Object)& theObj, HYDROData_SequenceOfObjects& theBackRefObjects, QStringList& theBackRefNames ); + + /** + * \brief Get father dock window for widget + * \param wid widget + * \return dock window + */ + static QDockWidget* WindowDock( QWidget* wid ); + }; #endif