From c142e1ad62256a33c1fb2133bf27fac3f4b2271e Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Sat, 13 Aug 2022 14:10:43 +0200 Subject: [PATCH] Draft: Improve In-Command-shortcut Undo implementation --- src/Mod/Draft/DraftGui.py | 17 +-- .../ui/preferences-draftinterface.ui | 117 ++++++++++++++---- 2 files changed, 92 insertions(+), 42 deletions(-) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index dc6fbd283e..4f69c91b77 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -151,13 +151,8 @@ inCommandShortcuts = { translate("draft","Cycle snap object"), None ], - "NearSnap": [ - Draft.getParam("inCommandShortcutNearSnap", "N"), - translate("draft","Toggle near snap on/off"), - None - ], "Undo": [ - Draft.getParam("inCommandShortcutNearSnap", "/"), + Draft.getParam("inCommandShortcutUndo", "/"), translate("draft","Undo last segment"), None ], @@ -1671,9 +1666,6 @@ class DraftToolBar: elif txt.upper().startswith(inCommandShortcuts["Snap"][0]): self.togglesnap() spec = True - elif txt.upper().startswith(inCommandShortcuts["NearSnap"][0]): - self.togglenearsnap() - spec = True elif txt.upper().startswith(inCommandShortcuts["Increase"][0]): self.toggleradius(1) spec = True @@ -2097,13 +2089,6 @@ class DraftToolBar: def togglesnap(self): FreeCADGui.doCommand('FreeCADGui.runCommand("Draft_Snap_Lock")') - def togglenearsnap(self): - if hasattr(FreeCADGui,"Snapper"): - if hasattr(FreeCADGui.Snapper,"toolbarButtons"): - for b in FreeCADGui.Snapper.toolbarButtons: - if b.objectName() == "SnapButtonpassive": - b.toggle() - def toggleradius(self,val): if hasattr(FreeCADGui,"Snapper"): par = Draft.getParam("snapRange", 8) diff --git a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui index d8f735206c..7ae5391469 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftinterface.ui @@ -76,13 +76,20 @@ + + + Qt::Horizontal + + + + Continue - + true @@ -119,14 +126,21 @@ - + + + + Qt::Horizontal + + + + Close - + true @@ -163,6 +177,13 @@ + + + + Qt::Horizontal + + + @@ -207,14 +228,14 @@ - + Subelement Mode - + true @@ -251,14 +272,14 @@ - + Fill - + true @@ -339,14 +360,14 @@ - + Select Edge - + true @@ -383,14 +404,14 @@ - + Add Hold - + true @@ -471,14 +492,14 @@ - + Wipe - + true @@ -515,14 +536,14 @@ - + Set WP - + true @@ -603,14 +624,14 @@ - + Global - + true @@ -647,7 +668,51 @@ - + + + + Undo + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + / + + + 1 + + + + + + false + + + inCommandShortcutUndo + + + Mod/Draft + + + + Snap @@ -691,14 +756,14 @@ - + Increase Radius - + true @@ -735,14 +800,14 @@ - + Decrease Radius - + true @@ -823,14 +888,14 @@ - + Restrict Y - + true @@ -867,14 +932,14 @@ - + Restrict Z - + true