From 4badce0205e1f29d69f2074bbd2bb30d934cf9d7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 2 Apr 2011 15:08:54 +0200 Subject: [PATCH] fixed actions which did not have a parent which caused the check to fail --- openlp/core/lib/toolbar.py | 3 +-- openlp/core/ui/shortcutlistform.py | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index 44149cd85..d2b37df51 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -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) diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index e350009cd..bd4fb8ab6 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -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):