-// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
#include <QtxResourceMgr.h>
+#include <QtxInfoPanel.h>
#include <Config_PropManager.h>
#include <Config_ModuleReader.h>
void SHAPERGUI::windows(QMap<int, int>& theWndMap) const
{
theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
+ theWndMap.insert(LightApp_Application::WT_InfoPanel, Qt::RightDockWidgetArea);
}
//******************************************************
else
myWorkshop->updateCommandStatus();
}
- SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
- myIsStorePositions = aResMgr->booleanValue("Study", "store_positions", true);
myIsEditEnabled = getApp()->isEditEnabled();
getApp()->setEditEnabled(false);
- // this following row is caused by #187 bug.
- // SALOME saves the dock widget positions before deactivateModule() and
- // load it after the module activation. So, if the panel is visible before
- // deactivate, it becomes visible after activate.
- // In order to avoid the visible property panel, the widget position save is
- // switch off in this module
- aResMgr->setValue("Study", "store_positions", false);
-
// Synchronize displayed objects
Handle(AIS_InteractiveContext) aContext;
if (mySelector && mySelector->viewer())
this, SLOT(onSaveDocByShaper()));
connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
this, SLOT(onSaveAsDocByShaper()));
-
+ updateInfoPanel();
return isDone;
}
//myWorkshop->contextMenuMgr()->disconnectViewer();
- SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
- aResMgr->setValue("Study", "store_positions", myIsStorePositions);
getApp()->setEditEnabled(myIsEditEnabled);
myOldSelectionColor.clear();
void SHAPERGUI::onUpdateCommandStatus()
{
getApp()->updateActions();
+
+ LightApp_Application* aApp = dynamic_cast<LightApp_Application*>(application());
+ QtxInfoPanel* aInfoPanel = aApp->infoPanel();
+ if (aInfoPanel->isVisible())
+ updateInfoPanel();
}
//******************************************************
{
LightApp_Module::updateModuleVisibilityState();
onWhatIs(myIsInspectionVisible);
+
+ // the following code is caused by #187 bug.
+ // SALOME saves the dock widget positions before deactivateModule() and
+ // load it after the module activation. So, if the panel is visible before
+ // deactivate, it becomes visible after activate.
+ // In order to avoid the visible property panel, we hide it here
+ ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+ if (!anOperation) {
+ myWorkshop->hidePanel(myWorkshop->propertyPanel());
+ }
}
void SHAPERGUI::onEditToolbars()
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 (isSketcher) // Sketcher mode
+ fillSketcherInfoPanel(aInfoPanel);
+ else if (aActiveDoc == aModuleDoc) // Part set mode
+ fillPartSetInfoPanel(aInfoPanel);
+ else
+ fillPartInfoPanel(aInfoPanel);
+}