FEM: Mystran solver, add Gui preferences page for binary path setting

This commit is contained in:
Bernd Hahnebach
2021-07-26 17:41:45 +02:00
parent 7d09e79b73
commit f6a985e0b4
5 changed files with 387 additions and 0 deletions

View File

@@ -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<FemGui::DlgSettingsFemGmshImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemCcxImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemElmerImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMystranImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemZ88Imp> (QT_TRANSLATE_NOOP("QObject","FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMaterialImp> (QT_TRANSLATE_NOOP("QObject","FEM"));

View File

@@ -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

View File

@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FemGui::DlgSettingsFemMystranImp</class>
<widget class="QWidget" name="FemGui::DlgSettingsFemMystranImp">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>144</height>
</rect>
</property>
<property name="windowTitle">
<string>Mystran</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="gb_mystran_param">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="title">
<string>Mystran binary</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<layout class="QGridLayout" name="gl_mystran">
<item row="0" column="2">
<widget class="Gui::PrefCheckBox" name="cb_mystran_binary_std">
<property name="text">
<string>Search in known binary directories</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseStandardMystranLocation</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/mystran</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="l_mystran_binary_std">
<property name="text">
<string>Mystran</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="l_mystran_binary_path">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Mystran binary path</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefFileChooser" name="fc_mystran_binary_path" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Leave blank to use default Mystran binary file location</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>MystranBinaryPath</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/mystran</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="l_mystran_write_comments">
<property name="text">
<string>Comments</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefCheckBox" name="cb_mystran_write_comments">
<property name="text">
<string>write comments to input file</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>writeCommentsToInputFile</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/mystran</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::FileChooser</class>
<extends>QWidget</extends>
<header>Gui/FileDialog.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefFileChooser</class>
<extends>Gui::FileChooser</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/Fem.qrc"/>
</resources>
<connections>
<connection>
<sender>cb_mystran_binary_std</sender>
<signal>toggled(bool)</signal>
<receiver>l_mystran_binary_path</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>148</x>
<y>68</y>
</hint>
</hints>
</connection>
<connection>
<sender>cb_mystran_binary_std</sender>
<signal>toggled(bool)</signal>
<receiver>fc_mystran_binary_path</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>406</x>
<y>68</y>
</hint>
</hints>
</connection>
<connection>
<sender>cb_mystran_binary_std</sender>
<signal>toggled(bool)</signal>
<receiver>l_mystran_binary_path</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>148</x>
<y>68</y>
</hint>
</hints>
</connection>
<connection>
<sender>cb_mystran_binary_std</sender>
<signal>toggled(bool)</signal>
<receiver>fc_mystran_binary_path</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>406</x>
<y>68</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,74 @@
/***************************************************************************
* Copyright (c) 2021 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* 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 <Gui/Application.h>
#include <Gui/PrefWidgets.h>
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"

View File

@@ -0,0 +1,54 @@
/**************************************************************************
* Copyright (c) 2021 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* 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 <Gui/PropertyPage.h>
#include <memory>
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_DlgSettingsFemMystranImp> ui;
};
} // namespace FemGui
#endif // FEMGUI_DLGSETTINGSFEMMYSTRANIMP_H