forked from openlp/openlp
fixed shortcut dialog
This commit is contained in:
parent
6553dda038
commit
638b95f62c
@ -90,7 +90,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
if key == QtCore.Qt.Key_Shift or key == QtCore.Qt.Key_Control or \
|
||||||
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
key == QtCore.Qt.Key_Meta or key == QtCore.Qt.Key_Alt:
|
||||||
return
|
return
|
||||||
key_string = QtGui.QKeySequence(key)
|
key_string = QtGui.QKeySequence(key).toString()
|
||||||
if event.modifiers() & QtCore.Qt.ControlModifier == \
|
if event.modifiers() & QtCore.Qt.ControlModifier == \
|
||||||
QtCore.Qt.ControlModifier:
|
QtCore.Qt.ControlModifier:
|
||||||
key_string = u'Ctrl+' + key_string
|
key_string = u'Ctrl+' + key_string
|
||||||
@ -106,10 +106,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
||||||
if self.primaryPushButton.isChecked():
|
if self.primaryPushButton.isChecked():
|
||||||
self._adjustButton(self.primaryPushButton,
|
self._adjustButton(self.primaryPushButton,
|
||||||
False, text=key_sequence)
|
False, text=key_sequence.toString())
|
||||||
elif self.alternatePushButton.isChecked():
|
elif self.alternatePushButton.isChecked():
|
||||||
self._adjustButton(self.alternatePushButton,
|
self._adjustButton(self.alternatePushButton,
|
||||||
False, text=key_sequence)
|
False, text=key_sequence.toString())
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
self.changedActions = {}
|
self.changedActions = {}
|
||||||
@ -155,11 +155,11 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
item.setText(1, u'')
|
item.setText(1, u'')
|
||||||
item.setText(2, u'')
|
item.setText(2, u'')
|
||||||
elif len(shortcuts) == 1:
|
elif len(shortcuts) == 1:
|
||||||
item.setText(1, shortcuts[0])
|
item.setText(1, shortcuts[0].toString())
|
||||||
item.setText(2, u'')
|
item.setText(2, u'')
|
||||||
else:
|
else:
|
||||||
item.setText(1, shortcuts[0])
|
item.setText(1, shortcuts[0].toString())
|
||||||
item.setText(2, shortcuts[1])
|
item.setText(2, shortcuts[1].toString())
|
||||||
self.onCurrentItemChanged()
|
self.onCurrentItemChanged()
|
||||||
|
|
||||||
def onPrimaryPushButtonClicked(self, toggled):
|
def onPrimaryPushButtonClicked(self, toggled):
|
||||||
@ -242,9 +242,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.alternatePushButton.setChecked(False)
|
self.alternatePushButton.setChecked(False)
|
||||||
else:
|
else:
|
||||||
if action.defaultShortcuts:
|
if action.defaultShortcuts:
|
||||||
primary_label_text = action.defaultShortcuts[0]
|
primary_label_text = action.defaultShortcuts[0].toString()
|
||||||
if len(action.defaultShortcuts) == 2:
|
if len(action.defaultShortcuts) == 2:
|
||||||
alternate_label_text = action.defaultShortcuts[1]
|
alternate_label_text = action.defaultShortcuts[1].toString()
|
||||||
shortcuts = self._actionShortcuts(action)
|
shortcuts = self._actionShortcuts(action)
|
||||||
# We do not want to loose pending changes, that is why we have to
|
# We do not want to loose pending changes, that is why we have to
|
||||||
# keep the text when, this function has not been triggered by a
|
# keep the text when, this function has not been triggered by a
|
||||||
@ -253,10 +253,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
primary_text = self.primaryPushButton.text()
|
primary_text = self.primaryPushButton.text()
|
||||||
alternate_text = self.alternatePushButton.text()
|
alternate_text = self.alternatePushButton.text()
|
||||||
elif len(shortcuts) == 1:
|
elif len(shortcuts) == 1:
|
||||||
primary_text = shortcuts[0]
|
primary_text = shortcuts[0].toString()
|
||||||
elif len(shortcuts) == 2:
|
elif len(shortcuts) == 2:
|
||||||
primary_text = shortcuts[0]
|
primary_text = shortcuts[0].toString()
|
||||||
alternate_text = shortcuts[1]
|
alternate_text = shortcuts[1].toString()
|
||||||
# When we are capturing a new shortcut, we do not want, the buttons to
|
# When we are capturing a new shortcut, we do not want, the buttons to
|
||||||
# display the current shortcut.
|
# display the current shortcut.
|
||||||
if self.primaryPushButton.isChecked():
|
if self.primaryPushButton.isChecked():
|
||||||
@ -314,9 +314,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
primary_button_text = u''
|
primary_button_text = u''
|
||||||
alternate_button_text = u''
|
alternate_button_text = u''
|
||||||
if temp_shortcuts:
|
if temp_shortcuts:
|
||||||
primary_button_text = temp_shortcuts[0]
|
primary_button_text = temp_shortcuts[0].toString()
|
||||||
if len(temp_shortcuts) == 2:
|
if len(temp_shortcuts) == 2:
|
||||||
alternate_button_text = temp_shortcuts[1]
|
alternate_button_text = temp_shortcuts[1].toString()
|
||||||
self.primaryPushButton.setText(primary_button_text)
|
self.primaryPushButton.setText(primary_button_text)
|
||||||
self.alternatePushButton.setText(alternate_button_text)
|
self.alternatePushButton.setText(alternate_button_text)
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
'Duplicate Shortcut'),
|
'Duplicate Shortcut'),
|
||||||
u'message': translate('OpenLP.ShortcutListDialog',
|
u'message': translate('OpenLP.ShortcutListDialog',
|
||||||
'The shortcut "%s" is already assigned to another action, '
|
'The shortcut "%s" is already assigned to another action, '
|
||||||
'please use a different shortcut.') % key_sequence
|
'please use a different shortcut.') % key_sequence.toString()
|
||||||
})
|
})
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user