forked from openlp/openlp
log a warning, when a shortcut cannot be used
This commit is contained in:
parent
580baf76f4
commit
b0f7e34271
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user