]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bugfix: application after adding python console into main menu
authorSergey BELASH <belash.sergey@opencascade.com>
Mon, 18 Aug 2014 13:31:40 +0000 (17:31 +0400)
committerSergey BELASH <belash.sergey@opencascade.com>
Mon, 18 Aug 2014 13:31:40 +0000 (17:31 +0400)
src/XGUI/XGUI_MainMenu.cpp
src/XGUI/XGUI_MainMenu.h
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_Workbench.cpp

index e35b94a56463a08056266b30ae6bd1e89f1ad116..1bd8d8eb04e6c0cbce5866baf494e2253ee6d12a 100644 (file)
@@ -48,6 +48,7 @@ XGUI_Workbench* XGUI_MainMenu::addWorkbench(const QString& theId, const QString&
   XGUI_Workbench* aPage = new XGUI_Workbench(myMenuTabs);
   aPage->setObjectName(theId);
   myMenuTabs->addTab(aPage, aTitle);
+  myWorkbenches.append(aPage);
   return aPage;
 }
 
@@ -99,8 +100,8 @@ XGUI_Command* XGUI_MainMenu::feature(const QString& theId) const
   XGUI_Command* result;
   result = myGeneralPage->feature(theId);
   if (!result) {
-    for (int aTabIdx = 0; aTabIdx < myMenuTabs->count(); ++aTabIdx) {
-      XGUI_Workbench* aWbn = static_cast<XGUI_Workbench*>(myMenuTabs->widget(aTabIdx));
+    XGUI_Workbench* aWbn;
+    foreach (aWbn, myWorkbenches) {
       result = aWbn->feature(theId);
       if (result) break;
     }
@@ -111,8 +112,8 @@ XGUI_Command* XGUI_MainMenu::feature(const QString& theId) const
 QList<XGUI_Command*> XGUI_MainMenu::features() const
 {
   QList<XGUI_Command*> aList = myGeneralPage->features();
-  for (int aTabIdx = 0; aTabIdx < myMenuTabs->count(); ++aTabIdx) {
-    XGUI_Workbench* aWbn = static_cast<XGUI_Workbench*>(myMenuTabs->widget(aTabIdx));
+  XGUI_Workbench* aWbn;
+  foreach (aWbn, myWorkbenches) {
     aList.append(aWbn->features());
   }
   return aList;
index 29b87063f602f1289d15ce4e23851c7e1086be77..4f3168548bcadfccec684c8ff58e05d57f9c706e 100644 (file)
@@ -78,6 +78,7 @@ private:
   XGUI_MainWindow* myDesktop;
   QTabWidget* myMenuTabs;
   XGUI_MenuGroupPanel* myGeneralPage;
+  QList<XGUI_Workbench*> myWorkbenches;
 
   QMap<XGUI_Command*, bool> myCommandState;
 };
index 3aa696045b5be600507280c70bcc2dd80a1ca208..189f1cd35eabd4d9d0237bdca59133eebaf251dd 100644 (file)
@@ -66,11 +66,12 @@ QMdiArea* XGUI_MainWindow::mdiArea() const
 void XGUI_MainWindow::showPythonConsole()
 {
   // TODO: Check why PyConsole can not be created
-  //if (!myPythonConsole) {
-  //  myPythonConsole = new PyConsole_EnhConsole(this, new PyConsole_EnhInterp());
-  //  undockPythonConsole();
-  //}
-  //myPythonConsole->parentWidget()->show();
+  if (!myPythonConsole) {
+    myPythonConsole = new PyConsole_EnhConsole(this, new PyConsole_EnhInterp());
+    myPythonConsole->setObjectName("PythonConsole");
+    undockPythonConsole();
+  }
+  myPythonConsole->parentWidget()->show();
 }
 
 //******************************************************
index f92380374eb88c32b2494d572f29bd49b276da50..36efadf9f210ca4ddacd1c76192e30e1f04e0e15 100644 (file)
@@ -188,8 +188,8 @@ XGUI_Command* XGUI_Workbench::feature(const QString& theId) const
 QList<XGUI_Command*> XGUI_Workbench::features() const
 {
   QList<XGUI_Command*> aList;
-  QList<XGUI_MenuGroupPanel*>::const_iterator aIt;
-  for (aIt = myGroups.constBegin(); aIt != myGroups.constEnd(); ++aIt) 
-    aList.append((*aIt)->features());
+  foreach (XGUI_MenuGroupPanel* aGroup, myGroups) {
+    aList.append(aGroup->features());
+  }
   return aList;
 }