Material, editor and main module, code formating

This commit is contained in:
Bernd Hahnebach
2019-04-23 09:13:16 +02:00
parent 7583761936
commit d6582737a7
2 changed files with 12 additions and 5 deletions

View File

@@ -116,7 +116,8 @@ def getMaterialAttributeStructure(withSpaces=None):
''''''
# material properties
# see the following resources in the FreeCAD wiki for more information about the material specific properties:
# see the following resources in the FreeCAD wiki for more information
# about the material specific properties:
# https://www.freecadweb.org/wiki/Material_data_model
# https://www.freecadweb.org/wiki/Material
@@ -127,7 +128,8 @@ def getMaterialAttributeStructure(withSpaces=None):
tree = ElementTree.parse(infile)
if withSpaces:
# on attributes, add a space before a capital letter, will be used for better display in the ui
# on attributes, add a space before a capital letter
# will be used for better display in the ui
import re
root = tree.getroot()
for group in root.getchildren():
@@ -143,7 +145,7 @@ def read_cards_from_path(cards_path):
from os.path import isfile, join, basename, splitext
from importFCMat import read
only_files = [f for f in listdir(cards_path) if isfile(join(cards_path, f))]
mat_files = [f for f in only_files if basename(splitext(f)[1]) == '.FCMat' or basename(splitext(f)[1]) == '.fcmat']
mat_files = [f for f in only_files if basename(splitext(f)[1]).upper() == '.FCMAT']
# print(mat_files)
mat_cards = []
for f in sorted(mat_files):

View File

@@ -197,7 +197,9 @@ class MaterialEditor:
self.updateContents(d)
def getMaterialResources(self):
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Material/Resources")
self.fem_prefs = FreeCAD.ParamGet(
"User parameter:BaseApp/Preferences/Mod/Material/Resources"
)
use_built_in_materials = self.fem_prefs.GetBool("UseBuiltInMaterials", True)
use_mat_from_config_dir = self.fem_prefs.GetBool("UseMaterialsFromConfigDir", True)
use_mat_from_custom_dir = self.fem_prefs.GetBool("UseMaterialsFromCustomDir", True)
@@ -207,7 +209,10 @@ class MaterialEditor:
# FreeCAD returns paths with / at the end, thus not os.sep is needed on first +
self.resources = []
if use_built_in_materials:
self.resources.append(FreeCAD.getResourceDir() + "Mod" + os.sep + "Material" + os.sep + "StandardMaterial")
res_dir = FreeCAD.getResourceDir()
self.resources.append(
res_dir + "Mod" + os.sep + "Material" + os.sep + "StandardMaterial"
)
if use_mat_from_config_dir:
self.resources.append(FreeCAD.ConfigGet("UserAppData") + "Material")
if use_mat_from_custom_dir: