From fde0de26f2378b8c63e533b09aa181c96b24b57c Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 9 Jan 2018 12:14:34 +0100 Subject: [PATCH] [update] added hotkeys for picking --- pylot/RELEASE-VERSION | 2 +- pylot/core/util/widgets.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 7159d560..e7fd36a2 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -00cd-dirty +acdc-dirty diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index ef83b47d..3a72b761 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -1507,9 +1507,8 @@ class PickDlg(QDialog): phaseSelect = {'P': self.p_phase_select, 'S': self.s_phase_select} - nHotkey = 4 # max hotkeys per phase - hotkey = 1 # start hotkey - + hotkeys = {'P': [1, 2, 3, 4, 'q', 'w', 'e', 'r'], + '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) for phaseIndex, phaseID in enumerate(['P', 'S']): @@ -1518,11 +1517,11 @@ class PickDlg(QDialog): # remove zeros phase = phase.strip() # add hotkeys - if not index >= nHotkey: - shortcut = str(hotkey) - hotkey += 1 - else: + try: + shortcut = str(hotkeys[phaseID][index]) + except IndexError: shortcut = None + # create action and add to menu # phase name transferred using lambda function slot = lambda phase=phase, phaseID=phaseID: phaseSelect[phaseID](phase)