]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Python console has been added for HYDRO module (Bug #22).
authoradv <adv@opencascade.com>
Fri, 13 Sep 2013 12:48:57 +0000 (12:48 +0000)
committeradv <adv@opencascade.com>
Fri, 13 Sep 2013 12:48:57 +0000 (12:48 +0000)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h

index 62eb052e073daa5bb1bc2b15bcf642863775cbd6..f011cfe9ae6b6bbf4013079be6da1f18d03294f2 100644 (file)
@@ -53,6 +53,7 @@
 
 #include <SALOME_Event.h>
 
+#include <SUIT_Desktop.h>
 #include <SUIT_Study.h>
 #include <SUIT_ViewManager.h>
 
@@ -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<int, int>& 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   );
 }
 
index e224ff808bf4275a0bea639c0d9d41e417369ac7..29d053f046bb210563677941224d417d9c8f979d 100644 (file)
@@ -44,6 +44,7 @@
 #include <SUIT_ViewWindow.h>
 
 #include <QTextCodec>
+#include <QDockWidget>
 
 // 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<QDockWidget*>( w );
+    w = w->parentWidget();
+  }
+  return dock;
+}
index 35ab64743bb4a04479a8022545858a1d3540872f..7c959d8586591d42861957a577d83240d8810f68 100644 (file)
@@ -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