Skip to content

Commit

Permalink
FEM: preference setting to disable restore result dialog settings
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and wwmayer committed Mar 18, 2016
1 parent 1280a18 commit eca9e33
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/Mod/Fem/Gui/DlgSettingsFem.ui
Expand Up @@ -457,6 +457,35 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_results">
<property name="title">
<string>Results</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="Gui::PrefCheckBox" name="cb_restore_result_dialog">
<property name="text">
<string>Restore result dialog settings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RestoreResultDialog</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/DlgSettingsFemImp.cpp
Expand Up @@ -60,6 +60,7 @@ void DlgSettingsFemImp::saveSettings()
cb_use_mat_from_config_dir->onSave();
cb_use_mat_from_custom_dir->onSave();
fc_custom_mat_dir->onSave();
cb_restore_result_dialog->onSave();
}

void DlgSettingsFemImp::loadSettings()
Expand All @@ -76,6 +77,7 @@ void DlgSettingsFemImp::loadSettings()
cb_use_mat_from_config_dir->onRestore();
cb_use_mat_from_custom_dir->onRestore();
fc_custom_mat_dir->onRestore();
cb_restore_result_dialog->onRestore();

ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Mod/Fem");
Expand Down
17 changes: 14 additions & 3 deletions src/Mod/Fem/_TaskPanelResultControl.py
Expand Up @@ -40,6 +40,8 @@ class _TaskPanelResultControl:
'''The control for the displacement post-processing'''
def __init__(self):
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelShowDisplacement.ui")
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True)

#Connect Signals and Slots
QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected)
Expand All @@ -55,7 +57,10 @@ def __init__(self):
QtCore.QObject.connect(self.form.sb_displacement_factor_max, QtCore.SIGNAL("valueChanged(int)"), self.sb_disp_factor_max_changed)

self.update()
self.restore_result_dialog()
if self.restore_result_settings_in_dialog:
self.restore_result_dialog()
else:
self.restore_initial_result_dialog()

def restore_result_dialog(self):
try:
Expand Down Expand Up @@ -90,8 +95,14 @@ def restore_result_dialog(self):
self.form.sb_displacement_factor_max.setValue(dfm)
self.form.sb_displacement_factor.setValue(df)
except:
FreeCAD.FEM_dialog = {"results_type": "None", "show_disp": False,
"disp_factor": 0, "disp_factor_max": 100}
self.restore_initial_result_dialog()

def restore_initial_result_dialog(self):
FreeCAD.FEM_dialog = {"results_type": "None", "show_disp": False,
"disp_factor": 0, "disp_factor_max": 100}
fea = FemTools()
fea.reset_mesh_color()
fea.reset_mesh_deformation()

def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Close)
Expand Down

0 comments on commit eca9e33

Please sign in to comment.