From 985b7da5b302cc379b9d2fa47adc3e91b6f28b19 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 24 Jan 2012 20:30:04 -0200 Subject: [PATCH] Bugfix in Draft custom hatch patterns --- src/Mod/Draft/DraftTools.py | 5 +++-- src/Mod/Draft/importSVG.py | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 4fdb850a5..b564749b1 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -50,9 +50,10 @@ FreeCAD.svgpatterns = importSVG.getContents(Draft_rc.qt_resource_data,'pattern', altpat = Draft.getParam("patternFile") if os.path.isdir(altpat): for f in os.listdir(altpat): - if '.svg' in f: + if f[-4:].upper() == ".SVG": p = importSVG.getContents(altpat+os.sep+f,'pattern') - if p: FreeCAD.svgpatterns[p[0]]=p[1] + if p: + FreeCAD.svgpatterns.update(p) # sets the default working plane plane = WorkingPlane.plane() diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index af3e3e235..6ecbed714 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -896,8 +896,7 @@ def getContents(filename,tag,stringmode=False): contents = filename else: f = pythonopen(filename) - contents = '' - for line in f: contents += line + contents = f.read() f.close() contents = contents.replace('\n','_linebreak') searchpat = '<'+tag+'.*?'