Fixed #116 - Slicing with none-ascii characters under windows. It is an ugly hack, but it works.
parent
1b56cd18d7
commit
8b6159523a
|
@ -198,7 +198,7 @@ class SVGWriter:
|
|||
self.setMetadataNoscriptElement('minZ', 'Z: ', self.cornerMinimum.z)
|
||||
self.textHeight = float( self.sliceDictionary['textHeight'] )
|
||||
controlTop = len(loopLayers) * (self.margin + self.extent.y * self.unitScale + self.textHeight) + self.marginTop + self.textHeight
|
||||
self.svgElement.getFirstChildByLocalName('title').setTextContent(os.path.basename(fileName) + ' - Slice Layers')
|
||||
self.svgElement.getFirstChildByLocalName('title').setTextContent(os.path.basename(fileName).encode("utf-8") + ' - Slice Layers')
|
||||
svgElementDictionary['height'] = '%spx' % self.getRounded(max(controlTop, self.controlBoxHeightMargin))
|
||||
width = max(self.extent.x * self.unitScale, svgMinWidth)
|
||||
svgElementDictionary['width'] = '%spx' % self.getRounded( width )
|
||||
|
|
|
@ -75,6 +75,8 @@ def runSlice(fileNames):
|
|||
"Run the slicer on the files. If we are running with PyPy then just do the slicing action. If we are running as Python, try to find pypy."
|
||||
pypyExe = getPyPyExe()
|
||||
for fileName in fileNames:
|
||||
if fileName.startswith("#UTF8#"):
|
||||
fileName = unicode(fileName[6:], "utf-8")
|
||||
if platform.python_implementation() == "PyPy":
|
||||
skeinforge_craft.writeOutput(fileName)
|
||||
elif pypyExe == False:
|
||||
|
@ -162,7 +164,10 @@ def getSliceCommand(filename):
|
|||
mainScriptFile = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1]))
|
||||
cmd = [pypyExe, mainScriptFile, '-p', profile.getGlobalProfileString()]
|
||||
if platform.system() == "Windows":
|
||||
cmd.append(str(filename))
|
||||
try:
|
||||
cmd.append(str(filename))
|
||||
except UnicodeEncodeError:
|
||||
cmd.append("#UTF8#" + filename.encode("utf-8"))
|
||||
else:
|
||||
cmd.append(filename)
|
||||
return cmd
|
||||
|
|
Loading…
Reference in New Issue