Draft: update InitGui with context commands

The `ContextMenu` method defines commands that will be listed
when right clicking and opening the context menu in the 3D view
or the tree view.

This sets up the line GUI commands when either a line, wire,
polyline, spline, or bezier curve is active.

However, this currently doesn't work at all for unknown reasons.
Maybe some other functionality in the internal C++ code
needs to be changed first.
This commit is contained in:
vocx-fc
2020-03-11 21:37:48 -06:00
committed by Yorik van Havre
parent 131961c2a8
commit a104ece52e

View File

@@ -156,8 +156,15 @@ class DraftWorkbench(FreeCADGui.Workbench):
else:
self.appendContextMenu("Draft", self.drawing_commands)
else:
if FreeCAD.activeDraftCommand.featureName == translate("draft","Line"):
# BUG: line subcommands are not usable while another command is active
if FreeCAD.activeDraftCommand.featureName in (translate("draft", "Line"),
translate("draft", "Wire"),
translate("draft", "Polyline"),
translate("draft", "BSpline"),
translate("draft", "BezCurve"),
translate("draft", "CubicBezCurve")):
# BUG: the line subcommands are in fact listed
# in the context menu, but they are de-activated
# so they don't work.
self.appendContextMenu("", self.line_commands)
else:
if FreeCADGui.Selection.getSelection():