[FEM] only show toolbar button for available solvers

- if there is e.g. no Z88 solver available, there is no need to pollute the toolbar with an icon for it
This commit is contained in:
Uwe
2023-03-24 21:30:10 +01:00
parent 21ded4a4e0
commit 96d1fb6e50

View File

@@ -26,6 +26,7 @@
# include <qobject.h>
#endif
#include <App/Application.h>
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
@@ -174,11 +175,27 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* solve = new Gui::ToolBarItem(root);
solve->setCommand("Solve");
*solve
<< "FEM_SolverCalculixCxxtools"
<< "FEM_SolverElmer"
<< "FEM_SolverZ88"
<< "Separator"
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
auto ccxBinaryPath = hGrp->GetASCII("ccxBinaryPath", "");
if (!ccxBinaryPath.empty())
*solve << "FEM_SolverCalculixCxxtools";
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Elmer");
auto elmerBinaryPath = hGrp->GetASCII("elmerBinaryPath", "");
if (!elmerBinaryPath.empty())
*solve << "FEM_SolverElmer";
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/mystran");
auto MystranBinaryPath = hGrp->GetASCII("MystranBinaryPath", "");
if (!MystranBinaryPath.empty())
*solve << "FEM_SolverMystran";
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Z88");
auto z88BinaryPath = hGrp->GetASCII("z88BinaryPath", "");
if (!z88BinaryPath.empty())
*solve << "FEM_SolverZ88";
*solve << "Separator"
<< "FEM_CompMechEquations"
<< "FEM_CompEmEquations"
<< "FEM_EquationFlow"