Draft: fix context menu

Remove call to get_draft_line_commands.
Update the ContextMenu function. The items are based on the utilities menu now. And the context menu is the same for the Tree view and the 3D view.
This commit is contained in:
Roy-043
2021-10-12 14:35:36 +02:00
committed by GitHub
parent b0dcc39e38
commit 70983bf907

View File

@@ -98,7 +98,6 @@ class DraftWorkbench(FreeCADGui.Workbench):
self.utility_commands_menu = it.get_draft_utility_commands_menu()
self.utility_commands_toolbar = it.get_draft_utility_commands_toolbar()
self.context_commands = it.get_draft_context_commands()
self.line_commands = it.get_draft_line_commands()
# Set up toolbars
it.init_toolbar(self,
@@ -162,25 +161,7 @@ class DraftWorkbench(FreeCADGui.Workbench):
def ContextMenu(self, recipient):
"""Define an optional custom context menu."""
from DraftGui import translate
if recipient == "View":
if FreeCAD.activeDraftCommand is None:
if FreeCADGui.Selection.getSelection():
self.appendContextMenu("Draft", self.drawing_commands + self.modification_commands)
self.appendContextMenu("Utilities", self.context_commands)
else:
self.appendContextMenu("Draft", self.drawing_commands)
else:
if FreeCAD.activeDraftCommand.featureName in ("Line",
"Wire",
"Polyline",
"BSpline",
"BezCurve",
"CubicBezCurve"):
self.appendContextMenu("", self.line_commands)
else:
if FreeCADGui.Selection.getSelection():
self.appendContextMenu("Utilities", self.context_commands)
self.appendContextMenu("Utilities", self.context_commands)
def GetClassName(self):
"""Type of workbench."""