fixed error when a document is being loaded (balloons source object are not available yet)

This commit is contained in:
Youen 2023-01-02 16:55:02 +01:00
parent 13ff11293a
commit 20895bbf4b

View File

@ -521,14 +521,15 @@ class TechDrawExtensions:
obj = self.getBalloonSourcePart(balloon)
path = self.getBalloonSourcePartPath(balloon)
partDisplayName = 'Inconnu' if obj is None else self.getPartDisplayName(obj)
if obj is not None:
objectCenterView = workbench.techDrawExtensions.computePartCenter(view, obj, path)
objectCenterView = workbench.techDrawExtensions.computePartCenter(view, obj, path)
balloon.OriginX = objectCenterView.x + balloon.Assembly_handbook_OriginOffsetX
balloon.OriginY = objectCenterView.y + balloon.Assembly_handbook_OriginOffsetY
partDisplayName = 'Inconnu' if obj is None else self.getPartDisplayName(obj)
balloon.Text = partDisplayName
balloon.OriginX = objectCenterView.x + balloon.Assembly_handbook_OriginOffsetX
balloon.OriginY = objectCenterView.y + balloon.Assembly_handbook_OriginOffsetY
balloon.Text = partDisplayName
balloon.ViewObject.Font = 'DejaVu Sans'
balloon.ViewObject.Fontsize = 4
balloon.BubbleShape = 'Inspection'