FEM: Add Preferences option to hide materials from user defined directory
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
parent
1d5b4709fe
commit
abefd40bb7
|
@ -189,10 +189,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="cb_use_mat_from_custom_dir">
|
||||
<property name="text">
|
||||
<string>Use materials from user defined directory</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseMaterialsFromCustomDir</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">
|
||||
<widget class="Gui::PrefFileChooser" name="fc_custom_mat_dir">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -218,6 +237,9 @@
|
|||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_custom_mat_dir">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
|
@ -339,5 +361,69 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_use_mat_from_custom_dir</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>l_custom_mat_dir</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>93</x>
|
||||
<y>262</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>89</x>
|
||||
<y>289</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_use_mat_from_custom_dir</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fc_custom_mat_dir</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>240</x>
|
||||
<y>258</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>241</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_use_mat_from_custom_dir</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>l_custom_mat_dir</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>123</x>
|
||||
<y>266</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>122</x>
|
||||
<y>297</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_use_mat_from_custom_dir</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fc_custom_mat_dir</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>380</x>
|
||||
<y>266</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>380</x>
|
||||
<y>293</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -48,6 +48,7 @@ void DlgSettingsFemImp::saveSettings()
|
|||
fc_ccx_binary->onSave();
|
||||
cb_use_built_in_materials->onSave();
|
||||
cb_use_mat_from_config_dir->onSave();
|
||||
cb_use_mat_from_custom_dir->onSave();
|
||||
fc_custom_mat_dir->onSave();
|
||||
}
|
||||
|
||||
|
@ -58,6 +59,7 @@ void DlgSettingsFemImp::loadSettings()
|
|||
fc_ccx_binary->onRestore();
|
||||
cb_use_built_in_materials->onRestore();
|
||||
cb_use_mat_from_config_dir->onRestore();
|
||||
cb_use_mat_from_custom_dir->onRestore();
|
||||
fc_custom_mat_dir->onRestore();
|
||||
}
|
||||
|
||||
|
|
|
@ -257,9 +257,10 @@ class _MechanicalMaterialTaskPanel:
|
|||
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","")
|
||||
self.add_mat_dir(custom_mat_dir, ":/icons/user.svg")
|
||||
use_mat_from_custom_dir = self.fem_preferences.GetBool("UseMaterialsFromCustomDir")
|
||||
if use_mat_from_custom_dir:
|
||||
custom_mat_dir = self.fem_preferences.GetString("CustomMaterialsDir","")
|
||||
self.add_mat_dir(custom_mat_dir, ":/icons/user.svg")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_MechanicalMaterial',_CommandMechanicalMaterial())
|
||||
|
|
Loading…
Reference in New Issue
Block a user