forked from openlp/openlp
fixed shortcut dialog
This commit is contained in:
parent
b6f6cc916e
commit
ca23aedb5d
@ -155,14 +155,14 @@ class Settings(QtCore.QSettings):
|
||||
u'shortcuts/addToService': [],
|
||||
u'shortcuts/audioPauseItem': [],
|
||||
u'shortcuts/displayTagItem': [],
|
||||
u'shortcuts/blankScreen': [QtCore.Qt.Key_Period],
|
||||
u'shortcuts/collapse': [QtCore.Qt.Key_Minus],
|
||||
u'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
|
||||
u'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
|
||||
u'shortcuts/desktopScreen': [QtGui.QKeySequence(u'D')],
|
||||
u'shortcuts/delete': [],
|
||||
u'shortcuts/down': [QtCore.Qt.Key_Down],
|
||||
u'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
|
||||
u'shortcuts/editSong': [],
|
||||
u'shortcuts/escapeItem': [QtCore.Qt.Key_Escape],
|
||||
u'shortcuts/expand': [QtCore.Qt.Key_Plus],
|
||||
u'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
|
||||
u'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
|
||||
u'shortcuts/exportThemeItem': [],
|
||||
u'shortcuts/fileNewItem': [QtGui.QKeySequence(u'Ctrl+N')],
|
||||
u'shortcuts/fileSaveAsItem': [QtGui.QKeySequence(u'Ctrl+Shift+S')],
|
||||
@ -175,32 +175,34 @@ class Settings(QtCore.QSettings):
|
||||
u'shortcuts/lockPanel': [],
|
||||
u'shortcuts/modeDefaultItem': [],
|
||||
u'shortcuts/modeLiveItem': [],
|
||||
u'shortcuts/make_live': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/moveUp': [QtCore.Qt.Key_PageUp],
|
||||
u'shortcuts/moveTop': [QtCore.Qt.Key_Home],
|
||||
u'shortcuts/make_live': [QtGui.QKeySequence(QtCore.Qt.Key_Enter), QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/moveUp': [QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
|
||||
u'shortcuts/moveTop': [QtGui.QKeySequence(QtCore.Qt.Key_Home)],
|
||||
u'shortcuts/modeSetupItem': [],
|
||||
u'shortcuts/moveBottom': [QtCore.Qt.Key_End],
|
||||
u'shortcuts/moveDown': [QtCore.Qt.Key_PageDown],
|
||||
u'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)],
|
||||
u'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
|
||||
u'shortcuts/nextTrackItem': [],
|
||||
u'shortcuts/nextItem_live': [QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown],
|
||||
u'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
|
||||
u'shortcuts/nextItem_preview': [],
|
||||
u'shortcuts/nextService': [QtCore.Qt.Key_Right],
|
||||
u'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
|
||||
u'shortcuts/newService': [],
|
||||
u'shortcuts/offlineHelpItem': [],
|
||||
u'shortcuts/onlineHelpItem': [QtGui.QKeySequence(u'Alt+F1')],
|
||||
u'shortcuts/openService': [],
|
||||
u'shortcuts/saveService': [],
|
||||
u'shortcuts/previousItem_live': [QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp],
|
||||
u'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_PageUp)],
|
||||
u'shortcuts/playbackPause': [],
|
||||
u'shortcuts/playbackPlay': [],
|
||||
u'shortcuts/playbackStop': [],
|
||||
u'shortcuts/playSlidesLoop': [],
|
||||
u'shortcuts/playSlidesOnce': [],
|
||||
u'shortcuts/previousService': [QtCore.Qt.Key_Left],
|
||||
u'shortcuts/previousService': [QtGui.QKeySequence(QtCore.Qt.Key_Left)],
|
||||
u'shortcuts/previousItem_preview': [],
|
||||
u'shortcuts/printServiceItem': [QtGui.QKeySequence(u'Ctrl+P')],
|
||||
u'shortcuts/songExportItem': [],
|
||||
u'shortcuts/songUsageStatus': [QtCore.Qt.Key_F4],
|
||||
u'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)],
|
||||
u'shortcuts/settingsShortcutsItem': [],
|
||||
u'shortcuts/settingsImportItem': [],
|
||||
u'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(u'Alt+F7')],
|
||||
@ -228,12 +230,12 @@ class Settings(QtCore.QSettings):
|
||||
u'shortcuts/songImportItem': [],
|
||||
u'shortcuts/themeScreen': [QtGui.QKeySequence(u'T')],
|
||||
u'shortcuts/toolsReindexItem': [],
|
||||
u'shortcuts/toolsAlertItem': [u'F7'],
|
||||
u'shortcuts/toolsAlertItem': [QtGui.QKeySequence(u'F7')],
|
||||
u'shortcuts/toolsFirstTimeWizard': [],
|
||||
u'shortcuts/toolsOpenDataFolder': [],
|
||||
u'shortcuts/toolsAddToolItem': [],
|
||||
u'shortcuts/updateThemeImages': [],
|
||||
u'shortcuts/up': [QtCore.Qt.Key_Up],
|
||||
u'shortcuts/up': [QtGui.QKeySequence(QtCore.Qt.Key_Up)],
|
||||
u'shortcuts/viewThemeManagerItem': [QtGui.QKeySequence(u'F10')],
|
||||
u'shortcuts/viewMediaManagerItem': [QtGui.QKeySequence(u'F8')],
|
||||
u'shortcuts/viewPreviewPanel': [QtGui.QKeySequence(u'F11')],
|
||||
@ -242,36 +244,48 @@ class Settings(QtCore.QSettings):
|
||||
u'shortcuts/webSiteItem': [],
|
||||
|
||||
# FIXME: To be sorted.
|
||||
u'shortcuts/listViewSongsDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewSongsPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewSongsLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewSongsServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewBiblesDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewBiblesPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewBiblesLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewBiblesServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewPresentationsDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewPresentationsPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewPresentationsLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewPresentationsServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewImagesDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewImagesPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewImagesLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewImagesServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewMediaDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewMediaPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewMediaLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewMediaServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewCustomDeleteItem': [QtCore.Qt.Key_Delete],
|
||||
u'shortcuts/listViewCustomPreviewItem': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewCustomLiveItem': [QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
|
||||
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
|
||||
u'shortcuts/listViewCustomServiceItem': [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
|
||||
u'shortcuts/listViewSongsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewSongsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewSongsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewSongsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
u'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewBiblesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewBiblesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewBiblesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
u'shortcuts/listViewPresentationsDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewPresentationsPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewPresentationsLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewPresentationsServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
u'shortcuts/listViewImagesDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewImagesPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewImagesLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewImagesServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
u'shortcuts/listViewMediaDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewMediaPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewMediaLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewMediaServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
u'shortcuts/listViewCustomDeleteItem': [QtGui.QKeySequence(QtCore.Qt.Key_Delete)],
|
||||
u'shortcuts/listViewCustomPreviewItem': [QtGui.QKeySequence(QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewCustomLiveItem': [QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter),
|
||||
QtGui.QKeySequence(QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return)],
|
||||
u'shortcuts/listViewCustomServiceItem': [QtGui.QKeySequence(QtCore.Qt.Key_Plus),
|
||||
QtGui.QKeySequence(QtCore.Qt.Key_Equal)],
|
||||
|
||||
u'themes/global theme': u'',
|
||||
u'themes/last directory': u'',
|
||||
|
@ -147,8 +147,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def refreshShortcutList(self):
|
||||
"""
|
||||
This refreshes the item's shortcuts shown in the list. Note, this
|
||||
neither adds new actions nor removes old actions.
|
||||
This refreshes the item's shortcuts shown in the list. Note, this neither adds new actions nor removes old
|
||||
actions.
|
||||
"""
|
||||
iterator = QtGui.QTreeWidgetItemIterator(self.treeWidget)
|
||||
while iterator.value():
|
||||
@ -204,21 +204,19 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
new_shortcuts = []
|
||||
if shortcuts:
|
||||
new_shortcuts.append(shortcuts[0])
|
||||
new_shortcuts.append(
|
||||
QtGui.QKeySequence(self.alternatePushButton.text()))
|
||||
new_shortcuts.append(QtGui.QKeySequence(self.alternatePushButton.text()))
|
||||
self.changedActions[action] = new_shortcuts
|
||||
if not self.primaryPushButton.text():
|
||||
# When we do not have a primary shortcut, the just entered alternate
|
||||
# shortcut will automatically become the primary shortcut. That is
|
||||
# why we have to adjust the primary button's text.
|
||||
# When we do not have a primary shortcut, the just entered alternate shortcut will automatically become the
|
||||
# primary shortcut. That is why we have to adjust the primary button's text.
|
||||
self.primaryPushButton.setText(self.alternatePushButton.text())
|
||||
self.alternatePushButton.setText(u'')
|
||||
self.refreshShortcutList()
|
||||
|
||||
def onItemDoubleClicked(self, item, column):
|
||||
"""
|
||||
A item has been double clicked. The ``primaryPushButton`` will be
|
||||
checked and the item's shortcut will be displayed.
|
||||
A item has been double clicked. The ``primaryPushButton`` will be checked and the item's shortcut will be
|
||||
displayed.
|
||||
"""
|
||||
action = self._currentItemAction(item)
|
||||
if action is None:
|
||||
@ -234,8 +232,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def onCurrentItemChanged(self, item=None, previousItem=None):
|
||||
"""
|
||||
A item has been pressed. We adjust the button's text to the action's
|
||||
shortcut which is encapsulate in the item.
|
||||
A item has been pressed. We adjust the button's text to the action's shortcut which is encapsulate in the item.
|
||||
"""
|
||||
action = self._currentItemAction(item)
|
||||
self.primaryPushButton.setEnabled(action is not None)
|
||||
@ -253,9 +250,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
if len(action.defaultShortcuts) == 2:
|
||||
alternate_label_text = action.defaultShortcuts[1].toString()
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
# 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
|
||||
# signal.
|
||||
# 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 signal.
|
||||
if item is None:
|
||||
primary_text = self.primaryPushButton.text()
|
||||
alternate_text = self.alternatePushButton.text()
|
||||
@ -264,8 +260,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
elif len(shortcuts) == 2:
|
||||
primary_text = shortcuts[0].toString()
|
||||
alternate_text = shortcuts[1].toString()
|
||||
# When we are capturing a new shortcut, we do not want, the buttons to
|
||||
# display the current shortcut.
|
||||
# When we are capturing a new shortcut, we do not want, the buttons to display the current shortcut.
|
||||
if self.primaryPushButton.isChecked():
|
||||
primary_text = u''
|
||||
if self.alternatePushButton.isChecked():
|
||||
@ -274,8 +269,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
self.alternatePushButton.setText(alternate_text)
|
||||
self.primaryLabel.setText(primary_label_text)
|
||||
self.alternateLabel.setText(alternate_label_text)
|
||||
# We do not want to toggle and radio button, as the function has not
|
||||
# been triggered by a signal.
|
||||
# We do not want to toggle and radio button, as the function has not been triggered by a signal.
|
||||
if item is None:
|
||||
return
|
||||
if primary_label_text == primary_text and alternate_label_text == alternate_text:
|
||||
@ -303,8 +297,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def onDefaultRadioButtonClicked(self, toggled):
|
||||
"""
|
||||
The default radio button has been clicked, which means we have to make
|
||||
sure, that we use the default shortcuts for the action.
|
||||
The default radio button has been clicked, which means we have to make sure, that we use the default shortcuts
|
||||
for the action.
|
||||
"""
|
||||
if not toggled:
|
||||
return
|
||||
@ -325,9 +319,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def onCustomRadioButtonClicked(self, toggled):
|
||||
"""
|
||||
The custom shortcut radio button was clicked, thus we have to restore
|
||||
the custom shortcuts by calling those functions triggered by button
|
||||
clicks.
|
||||
The custom shortcut radio button was clicked, thus we have to restore the custom shortcuts by calling those
|
||||
functions triggered by button clicks.
|
||||
"""
|
||||
if not toggled:
|
||||
return
|
||||
@ -337,8 +330,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save the shortcuts. **Note**, that we do not have to load the shortcuts,
|
||||
as they are loaded in :class:`~openlp.core.utils.ActionList`.
|
||||
Save the shortcuts. **Note**, that we do not have to load the shortcuts, as they are loaded in
|
||||
:class:`~openlp.core.utils.ActionList`.
|
||||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(u'shortcuts')
|
||||
@ -348,8 +341,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
continue
|
||||
for action in category.actions:
|
||||
if action in self.changedActions:
|
||||
old_shortcuts = map(unicode,
|
||||
map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
old_shortcuts = map(QtGui.QKeySequence.toString, action.shortcuts())
|
||||
action.setShortcuts(self.changedActions[action])
|
||||
self.action_list.update_shortcut_map(action, old_shortcuts)
|
||||
settings.setValue(action.objectName(), action.shortcuts())
|
||||
@ -367,13 +359,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
new_shortcuts = []
|
||||
if action.defaultShortcuts:
|
||||
new_shortcuts.append(action.defaultShortcuts[0])
|
||||
# We have to check if the primary default shortcut is available. But
|
||||
# we only have to check, if the action has a default primary
|
||||
# shortcut (an "empty" shortcut is always valid and if the action
|
||||
# does not have a default primary shortcut, then the alternative
|
||||
# shortcut (not the default one) will become primary shortcut, thus
|
||||
# the check will assume that an action were going to have the same
|
||||
# shortcut twice.
|
||||
# We have to check if the primary default shortcut is available. But we only have to check, if the action
|
||||
# has a default primary shortcut (an "empty" shortcut is always valid and if the action does not have a
|
||||
# default primary shortcut, then the alternative shortcut (not the default one) will become primary
|
||||
# shortcut, thus the check will assume that an action were going to have the same shortcut twice.
|
||||
if not self._validiate_shortcut(action, new_shortcuts[0]) and new_shortcuts[0] != shortcuts[0]:
|
||||
return
|
||||
if len(shortcuts) == 2:
|
||||
@ -405,9 +394,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def _validiate_shortcut(self, changing_action, key_sequence):
|
||||
"""
|
||||
Checks if the given ``changing_action `` can use the given
|
||||
``key_sequence``. Returns ``True`` if the ``key_sequence`` can be used
|
||||
by the action, otherwise displays a dialog and returns ``False``.
|
||||
Checks if the given ``changing_action `` can use the given ``key_sequence``. Returns ``True`` if the
|
||||
``key_sequence`` can be used by the action, otherwise displays a dialog and returns ``False``.
|
||||
|
||||
``changing_action``
|
||||
The action which wants to use the ``key_sequence``.
|
||||
@ -429,9 +417,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
# Have the same parent, thus they cannot have the same shortcut.
|
||||
if action.parent() is changing_action.parent():
|
||||
is_valid = False
|
||||
# The new shortcut is already assigned, but if both shortcuts
|
||||
# are only valid in a different widget the new shortcut is
|
||||
# vaild, because they will not interfere.
|
||||
# The new shortcut is already assigned, but if both shortcuts are only valid in a different widget the
|
||||
# new shortcut is vaild, because they will not interfere.
|
||||
if action.shortcutContext() in [QtCore.Qt.WindowShortcut,
|
||||
QtCore.Qt.ApplicationShortcut]:
|
||||
is_valid = False
|
||||
@ -447,9 +434,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def _actionShortcuts(self, action):
|
||||
"""
|
||||
This returns the shortcuts for the given ``action``, which also includes
|
||||
those shortcuts which are not saved yet but already assigned (as changes
|
||||
are applied when closing the dialog).
|
||||
This returns the shortcuts for the given ``action``, which also includes those shortcuts which are not saved
|
||||
yet but already assigned (as changes yre applied when closing the dialog).
|
||||
"""
|
||||
if action in self.changedActions:
|
||||
return self.changedActions[action]
|
||||
@ -457,8 +443,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
|
||||
def _currentItemAction(self, item=None):
|
||||
"""
|
||||
Returns the action of the given ``item``. If no item is given, we return
|
||||
the action of the current item of the ``treeWidget``.
|
||||
Returns the action of the given ``item``. If no item is given, we return the action of the current item of
|
||||
the ``treeWidget``.
|
||||
"""
|
||||
if item is None:
|
||||
item = self.treeWidget.currentItem()
|
||||
@ -486,4 +472,5 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||
self._main_window = Registry().get(u'main_window')
|
||||
return self._main_window
|
||||
|
||||
main_window = property(_get_main_window)
|
||||
main_window = property(_get_main_window)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user