diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 26a573ba3d..4ae0511e11 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -1,4 +1,4 @@ -import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re +import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,cStringIO from PyQt4 import QtGui from xml.etree.ElementTree import parse @@ -6,8 +6,19 @@ FreeCADGui.addLanguagePath(":/translations") FreeCADGui.updateLocale() def translate(context,text): - "convenience function for the Qt translator" - return str(QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).toUtf8()) + "convenience function for the Qt translator" + # return str(QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).toUtf8()) + u = QtGui.QApplication.translate(context, text, None, + QtGui.QApplication.UnicodeUTF8).toUtf8() + s = cStringIO.StringIO() + for i in u: + if ord(i) == 39: + s.write("\\'") + else: + s.write(i) + t = s.getvalue() + s.close() + return t # texts to be translated @@ -66,144 +77,164 @@ page = """
- ')"
- onMouseout="show('')"
- href="http://free-cad.sf.net/">""" + text08 + """
- ')"
- onMouseout="show('')"
- href=""" + text38 + """>""" + text37 + """
- ')"
- onMouseout="show('')"
- href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Tutorials">""" + text39 + """
- ')"
- onMouseout="show('')"
- href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Power_users_hub">""" + text40 + """
- ')"
- onMouseout="show('')"
- href="http://freecad-tutorial.blogspot.com/">""" + text43 + """
+ ')"
+ onMouseout="show('')"
+ href="http://free-cad.sf.net/">""" + text08 + """
+ ')"
+ onMouseout="show('')"
+ href=""" + text38 + """>""" + text37 + """
+ ')"
+ onMouseout="show('')"
+ href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Tutorials">""" + text39 + """
+ ')"
+ onMouseout="show('')"
+ href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Power_users_hub">""" + text40 + """
+ ')"
+ onMouseout="show('')"
+ href="http://freecad-tutorial.blogspot.com/">""" + text43 + """
- \
- """ + text20 + """
""" + text21 + """ \ - :
')"
- onMouseout="show('')"
- href="PartDesign.py">""" + text22 + """
- \
- """ + text24 + """
""" + text21 + """ \ - :
')"
- onMouseout="show('')"
- href="ArchDesign.py">""" + text25 + """
- \
- """ + text27 + """
""" + text28 + """
')" - onMouseout="show('')" - href="Mesh.py">""" + text29 + """
- \
- This is the """ + text31 + """, \ - """ + text32 + """
')" - onMouseout="show('')" - href="DefaultWorkbench.py">""" + text31 + """
+ \
+ """ + text20 + """
""" + text21 + """ \ + :
')"
+ onMouseout="show('')"
+ href="PartDesign.py">""" + text22 + """
+
+ \
+ """ + text24 + """
""" + text21 + """ \ + :
')"
+ onMouseout="show('')"
+ href="ArchDesign.py">""" + text25 + """
+
+ \
+ """ + text27 + """
""" + text28 + """
')" + onMouseout="show('')" + href="Mesh.py">""" + text29 + """ +
+ \
+ This is the """ + text31 + """, \ + """ + text32 + """
')" + onMouseout="show('')" + href="DefaultWorkbench.py">""" + text31 + """ +" + text33 + " " + getSize(s.st_size) + "
"
- html += text34 + " " + getLocalTime(s.st_ctime) + "
"
- html += text35 + " " + getLocalTime(s.st_mtime) + "
"
- html += "" + text36 + " " + filename + "
FreeCAD Standard File
" - image="thumbnails/Thumbnail.png" - if image in files: - image=zfile.read(image) - thumbfile = tempfile.mkstemp(suffix='.png')[1] - thumb = open(thumbfile,"wb") - thumb.write(image) - thumb.close() - html += '" + text41 + "
" - - return html + hsize = str(size) + "b" + return hsize + + html = '" + text33 + " " + getSize(s.st_size) + "
"
+ html += text34 + " " + getLocalTime(s.st_ctime) + "
"
+ html += text35 + " " + getLocalTime(s.st_mtime) + "
"
+ html += "" + text36 + " " + filename + "
FreeCAD Standard File
" + image="thumbnails/Thumbnail.png" + if image in files: + image=zfile.read(image) + thumbfile = tempfile.mkstemp(suffix='.png')[1] + thumb = open(thumbfile,"wb") + thumb.write(image) + thumb.close() + html += '" + text41 + "
" + + return html def getRecentFiles(): - "returns a list of 3 latest recent files" - - rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") - ct=rf.GetInt("RecentFiles") - html = '