FEM: prefs, move z88 prefs in an own tab
This commit is contained in:
parent
fd10984242
commit
e2f5bba5a9
|
@ -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
|
||||
|
|
|
@ -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<FemGui::DlgSettingsFemGeneralImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemCcxImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemZ88Imp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
|
||||
// add resources and reloads the translators
|
||||
loadFemResource();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -95,88 +95,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_z88">
|
||||
<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>Z88</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_z88">
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::PrefFileChooser" name="fc_z88_binary" native="true">
|
||||
<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 Z88 solver z88r binary file</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>z88BinaryPath</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_z88_binary">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>z88 binary</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_materials">
|
||||
<property name="title">
|
||||
|
|
|
@ -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();
|
||||
|
|
222
src/Mod/Fem/Gui/DlgSettingsFemZ88.ui
Normal file
222
src/Mod/Fem/Gui/DlgSettingsFemZ88.ui
Normal file
|
@ -0,0 +1,222 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FemGui::DlgSettingsFemZ88Imp</class>
|
||||
<widget class="QWidget" name="FemGui::DlgSettingsFemZ88Imp">
|
||||
<property name="windowTitle">
|
||||
<string>Z88</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_z88_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>Z88</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_z88">
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_z88_binary_std">
|
||||
<property name="text">
|
||||
<string>Use standard z88r binary path</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseStandardZ88Location</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Z88</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_z88_binary_std">
|
||||
<property name="text">
|
||||
<string>Z88 binary</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_z88_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>z88r binary path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::PrefFileChooser" name="fc_z88_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 Z88 z88r binary file</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>z88BinaryPath</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Z88</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_z88_binary_std</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>l_z88_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_z88_binary_std</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fc_z88_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_z88_binary_std</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>l_z88_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_z88_binary_std</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fc_z88_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>
|
69
src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp
Normal file
69
src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2015 FreeCAD Developers *
|
||||
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
|
||||
* 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 <Gui/PrefWidgets.h>
|
||||
|
||||
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"
|
50
src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.h
Normal file
50
src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**************************************************************************
|
||||
* Copyright (c) 2016 FreeCAD Developers *
|
||||
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
|
||||
* 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 <Gui/PropertyPage.h>
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user