py3: cherry-picking fixes
a cherry pick for the arch module introduced problems with python2 and the start-wb.
This commit is contained in:
parent
31e4489518
commit
1a21a4bc96
|
@ -23,10 +23,15 @@
|
||||||
|
|
||||||
# This is the start page template
|
# This is the start page template
|
||||||
|
|
||||||
import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,cStringIO
|
import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,sys
|
||||||
from PySide import QtGui
|
from PySide import QtGui
|
||||||
from xml.etree.ElementTree import parse
|
from xml.etree.ElementTree import parse
|
||||||
|
|
||||||
|
try:
|
||||||
|
import io as cStringIO
|
||||||
|
except:
|
||||||
|
import cStringIO
|
||||||
|
|
||||||
FreeCADGui.addLanguagePath(":/translations")
|
FreeCADGui.addLanguagePath(":/translations")
|
||||||
FreeCADGui.updateLocale()
|
FreeCADGui.updateLocale()
|
||||||
|
|
||||||
|
@ -41,10 +46,16 @@ def translate(context,text):
|
||||||
|
|
||||||
s = cStringIO.StringIO()
|
s = cStringIO.StringIO()
|
||||||
for i in u:
|
for i in u:
|
||||||
if i == 39:
|
if sys.version_info.major > 2: #below only works correctly in python3
|
||||||
s.write("\\'")
|
if i == 39:
|
||||||
|
s.write("\\'")
|
||||||
|
else:
|
||||||
|
s.write(chr(i))
|
||||||
else:
|
else:
|
||||||
s.write(chr(i))
|
if ord(i) == 39:
|
||||||
|
s.write(unicode("\\'"))
|
||||||
|
else:
|
||||||
|
s.write(unicode(i))
|
||||||
t = s.getvalue()
|
t = s.getvalue()
|
||||||
s.close()
|
s.close()
|
||||||
return t
|
return t
|
||||||
|
@ -612,7 +623,7 @@ def getFeed(url,numitems=3):
|
||||||
resp += item['title']
|
resp += item['title']
|
||||||
resp += '</a></li>'
|
resp += '</a></li>'
|
||||||
resp += '</ul>'
|
resp += '</ul>'
|
||||||
print resp
|
print(resp)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def getCustomBlocks():
|
def getCustomBlocks():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user