Skip to content

Commit

Permalink
Draft - fixed some text encodings in dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jul 11, 2014
1 parent 8188bd5 commit 88471d3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Mod/Draft/Draft.py
Expand Up @@ -410,7 +410,8 @@ def formatObject(target,origin=None):
if not grp:
grp = doc.addObject("App::DocumentObjectGroup",gname)
grp.addObject(target)
obrep.Transparency = 80
if hasattr(obrep,"Transparency"):
obrep.Transparency = 80
else:
col = ui.getDefaultColor("ui")
fcol = ui.getDefaultColor("face")
Expand Down Expand Up @@ -3059,6 +3060,8 @@ def attach(self, vobj):
self.font3d = coin.SoFont()
self.text = coin.SoAsciiText()
self.text3d = coin.SoText2()
self.text.string = "d" # some versions of coin crash if string is not set
self.text3d.string = "d"
self.textpos = coin.SoTransform()
self.text.justification = self.text3d.justification = coin.SoAsciiText.CENTER
label = coin.SoSeparator()
Expand Down Expand Up @@ -3211,9 +3214,9 @@ def updateData(self, obj, prop):
# set text value
l = self.p3.sub(self.p2).Length
if hasattr(obj.ViewObject,"Decimals"):
self.string = DraftGui.displayExternal(l,obj.ViewObject.Decimals,'Length',su)
self.string = DraftGui.displayExternal(l,obj.ViewObject.Decimals,'Length',su).encode("utf8")
else:
self.string = DraftGui.displayExternal(l,getParam("dimPrecision",2),'Length',su)
self.string = DraftGui.displayExternal(l,getParam("dimPrecision",2),'Length',su).encode("utf8")
if hasattr(obj.ViewObject,"Override"):
if obj.ViewObject.Override:
try:
Expand Down Expand Up @@ -3426,6 +3429,8 @@ def attach(self, vobj):
self.font3d = coin.SoFont()
self.text = coin.SoAsciiText()
self.text3d = coin.SoText2()
self.text.string = "d" # some versions of coin crash if string is not set
self.text3d.string = "d"
self.text.justification = self.text3d.justification = coin.SoAsciiText.CENTER
self.textpos = coin.SoTransform()
label = coin.SoSeparator()
Expand Down Expand Up @@ -3498,9 +3503,9 @@ def updateData(self, obj, prop):
if hasattr(obj.ViewObject,"ShowUnit"):
su = obj.ViewObject.ShowUnit
if hasattr(obj.ViewObject,"Decimals"):
self.string = DraftGui.displayExternal(a,obj.ViewObject.Decimals,'Angle',su)
self.string = DraftGui.displayExternal(a,obj.ViewObject.Decimals,'Angle',su).encode("utf8")
else:
self.string = DraftGui.displayExternal(a,getParam("dimPrecision",2),'Angle',su)
self.string = DraftGui.displayExternal(a,getParam("dimPrecision",2),'Angle',su).encode("utf8")
if obj.ViewObject.Override:
try:
from pivy import coin
Expand Down

0 comments on commit 88471d3

Please sign in to comment.