Skip to content

Commit

Permalink
Draft: fixing bugs in opening older files
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Apr 13, 2014
1 parent a988ead commit 6113d15
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/Mod/Draft/Draft.py
Expand Up @@ -3125,10 +3125,11 @@ def updateData(self, obj, prop):
if proj:
self.p2 = self.p1.add(proj.negative())
self.p3 = self.p4.add(proj.negative())
dmax = obj.ViewObject.ExtLines.Value
if dmax and (proj.Length > dmax):
self.p1 = self.p2.add(DraftVecUtils.scaleTo(proj,dmax))
self.p4 = self.p3.add(DraftVecUtils.scaleTo(proj,dmax))
if hasattr(obj.ViewObject,"ExtLines"):
dmax = obj.ViewObject.ExtLines.Value
if dmax and (proj.Length > dmax):
self.p1 = self.p2.add(DraftVecUtils.scaleTo(proj,dmax))
self.p4 = self.p3.add(DraftVecUtils.scaleTo(proj,dmax))
else:
self.p2 = self.p1
self.p3 = self.p4
Expand Down Expand Up @@ -3187,12 +3188,13 @@ def updateData(self, obj, prop):
else:
fstring = "%." + str(getParam("dimPrecision",2)) + "f"
self.string = (fstring % l)
if obj.ViewObject.Override:
try:
# only available in Coin3D >= 4.0
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
except:
self.string = unicode(obj.ViewObject.Override).encode("latin1").replace("$dim",self.string)
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)
except:
self.string = unicode(obj.ViewObject.Override).encode("latin1").replace("$dim",self.string)
self.text.string = self.text3d.string = self.string

# set the distance property
Expand Down Expand Up @@ -3225,22 +3227,22 @@ def updateData(self, obj, prop):
def onChanged(self, vobj, prop):
"called when a view property has changed"

if prop == "FontSize":
if (prop == "FontSize") and hasattr(vobj,"FontSize"):
if hasattr(self,"font"):
self.font.size = vobj.FontSize.Value
if hasattr(self,"font3d"):
self.font3d.size = vobj.FontSize.Value*100
elif prop == "FontName":
elif (prop == "FontName") and hasattr(vobj,"FontName"):
if hasattr(self,"font") and hasattr(self,"font3d"):
self.font.name = self.font3d.name = str(vobj.FontName)
elif prop == "LineColor":
elif (prop == "LineColor") and hasattr(vobj,"LineColor"):
if hasattr(self,"color"):
c = vobj.LineColor
self.color.rgb.setValue(c[0],c[1],c[2])
elif prop == "LineWidth":
elif (prop == "LineWidth") and hasattr(vobj,"LineWidth"):
if hasattr(self,"drawstyle"):
self.drawstyle.lineWidth = vobj.LineWidth
elif prop in ["ArrowSize","ArrowType"]:
elif (prop in ["ArrowSize","ArrowType"]) and hasattr(vobj,"ArrowSize"):
if hasattr(self,"node") and hasattr(self,"p2"):
from pivy import coin

Expand Down

0 comments on commit 6113d15

Please sign in to comment.