diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 3f05dc8b60..939689417f 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -7015,6 +7015,7 @@ class ViewProviderDraftLabel: vobj.addProperty("App::PropertyEnumeration","TextAlignment","Base",QT_TRANSLATE_NOOP("App::Property","The vertical alignment of the text")) vobj.addProperty("App::PropertyEnumeration","ArrowType","Base",QT_TRANSLATE_NOOP("App::Property","The type of arrow of this label")) vobj.addProperty("App::PropertyEnumeration","Frame","Base",QT_TRANSLATE_NOOP("App::Property","The type of frame around the text of this object")) + vobj.addProperty("App::PropertyBool","Line","Base",QT_TRANSLATE_NOOP("App::Property","Display a leader line or not")) vobj.addProperty("App::PropertyFloat","LineWidth","Base",QT_TRANSLATE_NOOP("App::Property","Line width")) vobj.addProperty("App::PropertyColor","LineColor","Base",QT_TRANSLATE_NOOP("App::Property","Line color")) vobj.addProperty("App::PropertyColor","TextColor","Base",QT_TRANSLATE_NOOP("App::Property","Text color")) @@ -7030,6 +7031,7 @@ class ViewProviderDraftLabel: vobj.ArrowType = arrowtypes vobj.ArrowType = arrowtypes[getParam("dimsymbol")] vobj.Frame = ["None","Rectangle"] + vobj.Line = True def getIcon(self): import Draft_rc @@ -7060,13 +7062,18 @@ class ViewProviderDraftLabel: self.text3d.justification = coin.SoAsciiText.RIGHT self.fcoords = coin.SoCoordinate3() self.frame = coin.SoType.fromName("SoBrepEdgeSet").createInstance() + self.lineswitch = coin.SoSwitch() + switchnode = coin.SoSeparator() + switchnode.addChild(self.line) + switchnode.addChild(self.arrow) + self.lineswitch.addChild(switchnode) + self.lineswitch.whichChild = 0 self.node2d = coin.SoGroup() self.node2d.addChild(self.matline) self.node2d.addChild(self.arrow) self.node2d.addChild(self.drawstyle) self.node2d.addChild(self.lcoords) - self.node2d.addChild(self.line) - self.node2d.addChild(self.arrow) + self.node2d.addChild(self.lineswitch) self.node2d.addChild(self.mattext) self.node2d.addChild(textdrawstyle) self.node2d.addChild(self.textpos) @@ -7079,8 +7086,7 @@ class ViewProviderDraftLabel: self.node3d.addChild(self.arrow) self.node3d.addChild(self.drawstyle) self.node3d.addChild(self.lcoords) - self.node3d.addChild(self.line) - self.node3d.addChild(self.arrow) + self.node3d.addChild(self.lineswitch) self.node3d.addChild(self.mattext) self.node3d.addChild(textdrawstyle) self.node3d.addChild(self.textpos) @@ -7168,6 +7174,12 @@ class ViewProviderDraftLabel: pos = vobj.Object.Placement.Base.add(v) self.textpos.translation.setValue(pos) self.textpos.rotation.setValue(vobj.Object.Placement.Rotation.Q) + elif prop == "Line": + if hasattr(vobj,"Line"): + if vobj.Line: + self.lineswitch.whichChild = 0 + else: + self.lineswitch.whichChild = -1 elif prop == "ArrowType": if hasattr(vobj,"ArrowType"): if len(vobj.Object.Points) > 1: diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index e8c32fdca4..00bf869212 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -4087,10 +4087,11 @@ class Edit(Modifier): # commented out the following line to disable updating # the object during edit, otherwise it confuses the snapper #self.update(self.trackers[self.editing].get()) - if self.ui.addButton.isChecked(): - self.obj.ViewObject.Selectable = True - else: - self.obj.ViewObject.Selectable = False + if hasattr(self.obj.ViewObject,"Selectable"): + if self.ui.addButton.isChecked(): + self.obj.ViewObject.Selectable = True + else: + self.obj.ViewObject.Selectable = False redraw3DView() elif arg["Type"] == "SoMouseButtonEvent": if (arg["State"] == "DOWN") and (arg["Button"] == "BUTTON1"):