Skip to content

Commit

Permalink
FEM: Add Preferences option to hide built in materials
Browse files Browse the repository at this point in the history
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
  • Loading branch information
PrzemoF authored and wwmayer committed Apr 14, 2015
1 parent 956e5f0 commit 32a51db
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/Mod/Fem/Gui/DlgSettingsFem.ui
Expand Up @@ -157,6 +157,22 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="Gui::PrefCheckBox" name="cb_use_built_in_materials">
<property name="text">
<string>Use built-in materials</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBuiltInMaterials</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 @@ -46,6 +46,7 @@ void DlgSettingsFemImp::saveSettings()
cb_int_editor->onSave();
fc_ext_editor->onSave();
fc_ccx_binary->onSave();
cb_use_built_in_materials->onSave();
fc_custom_mat_dir->onSave();
}

Expand All @@ -54,6 +55,7 @@ void DlgSettingsFemImp::loadSettings()
cb_int_editor->onRestore();
fc_ext_editor->onRestore();
fc_ccx_binary->onRestore();
cb_use_built_in_materials->onRestore();
fc_custom_mat_dir->onRestore();
}

Expand Down
11 changes: 7 additions & 4 deletions src/Mod/Fem/MechanicalMaterial.py
Expand Up @@ -246,14 +246,17 @@ def import_materials(self):
self.materials = {}
self.pathList = []
self.form.cb_materials.clear()
system_mat_dir = FreeCAD.getResourceDir() + "/Mod/Material/StandardMaterial"
self.add_mat_dir(system_mat_dir, ":/icons/freecad.svg")
self.fem_preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
use_built_in_materials = self.fem_preferences.GetBool("UseBuiltInMaterials")
if use_built_in_materials:
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")

self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
custom_mat_dir = self.fem_prefs.GetString("CustomMaterialsDir","")
self.fem_preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
custom_mat_dir = self.fem_preferences.GetString("CustomMaterialsDir","")
self.add_mat_dir(custom_mat_dir, ":/icons/user.svg")


Expand Down

0 comments on commit 32a51db

Please sign in to comment.