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
|
The :mod:`~openlp.core.utils.actions` module provides action list classes used
|
||||||
by the shortcuts system.
|
by the shortcuts system.
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Settings
|
from openlp.core.lib import Settings
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ActionCategory(object):
|
class ActionCategory(object):
|
||||||
"""
|
"""
|
||||||
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a category for the
|
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a category for the
|
||||||
@ -312,6 +317,8 @@ class ActionList(object):
|
|||||||
actions.append(action)
|
actions.append(action)
|
||||||
ActionList.shortcut_map[shortcuts[1]] = actions
|
ActionList.shortcut_map[shortcuts[1]] = actions
|
||||||
else:
|
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])
|
shortcuts.remove(shortcuts[1])
|
||||||
# Check the primary shortcut.
|
# Check the primary shortcut.
|
||||||
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
||||||
@ -321,7 +328,8 @@ class ActionList(object):
|
|||||||
actions.append(action)
|
actions.append(action)
|
||||||
ActionList.shortcut_map[shortcuts[0]] = actions
|
ActionList.shortcut_map[shortcuts[0]] = actions
|
||||||
else:
|
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])
|
action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
|
||||||
|
|
||||||
def remove_action(self, action, category=None):
|
def remove_action(self, action, category=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user