diff --git a/src/Mod/Fem/FemToolsZ88.py b/src/Mod/Fem/FemToolsZ88.py index b64be0566..513b492ab 100644 --- a/src/Mod/Fem/FemToolsZ88.py +++ b/src/Mod/Fem/FemToolsZ88.py @@ -99,17 +99,25 @@ class FemToolsZ88(FemTools.FemTools): # @z88_binary path to z88r binary, default is guessed: "bin/z88r" windows, "z88r" for other systems def setup_z88(self, z88_binary=None): from platform import system - if not z88_binary: - self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") - z88_binary = self.fem_prefs.GetString("z88BinaryPath", "") - if not z88_binary: - if system() == "Linux": - z88_binary = "z88r" - elif system() == "Windows": - z88_binary = FreeCAD.getHomePath() + "bin/z88r.exe" - else: - z88_binary = "z88r" - self.z88_binary = z88_binary + z88_std_location = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88").GetBool("UseStandardZ88Location") + print z88_std_location + if z88_std_location: + if system() == "Windows": + z88_path = FreeCAD.getHomePath() + "bin/z88r.exe" + FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88").SetString("z88BinaryPath", z88_path) + self.z88_binary = z88_path + else: + if not z88_binary: + self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88") + z88_binary = self.fem_prefs.GetString("z88BinaryPath", "") + if not z88_binary: + if system() == "Linux": + z88_binary = "z88r" + elif system() == "Windows": + z88_binary = FreeCAD.getHomePath() + "bin/z88r.exe" + else: + z88_binary = "z88r" + self.z88_binary = z88_binary def run(self): # TODO: reimplement the process handling for z88 binary diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index ed83955fd..4d399cd7d 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -35,6 +35,7 @@ #include "PropertyFemMeshItem.h" #include "DlgSettingsFemGeneralImp.h" #include "DlgSettingsFemCcxImp.h" +#include "DlgSettingsFemZ88Imp.h" #include "ViewProviderFemMesh.h" #include "ViewProviderFemMeshShape.h" #include "ViewProviderFemMeshShapeNetgen.h" @@ -150,6 +151,7 @@ PyMODINIT_FUNC initFemGui() // register preferences pages new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); // add resources and reloads the translators loadFemResource(); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index eed5c9dc3..cec8d7878 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -53,6 +53,7 @@ SOURCE_GROUP("Python" FILES ${Python_SRCS}) set(FemGui_MOC_HDRS DlgSettingsFemCcxImp.h DlgSettingsFemGeneralImp.h + DlgSettingsFemZ88Imp.h PropertyFemMeshItem.h TaskObjectName.h TaskCreateNodeSet.h @@ -90,6 +91,7 @@ SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS}) set(FemGui_UIC_SRCS DlgSettingsFemCcx.ui DlgSettingsFemGeneral.ui + DlgSettingsFemZ88.ui TaskCreateNodeSet.ui TaskObjectName.ui TaskFemConstraint.ui @@ -130,6 +132,9 @@ SET(FemGui_DLG_SRCS DlgSettingsFemGeneral.ui DlgSettingsFemGeneralImp.cpp DlgSettingsFemGeneralImp.h + DlgSettingsFemZ88.ui + DlgSettingsFemZ88Imp.cpp + DlgSettingsFemZ88Imp.h TaskFemConstraint.ui TaskFemConstraint.cpp TaskFemConstraint.h diff --git a/src/Mod/Fem/Gui/DlgSettingsFemGeneral.ui b/src/Mod/Fem/Gui/DlgSettingsFemGeneral.ui index b6b26d98c..39cae5e04 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemGeneral.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemGeneral.ui @@ -95,88 +95,6 @@ - - - - - 0 - 0 - - - - Qt::LeftToRight - - - Z88 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - QLayout::SetNoConstraint - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - Leave blank to use default Z88 solver z88r binary file - - - z88BinaryPath - - - Mod/Fem/General - - - - - - - - 100 - 0 - - - - z88 binary - - - - - - - - - - diff --git a/src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp index b5bdb7339..1d6378a68 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemGeneralImp.cpp @@ -46,8 +46,6 @@ void DlgSettingsFemGeneralImp::saveSettings() { fc_analysis_working_directory->onSave(); - fc_z88_binary->onSave(); - cb_use_built_in_materials->onSave(); cb_use_mat_from_config_dir->onSave(); cb_use_mat_from_custom_dir->onSave(); @@ -62,8 +60,6 @@ void DlgSettingsFemGeneralImp::loadSettings() { fc_analysis_working_directory->onRestore(); - fc_z88_binary->onRestore(); - cb_use_built_in_materials->onRestore(); cb_use_mat_from_config_dir->onRestore(); cb_use_mat_from_custom_dir->onRestore(); diff --git a/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui b/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui new file mode 100644 index 000000000..4e3396fc1 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui @@ -0,0 +1,222 @@ + + + FemGui::DlgSettingsFemZ88Imp + + + Z88 + + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Z88 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + QLayout::SetNoConstraint + + + + + + + Use standard z88r binary path + + + true + + + UseStandardZ88Location + + + Mod/Fem/Z88 + + + + + + + Z88 binary + + + + + + + false + + + + 100 + 0 + + + + z88r binary path: + + + + + + + false + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Leave blank to use default Z88 z88r binary file + + + z88BinaryPath + + + Mod/Fem/Z88 + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+ + Gui::FileChooser + QWidget +
Gui/FileDialog.h
+
+ + Gui::PrefFileChooser + Gui::FileChooser +
Gui/PrefWidgets.h
+
+
+ + + + + + cb_z88_binary_std + toggled(bool) + l_z88_binary_path + setEnabled(bool) + + + 406 + 45 + + + 148 + 68 + + + + + cb_z88_binary_std + toggled(bool) + fc_z88_binary_path + setEnabled(bool) + + + 406 + 45 + + + 406 + 68 + + + + + cb_z88_binary_std + toggled(bool) + l_z88_binary_path + setDisabled(bool) + + + 406 + 45 + + + 148 + 68 + + + + + cb_z88_binary_std + toggled(bool) + fc_z88_binary_path + setDisabled(bool) + + + 406 + 45 + + + 406 + 68 + + + + +
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp new file mode 100644 index 000000000..45f11da96 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (c) 2015 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemCcxImp.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 "Gui/Application.h" +#include "DlgSettingsFemZ88Imp.h" +#include + +using namespace FemGui; + +DlgSettingsFemZ88Imp::DlgSettingsFemZ88Imp( QWidget* parent ) + : PreferencePage( parent ) +{ + this->setupUi(this); +} + +DlgSettingsFemZ88Imp::~DlgSettingsFemZ88Imp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgSettingsFemZ88Imp::saveSettings() +{ + cb_z88_binary_std->onSave(); + fc_z88_binary_path->onSave(); +} + +void DlgSettingsFemZ88Imp::loadSettings() +{ + cb_z88_binary_std->onRestore(); + fc_z88_binary_path->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsFemZ88Imp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsFemZ88Imp.cpp" diff --git a/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.h b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.h new file mode 100644 index 000000000..d6b328a88 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.h @@ -0,0 +1,50 @@ + /************************************************************************** + * Copyright (c) 2016 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemCcx.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_DLGSETTINGSFEMZ88IMP_H +#define FEMGUI_DLGSETTINGSFEMZ88IMP_H + +#include "ui_DlgSettingsFemZ88.h" +#include + +namespace FemGui { + +class DlgSettingsFemZ88Imp : public Gui::Dialog::PreferencePage, public Ui_DlgSettingsFemZ88Imp +{ + Q_OBJECT + +public: + DlgSettingsFemZ88Imp( QWidget* parent = 0 ); + ~DlgSettingsFemZ88Imp(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); +}; + +} // namespace FemGui + +#endif // FEMGUI_DLGSETTINGSFEMZ88IMP_H