From b0f7e34271fd02181f9c7fb334e38125de44d0ca Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 7 Mar 2013 11:07:02 +0100 Subject: [PATCH] log a warning, when a shortcut cannot be used --- openlp/core/utils/actions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index a1b2bff38..1dc93e0d6 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -30,11 +30,16 @@ The :mod:`~openlp.core.utils.actions` module provides action list classes used by the shortcuts system. """ +import logging + from PyQt4 import QtCore, QtGui from openlp.core.lib import Settings +log = logging.getLogger(__name__) + + class ActionCategory(object): """ The :class:`~openlp.core.utils.ActionCategory` class encapsulates a category for the @@ -312,6 +317,8 @@ class ActionList(object): actions.append(action) ActionList.shortcut_map[shortcuts[1]] = actions else: + log.warn(u'Shortcut %s is removed from %s because another action already uses this shortcut.' % + (shortcuts[1], action.objectName())) shortcuts.remove(shortcuts[1]) # Check the primary shortcut. existing_actions = ActionList.shortcut_map.get(shortcuts[0], []) @@ -321,7 +328,8 @@ class ActionList(object): actions.append(action) ActionList.shortcut_map[shortcuts[0]] = actions else: - shortcuts.remove(shortcuts[0]) + log.warn(u'Shortcut %s is removed from %s because another action already uses this shortcut.' % + (shortcuts[0], action.objectName())) action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts]) def remove_action(self, action, category=None):