[update] added hotkeys for picking

This commit is contained in:
Marcel Paffrath 2018-01-09 12:14:34 +01:00
parent acdcf74c63
commit fde0de26f2
2 changed files with 7 additions and 8 deletions

View File

@ -1 +1 @@
00cd-dirty acdc-dirty

View File

@ -1507,9 +1507,8 @@ class PickDlg(QDialog):
phaseSelect = {'P': self.p_phase_select, phaseSelect = {'P': self.p_phase_select,
'S': self.s_phase_select} 'S': self.s_phase_select}
nHotkey = 4 # max hotkeys per phase hotkeys = {'P': [1, 2, 3, 4, 'q', 'w', 'e', 'r'],
hotkey = 1 # start hotkey 'S': [5, 6, 7, 8, 't', 'z', 'u', 'i']}
# loop over P and S (use explicit list instead of iter over dict.keys to keep order) # loop over P and S (use explicit list instead of iter over dict.keys to keep order)
for phaseIndex, phaseID in enumerate(['P', 'S']): for phaseIndex, phaseID in enumerate(['P', 'S']):
@ -1518,11 +1517,11 @@ class PickDlg(QDialog):
# remove zeros # remove zeros
phase = phase.strip() phase = phase.strip()
# add hotkeys # add hotkeys
if not index >= nHotkey: try:
shortcut = str(hotkey) shortcut = str(hotkeys[phaseID][index])
hotkey += 1 except IndexError:
else:
shortcut = None shortcut = None
# create action and add to menu # create action and add to menu
# phase name transferred using lambda function # phase name transferred using lambda function
slot = lambda phase=phase, phaseID=phaseID: phaseSelect[phaseID](phase) slot = lambda phase=phase, phaseID=phaseID: phaseSelect[phaseID](phase)