Skip to content

Commit

Permalink
FEM: Add Preferences option to hide materials from .FreeCAD/Materials…
Browse files Browse the repository at this point in the history
… directory

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
  • Loading branch information
PrzemoF authored and wwmayer committed Apr 14, 2015
1 parent 32a51db commit 1d5b470
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Mod/Fem/Gui/DlgSettingsFem.ui
Expand Up @@ -173,6 +173,22 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="cb_use_mat_from_config_dir">
<property name="text">
<string>Use materials from .FreeCAD/Materials directory</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseMaterialsFromConfigDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem</cstring>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/DlgSettingsFemImp.cpp
Expand Up @@ -47,6 +47,7 @@ void DlgSettingsFemImp::saveSettings()
fc_ext_editor->onSave();
fc_ccx_binary->onSave();
cb_use_built_in_materials->onSave();
cb_use_mat_from_config_dir->onSave();
fc_custom_mat_dir->onSave();
}

Expand All @@ -56,6 +57,7 @@ void DlgSettingsFemImp::loadSettings()
fc_ext_editor->onRestore();
fc_ccx_binary->onRestore();
cb_use_built_in_materials->onRestore();
cb_use_mat_from_config_dir->onRestore();
fc_custom_mat_dir->onRestore();
}

Expand Down
6 changes: 4 additions & 2 deletions src/Mod/Fem/MechanicalMaterial.py
Expand Up @@ -252,8 +252,10 @@ def import_materials(self):
system_mat_dir = FreeCAD.getResourceDir() + "/Mod/Material/StandardMaterial"
self.add_mat_dir(system_mat_dir, ":/icons/freecad.svg")

user_mat_dirname = FreeCAD.getUserAppDataDir() + "Materials"
self.add_mat_dir(user_mat_dirname, ":/icons/preferences-general.svg")
use_mat_from_config_dir = self.fem_preferences.GetBool("UseMaterialsFromConfigDir")
if use_mat_from_config_dir:
user_mat_dirname = FreeCAD.getUserAppDataDir() + "Materials"
self.add_mat_dir(user_mat_dirname, ":/icons/preferences-general.svg")

self.fem_preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
custom_mat_dir = self.fem_preferences.GetString("CustomMaterialsDir","")
Expand Down

0 comments on commit 1d5b470

Please sign in to comment.