fixed actions which did not have a parent which caused the check to fail

This commit is contained in:
Andreas Preikschat 2011-04-02 15:08:54 +02:00
parent 1a493b1fc8
commit 4badce0205
2 changed files with 7 additions and 7 deletions

View File

@ -79,7 +79,6 @@ class OpenLPToolbar(QtGui.QToolBar):
``context``
Specify the context in which this shortcut is valid
"""
newAction = None
if icon:
actionIcon = build_icon(icon)
if slot and not checkable:
@ -88,7 +87,7 @@ class OpenLPToolbar(QtGui.QToolBar):
newAction = self.addAction(actionIcon, title)
self.icons[title] = actionIcon
else:
newAction = QtGui.QAction(title, newAction)
newAction = QtGui.QAction(title, self)
self.addAction(newAction)
QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'triggered()'), slot)

View File

@ -42,7 +42,6 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
The shortcut list dialog
"""
#TODO: do not close on ESC
#TODO: Fix Preview/Live controller (have the same shortcut)
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
@ -89,12 +88,13 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
continue
# Have the same parentWidget, thus they cannot have the same
# shortcut.
#TODO: Does not fully work right now.
if action.parentWidget() is changing_action.parentWidget():
if action.parent() is changing_action.parent():
shortcut_valid = False
if action.shortcutContext() == QtCore.Qt.WindowShortcut:
if action.shortcutContext() in [QtCore.Qt.WindowShortcut,
QtCore.Qt.ApplicationShortcut]:
shortcut_valid = False
if changing_action.shortcutContext() == QtCore.Qt.WindowShortcut:
if changing_action.shortcutContext() in \
[QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
shortcut_valid = False
if not shortcut_valid:
QtGui.QMessageBox.warning(self,
@ -193,6 +193,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
if action is None:
return
self.shortcutButton.setChecked(True)
self.shortcutButton.setFocus(QtCore.Qt.OtherFocusReason)
self.onItemPressed(item, column)
def onItemPressed(self, item, column):