]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
bos #29098: Help panel for SHAPER module
authorvsv <vsv@opencascade.com>
Tue, 31 May 2022 12:01:35 +0000 (15:01 +0300)
committervsv <vsv@opencascade.com>
Tue, 31 May 2022 12:03:05 +0000 (15:03 +0300)
src/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h
src/SHAPERGUI/SHAPERGUI_msg_fr.ts

index daa467a94f7d3b7eef77870808ea5c320d141461..0e889865096ab7b70100027cc3c4222bf6f614d8 100644 (file)
@@ -61,6 +61,7 @@
 #include <QtxActionMenuMgr.h>
 #include <QtxActionToolMgr.h>
 #include <QtxResourceMgr.h>
+#include <QtxInfoPanel.h>
 
 #include <Config_PropManager.h>
 #include <Config_ModuleReader.h>
@@ -242,6 +243,7 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
 void SHAPERGUI::windows(QMap<int, int>& theWndMap) const
 {
   theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
+  theWndMap.insert(LightApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
 }
 
 //******************************************************
@@ -389,7 +391,7 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
           this, SLOT(onSaveDocByShaper()));
   connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
           this, SLOT(onSaveAsDocByShaper()));
-
+  updateInfoPanel();
   return isDone;
 }
 
@@ -590,6 +592,11 @@ void SHAPERGUI::onSaveAsDocByShaper()
 void SHAPERGUI::onUpdateCommandStatus()
 {
   getApp()->updateActions();
+
+  LightApp_Application* aApp = dynamic_cast<LightApp_Application*>(application());
+  QtxInfoPanel* aInfoPanel = aApp->infoPanel();
+  if (aInfoPanel->isVisible())
+    updateInfoPanel();
 }
 
 //******************************************************
@@ -1291,3 +1298,90 @@ void SHAPERGUI::publishToStudy()
     getApp()->updatePresentations("SHAPERSTUDY", aVMList);
   }
 }
+
+void SHAPERGUI::fillPartSetInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Part set mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Parts management"),
+    { "Part", "Duplicate", "Remove" });
+  addActionsToInfoGroup(theInfoPanel, tr("Import operations"),
+    { "OPEN_CMD", "IMPORT_PART_CMD", "IMPORT_SHAPE_CMD" });
+  addActionsToInfoGroup(theInfoPanel, tr("Export operations"),
+    { "SAVEAS_CMD", "EXPORT_PART_CMD", "EXPORT_SHAPE_CMD" });
+  addActionsToInfoGroup(theInfoPanel, tr("Arrangement of parts"),
+    { "Placement", "Translation", "Rotation" });
+}
+
+void SHAPERGUI::fillPartInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Part mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Primitives"),
+    { "Box", "Cylinder", "Sphere" });
+  addActionsToInfoGroup(theInfoPanel, tr("Geometry"),
+    { "Vertex", "Edge", "Wire", "Face" });
+  addActionsToInfoGroup(theInfoPanel, tr("Features"),
+    { "Extrusion", "Revolution", "Cut", "Fuse", "Fillet" });
+}
+
+void SHAPERGUI::fillSketcherInfoPanel(QtxInfoPanel* theInfoPanel)
+{
+  QIntList aShaperActions = shaperActions();
+  theInfoPanel->addLabel(tr("Current mode: Sketcher mode"));
+
+  addActionsToInfoGroup(theInfoPanel, tr("Primitives"),
+    { "SketchPoint", "SketchLine", "SketchCircle", "SketchRectangle" });
+  addActionsToInfoGroup(theInfoPanel, tr("Dimensions"),
+    { "SketchConstraintLength", "SketchConstraintRadius", "SketchConstraintAngle" });
+  addActionsToInfoGroup(theInfoPanel, tr("Constraints"),
+    { "SketchConstraintParallel", "SketchConstraintPerpendicular",
+    "SketchConstraintEqual", "SketchConstraintCoincidence" });
+}
+
+void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel* theInfoPanel,
+  const QString& theGroup, const QSet<QString>& theActions)
+{
+  QIntList aShaperActions = shaperActions();
+
+  int aGroup = theInfoPanel->addGroup(theGroup);
+  int aCount = 0;
+  foreach(int aCmd, aShaperActions) {
+    QAction* aAction = action(aCmd);
+    if (theActions.contains(aAction->data().toString()))
+    {
+      theInfoPanel->addAction(aAction, aGroup);
+      aCount++;
+    }
+    if (aCount >= theActions.size())
+      break;
+  }
+}
+
+void SHAPERGUI::updateInfoPanel()
+{
+  LightApp_Application* aApp = dynamic_cast<LightApp_Application*>(application());
+  QtxInfoPanel* aInfoPanel = aApp->infoPanel();
+  aInfoPanel->clear();
+  aInfoPanel->setTitle(tr("Welcome to SHAPER"));
+
+  SessionPtr aMgr = ModelAPI_Session::get();
+  QList<DocumentPtr> aDocs;
+  DocumentPtr aActiveDoc = aMgr->activeDocument();
+  DocumentPtr aModuleDoc = aMgr->moduleDocument();
+
+  XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
+  QStringList aOpList = aOpMgr->operationList();
+  bool isSketcher = false;
+  if (aOpList.size() > 0)
+    isSketcher = (aOpList.first() == "Sketch");
+
+  if (aActiveDoc == aModuleDoc) // Part set mode
+    fillPartSetInfoPanel(aInfoPanel);
+  else if (isSketcher) // Sketcher mode
+    fillSketcherInfoPanel(aInfoPanel);
+  else // Part mode
+    fillPartInfoPanel(aInfoPanel);
+}
index c0dfcc411f13077bc467fd9dffb00d50510f24a7..1135d894ec837495ae1a9893adf4c1e872b77ba8 100644 (file)
@@ -35,6 +35,7 @@ class XGUI_Workshop;
 class SHAPERGUI_OCCSelector;
 class OCCViewer_Viewer;
 class CAM_Study;
+class QtxInfoPanel;
 
 /** 
  * \ingroup Salome
@@ -173,6 +174,8 @@ Q_OBJECT
 
   void publishToStudy();
 
+  virtual void updateInfoPanel();
+
  public slots:
   /// \brief The method is redefined to connect to the study viewer before the data
   /// model is filled by opened file. This file open will flush redisplay signals for,
@@ -241,6 +244,17 @@ private slots:
   void saveToolbarsConfig();
   void loadToolbarsConfig();
 
+  //! Fill Info Panel in Part set mode
+  void fillPartSetInfoPanel(QtxInfoPanel* theInfoPanel);
+
+  //! Fill Info Panel in Part mode
+  void fillPartInfoPanel(QtxInfoPanel* theInfoPanel);
+
+  //! Fill Info Panel in Sketcher mode
+  void fillSketcherInfoPanel(QtxInfoPanel* theInfoPanel);
+
+  //! Fill Info Panel in Sketcher mode
+  void addActionsToInfoGroup(QtxInfoPanel* theInfoPanel, const QString& theGroup, const QSet<QString>& theActions);
 
   void hideInternalWindows();
 
index 6499ca9e27713f9609b20c5543b32e6bf670f231..093ecc4f58be9b83cd725f450e9b03d6e2c8df43 100644 (file)
@@ -9,7 +9,7 @@
     </message>
     <message>
         <source>Information</source>
-        <translation>Information</translation>
+        <translation type="vanished">Information</translation>
     </message>
     <message>
         <source>Show inspection window</source>
         <source>MEN_DESK_EDIT</source>
         <translation>MEN_DESK_EDIT</translation>
     </message>
+    <message>
+        <source>Parts management</source>
+        <translation>Gestion des pièces</translation>
+    </message>
+    <message>
+        <source>Import operations</source>
+        <translation>Opérations d&apos;importation</translation>
+    </message>
+    <message>
+        <source>Export operations</source>
+        <translation>Opérations d&apos;exportation</translation>
+    </message>
+    <message>
+        <source>Arrangement of parts</source>
+        <translation>Disposition des pièces</translation>
+    </message>
+    <message>
+        <source>Primitives</source>
+        <translation>Primitives</translation>
+    </message>
+    <message>
+        <source>Geometry</source>
+        <translation>Géométrie</translation>
+    </message>
+    <message>
+        <source>Features</source>
+        <translation>Fonctionnalités</translation>
+    </message>
+    <message>
+        <source>Dimensions</source>
+        <translation>Dimensions</translation>
+    </message>
+    <message>
+        <source>Constraints</source>
+        <translation>Contraintes</translation>
+    </message>
+    <message>
+        <source>Welcome to SHAPER</source>
+        <translation>Bienvenue à SHAPER</translation>
+    </message>
+    <message>
+        <source>Current mode: Part set mode</source>
+        <translation>Mode actuel : Mode de réglage des pièces</translation>
+    </message>
+    <message>
+        <source>Current mode: Part mode</source>
+        <translation>Mode actuel : Mode partiel</translation>
+    </message>
+    <message>
+        <source>Current mode: Sketcher mode</source>
+        <translation>Mode actuel : Mode esquisseur</translation>
+    </message>
 </context>
 <context>
     <name>SHAPERGUI_ToolbarItemsDlg</name>