This commit is contained in:
Kovid Goyal 2011-09-03 12:38:03 -06:00
parent 7af3b6e882
commit 3470004cc4

View File

@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en'
from collections import OrderedDict
from functools import partial
import sip
from PyQt4.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex,
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame,
QApplication, QSize, QRectF, QWidget, QTreeView,
@ -125,11 +126,18 @@ class Manager(QObject): # {{{
#pprint.pprint(self.keys_map)
def replace_action(self, unique_name, new_action):
'''
Replace the action associated with a shortcut. If this method returns
False you must call finalize() to have shortcuts set on the new action
correctly.
'''
sc = self.shortcuts[unique_name]
ac = sc['action']
if ac is not None:
if ac is not None and not sip.isdeleted(ac):
new_action.setShortcuts(ac.shortcuts())
ac.setShortcuts([])
return True
return False
# }}}