Handle non-Ascii in ShapeString SStringValue

This commit is contained in:
WandererFan 2014-02-16 12:58:10 -05:00 committed by wmayer
parent 8de258dded
commit 0f9001a3f5
2 changed files with 7 additions and 10 deletions

View File

@ -63,7 +63,7 @@ class todo:
todo.itinerary = []
if todo.commitlist:
for name,func in todo.commitlist:
# print "debug: committing ",str(name)
#print "debug: committing ",str(name)
try:
name = str(name)
FreeCAD.ActiveDocument.openTransaction(name)
@ -1026,7 +1026,8 @@ class DraftToolBar:
if (self.labelSString.isVisible()):
if self.SStringValue.text():
# print "debug: D_G DraftToolBar.validateSString type(SStringValue.text): " str(type(self.SStringValue.text))
self.sourceCmd.validSString(str(self.SStringValue.text())) # QString to QByteArray to PyString
#self.sourceCmd.validSString(str(self.SStringValue.text())) # QString to QByteArray to PyString
self.sourceCmd.validSString(self.SStringValue.text()) # PySide returns Unicode from QString
else:
FreeCAD.Console.PrintMessage(translate("draft", "Please enter a text string."))

View File

@ -1838,16 +1838,12 @@ class ShapeString(Creator):
def createObject(self):
"creates object in the current doc"
#print "debug: D_T ShapeString.createObject type(self.SString): " str(type(self.SString))
# temporary code
#import platform
#if not (platform.system() == 'Linux'):
# FreeCAD.Console.PrintWarning("Sorry, ShapeString is not yet fully implemented for your platform.\n")
# self.finish()
# return
# temporary code
dquote = '"'
String = dquote + self.SString + dquote
if type(self.SString) == unicode:
String = 'u' + dquote + self.SString.encode('unicode_escape') + dquote
else:
String = dquote + self.SString + dquote
Size = str(self.SSSize) # numbers are ascii so this should always work
Tracking = str(self.SSTrack) # numbers are ascii so this should always work
FFile = dquote + self.FFile + dquote