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

View File

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