Skip to content

Commit

Permalink
Add customisable in-command shortcut keys rather than hardcoding them
Browse files Browse the repository at this point in the history
  • Loading branch information
Moult authored and yorikvanhavre committed Jun 3, 2019
1 parent 3789a26 commit 1c243cf
Show file tree
Hide file tree
Showing 3 changed files with 1,031 additions and 50 deletions.
3 changes: 2 additions & 1 deletion src/Mod/Draft/Draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
38 changes: 19 additions & 19 deletions src/Mod/Draft/DraftGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}


Expand Down

0 comments on commit 1c243cf

Please sign in to comment.