mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-18 15:13:41 +01:00
...
This commit is contained in:
parent
7af3b6e882
commit
3470004cc4
1 changed files with 9 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
|||
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 @@ def finalize(self):
|
|||
#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
|
||||
|
||||
# }}}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue