From 32d7839da4413f2be7f34e0d204ab4dfb3d6b034 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 3 May 2014 13:00:44 -0300 Subject: [PATCH] Draft: use latin1 in texts if coin < 4 - issue #1404 --- src/Mod/Draft/Draft.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 414b352b5a8c..b201a027836d 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -342,6 +342,7 @@ def removeHidden(objectslist): for o in objectslist: if o.ViewObject: if not o.ViewObject.isVisible(): + newlist.remove(o) return newlist @@ -877,8 +878,11 @@ def makeText(stringslist,point=Vector(0,0,0),screen=False): textbuffer = [] for l in stringslist: try: - # only available in Coin3D >= 4.0 - textbuffer.append(str(l)) + from pivy import coin + if coin.COIN_MAJOR_VERSION >= 4: + textbuffer.append(str(l)) + else: + textbuffer.append(l.decode("utf8").encode('latin1')) except: textbuffer.append(l.decode("utf8").encode('latin1')) obj=FreeCAD.ActiveDocument.addObject("App::Annotation","Text") @@ -1753,7 +1757,6 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente svg += text[i].decode("utf8") svg += '\n' svg += '\n' - print svg return svg @@ -3204,8 +3207,11 @@ def updateData(self, obj, prop): if hasattr(obj.ViewObject,"Override"): if obj.ViewObject.Override: try: - # only available in Coin3D >= 4.0 - self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string) + from pivy import coin + if coin.COIN_MAJOR_VERSION >= 4: + self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string) + else: + self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1") except: self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1") self.text.string = self.text3d.string = self.string