From f6a985e0b48f8519bf8a9547758d3412d2a2c8f8 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 26 Jul 2021 17:41:45 +0200 Subject: [PATCH] FEM: Mystran solver, add Gui preferences page for binary path setting --- src/Mod/Fem/Gui/AppFemGui.cpp | 2 + src/Mod/Fem/Gui/CMakeLists.txt | 4 + src/Mod/Fem/Gui/DlgSettingsFemMystran.ui | 253 +++++++++++++++++++ src/Mod/Fem/Gui/DlgSettingsFemMystranImp.cpp | 74 ++++++ src/Mod/Fem/Gui/DlgSettingsFemMystranImp.h | 54 ++++ 5 files changed, 387 insertions(+) create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemMystran.ui create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemMystranImp.cpp create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemMystranImp.h diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index c088a067c5..fad9b28703 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -40,6 +40,7 @@ #include "DlgSettingsFemGmshImp.h" #include "DlgSettingsFemInOutVtkImp.h" #include "DlgSettingsFemMaterialImp.h" +#include "DlgSettingsFemMystranImp.h" #include "DlgSettingsFemZ88Imp.h" #include "ViewProviderFemMesh.h" #include "ViewProviderFemMeshShape.h" @@ -169,6 +170,7 @@ PyMOD_INIT_FUNC(FemGui) new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index 0c0a9a2437..b70a41634d 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -63,6 +63,7 @@ set(FemGui_UIC_SRCS DlgSettingsFemGmsh.ui DlgSettingsFemInOutVtk.ui DlgSettingsFemMaterial.ui + DlgSettingsFemMystran.ui DlgSettingsFemZ88.ui TaskCreateNodeSet.ui TaskObjectName.ui @@ -129,6 +130,9 @@ SET(FemGui_DLG_SRCS DlgSettingsFemMaterial.ui DlgSettingsFemMaterialImp.cpp DlgSettingsFemMaterialImp.h + DlgSettingsFemMystran.ui + DlgSettingsFemMystranImp.cpp + DlgSettingsFemMystranImp.h DlgSettingsFemZ88.ui DlgSettingsFemZ88Imp.cpp DlgSettingsFemZ88Imp.h diff --git a/src/Mod/Fem/Gui/DlgSettingsFemMystran.ui b/src/Mod/Fem/Gui/DlgSettingsFemMystran.ui new file mode 100644 index 0000000000..a16a360f3c --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemMystran.ui @@ -0,0 +1,253 @@ + + + FemGui::DlgSettingsFemMystranImp + + + + 0 + 0 + 418 + 144 + + + + Mystran + + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Mystran binary + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + QLayout::SetNoConstraint + + + + + + + Search in known binary directories + + + true + + + UseStandardMystranLocation + + + Mod/Fem/mystran + + + + + + + Mystran + + + + + + + false + + + + 100 + 0 + + + + Mystran binary path + + + + + + + false + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Leave blank to use default Mystran binary file location + + + MystranBinaryPath + + + Mod/Fem/mystran + + + + + + + Comments + + + + + + + write comments to input file + + + true + + + writeCommentsToInputFile + + + Mod/Fem/mystran + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+ + Gui::FileChooser + QWidget +
Gui/FileDialog.h
+
+ + Gui::PrefFileChooser + Gui::FileChooser +
Gui/PrefWidgets.h
+
+
+ + + + + + cb_mystran_binary_std + toggled(bool) + l_mystran_binary_path + setEnabled(bool) + + + 406 + 45 + + + 148 + 68 + + + + + cb_mystran_binary_std + toggled(bool) + fc_mystran_binary_path + setEnabled(bool) + + + 406 + 45 + + + 406 + 68 + + + + + cb_mystran_binary_std + toggled(bool) + l_mystran_binary_path + setDisabled(bool) + + + 406 + 45 + + + 148 + 68 + + + + + cb_mystran_binary_std + toggled(bool) + fc_mystran_binary_path + setDisabled(bool) + + + 406 + 45 + + + 406 + 68 + + + + +
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.cpp new file mode 100644 index 0000000000..7ed503ea06 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (c) 2021 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#include "DlgSettingsFemMystranImp.h" +#include "ui_DlgSettingsFemMystran.h" +#include +#include + +using namespace FemGui; + +DlgSettingsFemMystranImp::DlgSettingsFemMystranImp( QWidget* parent ) + : PreferencePage( parent ) + , ui(new Ui_DlgSettingsFemMystranImp) +{ + ui->setupUi(this); +} + +DlgSettingsFemMystranImp::~DlgSettingsFemMystranImp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgSettingsFemMystranImp::saveSettings() +{ + ui->cb_mystran_binary_std->onSave(); + ui->fc_mystran_binary_path->onSave(); + ui->cb_mystran_write_comments->onSave(); +} + +void DlgSettingsFemMystranImp::loadSettings() +{ + ui->cb_mystran_binary_std->onRestore(); + ui->fc_mystran_binary_path->onRestore(); + ui->cb_mystran_write_comments->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsFemMystranImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsFemMystranImp.cpp" diff --git a/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.h b/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.h new file mode 100644 index 0000000000..902fa74bf7 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemMystranImp.h @@ -0,0 +1,54 @@ + /************************************************************************** + * Copyright (c) 2021 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.h * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEMGUI_DLGSETTINGSFEMMYSTRANIMP_H +#define FEMGUI_DLGSETTINGSFEMMYSTRANIMP_H + +#include +#include + +namespace FemGui { + +class Ui_DlgSettingsFemMystranImp; +class DlgSettingsFemMystranImp : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + DlgSettingsFemMystranImp( QWidget* parent = 0 ); + ~DlgSettingsFemMystranImp(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; +}; + +} // namespace FemGui + +#endif // FEMGUI_DLGSETTINGSFEMMYSTRANIMP_H