Material: card writer, get rid of double new line on file end
This commit is contained in:
@@ -192,18 +192,17 @@ def write(filename, dictionary, write_group_section=True):
|
||||
f.write("; information about the content of such cards can be found on the wiki:\n")
|
||||
f.write("; https://www.freecadweb.org/wiki/Material\n")
|
||||
f.write("; file created by FreeCAD" + rev + "\n")
|
||||
f.write("\n")
|
||||
# write sections
|
||||
# write standard FCMat section if write group section parameter is set to False
|
||||
if write_group_section is False:
|
||||
f.write("[FCMat]\n")
|
||||
f.write("\n[FCMat]\n")
|
||||
for s in contents:
|
||||
if s["keyname"] != "Meta":
|
||||
# if the section has no contents, we don't write it
|
||||
if len(s) > 1:
|
||||
# only write group section if write group section parameter is set to True
|
||||
if write_group_section is True:
|
||||
f.write("[" + s["keyname"] + "]\n")
|
||||
f.write("\n[" + s["keyname"] + "]\n")
|
||||
for k, i in s.items():
|
||||
if (k != "keyname" and i != '') or k == "Name":
|
||||
# use only keys which are not empty and the name even if empty
|
||||
@@ -211,6 +210,4 @@ def write(filename, dictionary, write_group_section=True):
|
||||
f.write(k + " = " + i + "\n")
|
||||
else:
|
||||
f.write(k + " = " + i.encode('utf-8') + "\n")
|
||||
if write_group_section is True:
|
||||
f.write("\n")
|
||||
f.close()
|
||||
|
||||
Reference in New Issue
Block a user