From 1c243cfc577cc697386e7b17a9cab89113e4e4e2 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 28 May 2019 21:15:50 +1000 Subject: [PATCH] Add customisable in-command shortcut keys rather than hardcoding them --- src/Mod/Draft/Draft.py | 3 +- src/Mod/Draft/DraftGui.py | 38 +- .../Draft/Resources/ui/preferences-draft.ui | 1042 ++++++++++++++++- 3 files changed, 1032 insertions(+), 51 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index c75fa36c68..35279d98a2 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -99,7 +99,8 @@ def getParamType(param): "dimstyle","gridSize"]: return "int" elif param in ["constructiongroupname","textfont","patternFile","template", - "snapModes","FontFile","ClonePrefix","labeltype"]: + "snapModes","FontFile","ClonePrefix","labeltype"] \ + or "inCommandShortcut" in param: return "string" elif param in ["textheight","tolerance","gridSpacing","arrowsize","extlines","dimspacing", "dimovershoot","extovershoot"]: diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 0179d42fca..6a3eeac082 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -105,25 +105,25 @@ def utf8_decode(text): # in-command shortcut definitions: Shortcut / Translation / related UI control inCommandShortcuts = { - "Relative": ["R",translate("draft","Relative"), "isRelative"], - "Continue": ["T",translate("draft","Continue"), "continueCmd"], - "Close": ["O",translate("draft","Close"), "closeButton"], - "Copy": ["P",translate("draft","Copy"), "isCopy"], - "SubelementMode": ["D",translate("draft","Subelement mode"), "isSubelementMode"], - "Fill": ["L",translate("draft","Fill"), "hasFill"], - "Exit": ["A",translate("draft","Exit"), "finishButton"], - "Snap": ["S",translate("draft","Snap On/Off"), None], - "Increase": ["[",translate("draft","Increase snap radius"), None], - "Decrease": ["]",translate("draft","Decrease snap radius"), None], - "RestrictX": ["X",translate("draft","Restrict X"), None], - "RestrictY": ["Y",translate("draft","Restrict Y"), None], - "RestrictZ": ["Z",translate("draft","Restrict Z"), None], - "SelectEdge": ["E",translate("draft","Select edge"), "selectButton"], - "AddHold": ["Q",translate("draft","Add custom snap point"),None], - "Length": ["H",translate("draft","Length mode"), "lengthValue"], - "Wipe": ["W",translate("draft","Wipe"), "wipeButton"], - "SetWP": ["U",translate("draft","Set Working Plane"), "orientWPButton"], - "CycleSnap": ["`",translate("draft","Cycle snap object"), None] + "Relative": [Draft.getParam("inCommandShortcutRelative", "R"),translate("draft","Relative"), "isRelative"], + "Continue": [Draft.getParam("inCommandShortcutContinue", "T"),translate("draft","Continue"), "continueCmd"], + "Close": [Draft.getParam("inCommandShortcutClose", "O"),translate("draft","Close"), "closeButton"], + "Copy": [Draft.getParam("inCommandShortcutCopy", "P"),translate("draft","Copy"), "isCopy"], + "SubelementMode": [Draft.getParam("inCommandShortcutSubelementMode", "D"),translate("draft","Subelement mode"), "isSubelementMode"], + "Fill": [Draft.getParam("inCommandShortcutFill", "L"),translate("draft","Fill"), "hasFill"], + "Exit": [Draft.getParam("inCommandShortcutExit", "A"),translate("draft","Exit"), "finishButton"], + "Snap": [Draft.getParam("inCommandShortcutSnap", "S"),translate("draft","Snap On/Off"), None], + "Increase": [Draft.getParam("inCommandShortcutIncrease", "["),translate("draft","Increase snap radius"), None], + "Decrease": [Draft.getParam("inCommandShortcutDecrease", "]"),translate("draft","Decrease snap radius"), None], + "RestrictX": [Draft.getParam("inCommandShortcutRestrictX", "X"),translate("draft","Restrict X"), None], + "RestrictY": [Draft.getParam("inCommandShortcutRestrictY", "Y"),translate("draft","Restrict Y"), None], + "RestrictZ": [Draft.getParam("inCommandShortcutRestrictZ", "Z"),translate("draft","Restrict Z"), None], + "SelectEdge": [Draft.getParam("inCommandShortcutSelectEdge", "E"),translate("draft","Select edge"), "selectButton"], + "AddHold": [Draft.getParam("inCommandShortcutAddHold", "Q"),translate("draft","Add custom snap point"),None], + "Length": [Draft.getParam("inCommandShortcutLength", "H"),translate("draft","Length mode"), "lengthValue"], + "Wipe": [Draft.getParam("inCommandShortcutWipe", "W"),translate("draft","Wipe"), "wipeButton"], + "SetWP": [Draft.getParam("inCommandShortcutSetWP", "U"),translate("draft","Set Working Plane"), "orientWPButton"], + "CycleSnap": [Draft.getParam("inCommandShortcutCycleSnap", "`"),translate("draft","Cycle snap object"), None] } diff --git a/src/Mod/Draft/Resources/ui/preferences-draft.ui b/src/Mod/Draft/Resources/ui/preferences-draft.ui index 592f92152d..1a29a4a420 100755 --- a/src/Mod/Draft/Resources/ui/preferences-draft.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draft.ui @@ -7,7 +7,7 @@ 0 0 486 - 476 + 758 @@ -17,11 +17,26 @@ 6 - + + 9 + + + 9 + + + 9 + + 9 + + + 0 + 0 + + General Draft Settings @@ -363,10 +378,16 @@ Values with differences below this value will be treated as same. This value wil - - Construction geometry + + + 0 + 0 + - + + Construction Geometry + + @@ -421,7 +442,7 @@ Values with differences below this value will be treated as same. This value wil This is the default color for objects being drawn while in construction mode. - + 44 125 @@ -438,42 +459,991 @@ Values with differences below this value will be treated as same. This value wil + + + + + + + In-Command Shortcuts + + - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + + Relative + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + R + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutRelative + + + + + + + + + + + + + Continue + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + T + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutContinue + + + + + + + + + + + + + Close + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + O + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutClose + + + + + + + + + + + + + + + Copy + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + P + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutCopy + + + + + + + + + + + Subelement Mode + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + D + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutSubelementMode + + + + + + + + + + + Fill + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + L + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutFill + + + + + + + + + + + + + + + Exit + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + A + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutExit + + + + + + + + + + + Select Edge + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + E + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutSelectEdge + + + + + + + + + + + Add Hold + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Q + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutAddHold + + + + + + + + + + + + + + + Length + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + H + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutLength + + + + + + + + + + + Wipe + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + W + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutWipe + + + + + + + + + + + Set WP + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + U + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutSetWP + + + + + + + + + + + + + + + Cycle Snap + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + ` + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutCycleSnap + + + + + + + + + + + + + + + + + + + + + Snap + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + S + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutSnap + + + + + + + + + + + Increase Radius + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + [ + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutIncreaseRadius + + + + + + + + + + + Decrease Radius + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + ] + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutDecreaseRadius + + + + + + + + + + + + + + + Restrict X + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + X + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutRestrictX + + + + + + + + + + + Restrict Y + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Y + + + 1 + + + + + + false + + + Mod/Draft + + + inCommandShortcutRestrictY + + + + + + + + + + + Restrict Z + + + + + + + true + + + + 0 + 0 + + + + + 25 + 16777215 + + + + Z + + + 1 + + + + + + false + + + Mod/Draft + + + RestrictZ + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + qPixmapFromMimeSource - - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
- - Gui::PrefColorButton - Gui::ColorButton -
Gui/PrefWidgets.h
-
Gui::PrefCheckBox QCheckBox @@ -485,13 +1455,23 @@ Values with differences below this value will be treated as same. This value wil
Gui/PrefWidgets.h
- Gui::PrefLineEdit - QLineEdit + Gui::PrefDoubleSpinBox + QDoubleSpinBox
Gui/PrefWidgets.h
- Gui::PrefDoubleSpinBox - QDoubleSpinBox + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+ + Gui::PrefLineEdit + QLineEdit
Gui/PrefWidgets.h