make sure we save the default shortcut

This commit is contained in:
Andreas Preikschat 2011-03-31 20:53:50 +02:00
parent 0c9b839e91
commit b17ad26672
6 changed files with 107 additions and 110 deletions

View File

@ -51,8 +51,7 @@ class OpenLPToolbar(QtGui.QToolBar):
log.debug(u'Init done for %s' % parent.__class__.__name__) log.debug(u'Init done for %s' % parent.__class__.__name__)
def addToolbarButton(self, title, icon, tooltip=None, slot=None, def addToolbarButton(self, title, icon, tooltip=None, slot=None,
checkable=False, shortcut=0, alternate=0, checkable=False, shortcuts=None, context=QtCore.Qt.WidgetShortcut):
context=QtCore.Qt.WidgetShortcut):
""" """
A method to help developers easily add a button to the toolbar. A method to help developers easily add a button to the toolbar.
@ -74,11 +73,8 @@ class OpenLPToolbar(QtGui.QToolBar):
If *True* the button has two, *off* and *on*, states. Default is If *True* the button has two, *off* and *on*, states. Default is
*False*, which means the buttons has only one state. *False*, which means the buttons has only one state.
``shortcut`` ``shortcuts``
The primary shortcut for this action The list of shortcuts for this action
``alternate``
The alternate shortcut for this action
``context`` ``context``
Specify the context in which this shortcut is valid Specify the context in which this shortcut is valid
@ -103,7 +99,8 @@ class OpenLPToolbar(QtGui.QToolBar):
QtCore.QObject.connect(newAction, QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'toggled(bool)'), slot) QtCore.SIGNAL(u'toggled(bool)'), slot)
self.actions[title] = newAction self.actions[title] = newAction
newAction.setShortcuts([shortcut, alternate]) if shortcuts is not None:
newAction.setShortcuts(shortcuts)
newAction.setShortcutContext(context) newAction.setShortcutContext(context)
return newAction return newAction

View File

@ -275,13 +275,26 @@ def icon_action(parent, name, icon, checked=None, category=None):
action.setIcon(build_icon(icon)) action.setIcon(build_icon(icon))
return action return action
def shortcut_action(parent, text, shortcuts, function, category=None): def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None,
category=None):
""" """
Return a shortcut enabled action. Return a shortcut enabled action.
""" """
action = base_action(parent, text, category) # We cannot use the base_action, icon_action and the like, as we must not
# add the action to the actionList before the shortcut has been set
# (when we add the action to the list, the default shortcut is saved, to be
# able restore the shortcut).
action = QtGui.QAction(parent)
action.setObjectName(name)
if icon is not None:
action.setIcon(build_icon(icon))
if checked is not None:
action.setCheckable(True)
action.setChecked(checked)
action.setShortcuts(shortcuts) action.setShortcuts(shortcuts)
action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut) action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
if category is not None:
ActionList.add_action(action, category)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), function) QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), function)
return action return action

View File

@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \ from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \
SettingsManager, PluginManager, Receiver, translate SettingsManager, PluginManager, Receiver, translate
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
icon_action icon_action, shortcut_action
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \
ShortcutListForm, DisplayTagForm ShortcutListForm, DisplayTagForm
@ -161,18 +161,32 @@ class Ui_MainWindow(object):
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.themeManagerDock) self.themeManagerDock)
# Create the menu items # Create the menu items
self.FileNewItem = icon_action(mainWindow, u'FileNewItem', self.FileNewItem = shortcut_action(mainWindow, u'FileNewItem',
[QtGui.QKeySequence(u'Ctrl+N')],
self.ServiceManagerContents.onNewServiceClicked,
u':/general/general_new.png', category=u'File') u':/general/general_new.png', category=u'File')
self.FileOpenItem = icon_action(mainWindow, u'FileOpenItem', self.FileNewItem.setShortcutContext(QtCore.Qt.WindowShortcut)
self.FileOpenItem = shortcut_action(mainWindow, u'FileOpenItem',
[QtGui.QKeySequence(u'Ctrl+O')],
self.ServiceManagerContents.onLoadServiceClicked,
u':/general/general_open.png', category=u'File') u':/general/general_open.png', category=u'File')
self.FileSaveItem = icon_action(mainWindow, u'FileSaveItem', self.FileOpenItem.setShortcutContext(QtCore.Qt.WindowShortcut)
self.FileSaveItem = shortcut_action(mainWindow, u'FileSaveItem',
[QtGui.QKeySequence(u'Ctrl+S')],
self.ServiceManagerContents.saveFile,
u':/general/general_save.png', category=u'File') u':/general/general_save.png', category=u'File')
self.FileSaveAsItem = base_action( self.FileSaveItem.setShortcutContext(QtCore.Qt.WindowShortcut)
mainWindow, u'FileSaveAsItem', u'File') self.FileSaveAsItem = shortcut_action(mainWindow, u'FileSaveAsItem',
self.printServiceOrderItem = base_action( [QtGui.QKeySequence(u'Ctrl+Shift+S')],
mainWindow, u'printServiceItem', u'File') self.ServiceManagerContents.saveFileAs, category=u'File')
self.FileExitItem = icon_action(mainWindow, u'FileExitItem', self.FileSaveAsItem.setShortcutContext(QtCore.Qt.WindowShortcut)
self.printServiceOrderItem = shortcut_action(mainWindow,
u'printServiceItem', [QtGui.QKeySequence(u'Ctrl+P')],
self.ServiceManagerContents.printServiceOrder, category=u'File')
self.FileExitItem = shortcut_action(mainWindow, u'FileExitItem',
[QtGui.QKeySequence(u'Alt+F4')], mainWindow.close,
u':/system/system_exit.png', category=u'File') u':/system/system_exit.png', category=u'File')
self.FileSaveAsItem.setShortcutContext(QtCore.Qt.WindowShortcut)
self.ImportThemeItem = base_action( self.ImportThemeItem = base_action(
mainWindow, u'ImportThemeItem', u'Import') mainWindow, u'ImportThemeItem', u'Import')
self.ImportLanguageItem = base_action( self.ImportLanguageItem = base_action(
@ -181,15 +195,21 @@ class Ui_MainWindow(object):
mainWindow, u'ExportThemeItem', u'Export') mainWindow, u'ExportThemeItem', u'Export')
self.ExportLanguageItem = base_action( self.ExportLanguageItem = base_action(
mainWindow, u'ExportLanguageItem')#, u'Export') mainWindow, u'ExportLanguageItem')#, u'Export')
self.ViewMediaManagerItem = icon_action(mainWindow, self.ViewMediaManagerItem = shortcut_action(mainWindow,
u'ViewMediaManagerItem', u':/system/system_mediamanager.png', u'ViewMediaManagerItem', [QtGui.QKeySequence(u'F8')],
self.toggleMediaManager, u':/system/system_mediamanager.png',
self.mediaManagerDock.isVisible(), u'View') self.mediaManagerDock.isVisible(), u'View')
self.ViewThemeManagerItem = icon_action(mainWindow, self.FileSaveAsItem.setShortcutContext(QtCore.Qt.WindowShortcut)
u'ViewThemeManagerItem', u':/system/system_thememanager.png', self.ViewThemeManagerItem = shortcut_action(mainWindow,
u'ViewThemeManagerItem', [QtGui.QKeySequence(u'F9')],
self.toggleThemeManager, u':/system/system_thememanager.png',
self.themeManagerDock.isVisible(), u'View') self.themeManagerDock.isVisible(), u'View')
self.ViewServiceManagerItem = icon_action(mainWindow, self.FileSaveAsItem.setShortcutContext(QtCore.Qt.WindowShortcut)
u'ViewServiceManagerItem', u':/system/system_servicemanager.png', self.ViewServiceManagerItem = shortcut_action(mainWindow,
u'ViewServiceManagerItem', [QtGui.QKeySequence(u'F10')],
self.toggleServiceManager, u':/system/system_servicemanager.png',
self.serviceManagerDock.isVisible(), u'View') self.serviceManagerDock.isVisible(), u'View')
self.FileSaveAsItem.setShortcutContext(QtCore.Qt.WindowShortcut)
self.ViewPreviewPanel = checkable_action(mainWindow, self.ViewPreviewPanel = checkable_action(mainWindow,
u'ViewPreviewPanel', previewVisible, u'View') u'ViewPreviewPanel', previewVisible, u'View')
self.ViewLivePanel = checkable_action( self.ViewLivePanel = checkable_action(
@ -278,8 +298,6 @@ class Ui_MainWindow(object):
# Connect up some signals and slots # Connect up some signals and slots
QtCore.QObject.connect(self.FileMenu, QtCore.QObject.connect(self.FileMenu,
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu) QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
QtCore.QObject.connect(self.FileExitItem,
QtCore.SIGNAL(u'triggered()'), mainWindow.close)
QtCore.QMetaObject.connectSlotsByName(mainWindow) QtCore.QMetaObject.connectSlotsByName(mainWindow)
# Hide the entry, as it does not have any functionality yet. # Hide the entry, as it does not have any functionality yet.
self.ToolsAddToolItem.setVisible(False) self.ToolsAddToolItem.setVisible(False)
@ -312,36 +330,27 @@ class Ui_MainWindow(object):
self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New')) self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.FileNewItem.setToolTip(UiStrings.NewService) self.FileNewItem.setToolTip(UiStrings.NewService)
self.FileNewItem.setStatusTip(UiStrings.CreateService) self.FileNewItem.setStatusTip(UiStrings.CreateService)
self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open')) self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
self.FileOpenItem.setToolTip(UiStrings.OpenService) self.FileOpenItem.setToolTip(UiStrings.OpenService)
self.FileOpenItem.setStatusTip( self.FileOpenItem.setStatusTip(
translate('OpenLP.MainWindow', 'Open an existing service.')) translate('OpenLP.MainWindow', 'Open an existing service.'))
self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save')) self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
self.FileSaveItem.setToolTip(UiStrings.SaveService) self.FileSaveItem.setToolTip(UiStrings.SaveService)
self.FileSaveItem.setStatusTip( self.FileSaveItem.setStatusTip(
translate('OpenLP.MainWindow', 'Save the current service to disk.')) translate('OpenLP.MainWindow', 'Save the current service to disk.'))
self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S'))
self.FileSaveAsItem.setText( self.FileSaveAsItem.setText(
translate('OpenLP.MainWindow', 'Save &As...')) translate('OpenLP.MainWindow', 'Save &As...'))
self.FileSaveAsItem.setToolTip( self.FileSaveAsItem.setToolTip(
translate('OpenLP.MainWindow', 'Save Service As')) translate('OpenLP.MainWindow', 'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow', self.FileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow',
'Save the current service under a new name.')) 'Save the current service under a new name.'))
self.FileSaveAsItem.setShortcut(
translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
self.printServiceOrderItem.setText(UiStrings.PrintServiceOrder) self.printServiceOrderItem.setText(UiStrings.PrintServiceOrder)
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow',
'Print the current Service Order.')) 'Print the current Service Order.'))
self.printServiceOrderItem.setShortcut(
translate('OpenLP.MainWindow', 'Ctrl+P'))
self.FileExitItem.setText( self.FileExitItem.setText(
translate('OpenLP.MainWindow', 'E&xit')) translate('OpenLP.MainWindow', 'E&xit'))
self.FileExitItem.setStatusTip( self.FileExitItem.setStatusTip(
translate('OpenLP.MainWindow', 'Quit OpenLP')) translate('OpenLP.MainWindow', 'Quit OpenLP'))
self.FileExitItem.setShortcut(
translate('OpenLP.MainWindow', 'Alt+F4'))
self.ImportThemeItem.setText( self.ImportThemeItem.setText(
translate('OpenLP.MainWindow', '&Theme')) translate('OpenLP.MainWindow', '&Theme'))
self.ImportLanguageItem.setText( self.ImportLanguageItem.setText(
@ -362,24 +371,18 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', 'Toggle Media Manager')) translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.ViewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the media manager.')) 'Toggle the visibility of the media manager.'))
self.ViewMediaManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F8'))
self.ViewThemeManagerItem.setText( self.ViewThemeManagerItem.setText(
translate('OpenLP.MainWindow', '&Theme Manager')) translate('OpenLP.MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setToolTip( self.ViewThemeManagerItem.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Theme Manager')) translate('OpenLP.MainWindow', 'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.ViewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the theme manager.')) 'Toggle the visibility of the theme manager.'))
self.ViewThemeManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F10'))
self.ViewServiceManagerItem.setText( self.ViewServiceManagerItem.setText(
translate('OpenLP.MainWindow', '&Service Manager')) translate('OpenLP.MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setToolTip( self.ViewServiceManagerItem.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Service Manager')) translate('OpenLP.MainWindow', 'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.ViewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the service manager.')) 'Toggle the visibility of the service manager.'))
self.ViewServiceManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F9'))
self.ViewPreviewPanel.setText( self.ViewPreviewPanel.setText(
translate('OpenLP.MainWindow', '&Preview Panel')) translate('OpenLP.MainWindow', '&Preview Panel'))
self.ViewPreviewPanel.setToolTip( self.ViewPreviewPanel.setToolTip(
@ -409,6 +412,7 @@ class Ui_MainWindow(object):
translate('OpenLP.MainWindow', 'More information about OpenLP')) translate('OpenLP.MainWindow', 'More information about OpenLP'))
self.HelpAboutItem.setShortcut( self.HelpAboutItem.setShortcut(
translate('OpenLP.MainWindow', 'Ctrl+F1')) translate('OpenLP.MainWindow', 'Ctrl+F1'))
print self.HelpAboutItem.shortcuts()
self.HelpOnlineHelpItem.setText( self.HelpOnlineHelpItem.setText(
translate('OpenLP.MainWindow', '&Online Help')) translate('OpenLP.MainWindow', '&Online Help'))
# Uncomment after 1.9.5 beta string freeze # Uncomment after 1.9.5 beta string freeze
@ -490,12 +494,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.ExportThemeItem, QtCore.QObject.connect(self.ExportThemeItem,
QtCore.SIGNAL(u'triggered()'), QtCore.SIGNAL(u'triggered()'),
self.themeManagerContents.onExportTheme) self.themeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
QtCore.QObject.connect(self.ViewServiceManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.toggleServiceManager)
QtCore.QObject.connect(self.ViewThemeManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.toggleThemeManager)
QtCore.QObject.connect(self.ViewPreviewPanel, QtCore.QObject.connect(self.ViewPreviewPanel,
QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility) QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility)
QtCore.QObject.connect(self.ViewLivePanel, QtCore.QObject.connect(self.ViewLivePanel,
@ -525,20 +523,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked)
QtCore.QObject.connect(self.SettingsShortcutsItem, QtCore.QObject.connect(self.SettingsShortcutsItem,
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewServiceClicked)
QtCore.QObject.connect(self.FileOpenItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onLoadServiceClicked)
QtCore.QObject.connect(self.FileSaveItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.saveFile)
QtCore.QObject.connect(self.FileSaveAsItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.saveFileAs)
QtCore.QObject.connect(self.printServiceOrderItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.printServiceOrder)
# i18n set signals for languages # i18n set signals for languages
self.LanguageGroup.triggered.connect(LanguageManager.set_language) self.LanguageGroup.triggered.connect(LanguageManager.set_language)
QtCore.QObject.connect(self.ModeDefaultItem, QtCore.QObject.connect(self.ModeDefaultItem,
@ -909,17 +893,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) % unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) %
theme) theme)
def toggleMediaManager(self, visible): def toggleMediaManager(self):
if self.mediaManagerDock.isVisible() != visible: self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
self.mediaManagerDock.setVisible(visible)
def toggleServiceManager(self, visible): def toggleServiceManager(self):
if self.serviceManagerDock.isVisible() != visible: self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible())
self.serviceManagerDock.setVisible(visible)
def toggleThemeManager(self, visible): def toggleThemeManager(self):
if self.themeManagerDock.isVisible() != visible: self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
self.themeManagerDock.setVisible(visible)
def setPreviewPanelVisibility(self, visible): def setPreviewPanelVisibility(self, visible):
""" """

View File

@ -165,38 +165,50 @@ class ServiceManager(QtGui.QWidget):
u':/services/service_top.png', u':/services/service_top.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Move item to the top of the service.'), 'Move item to the top of the service.'),
self.onServiceTop, shortcut=QtCore.Qt.Key_Home) self.onServiceTop, shortcuts=[QtCore.Qt.Key_Home])
self.serviceManagerList.moveTop.setObjectName(u'moveTop')
ActionList.add_action(self.serviceManagerList.moveTop, u'Service')
self.serviceManagerList.moveUp = self.orderToolbar.addToolbarButton( self.serviceManagerList.moveUp = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &up'), translate('OpenLP.ServiceManager', 'Move &up'),
u':/services/service_up.png', u':/services/service_up.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Move item up one position in the service.'), 'Move item up one position in the service.'),
self.onServiceUp, shortcut=QtCore.Qt.Key_PageUp) self.onServiceUp, shortcuts=[QtCore.Qt.Key_PageUp])
self.serviceManagerList.moveUp.setObjectName(u'moveUp')
ActionList.add_action(self.serviceManagerList.moveUp, u'Service')
self.serviceManagerList.moveDown = self.orderToolbar.addToolbarButton( self.serviceManagerList.moveDown = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'), translate('OpenLP.ServiceManager', 'Move &down'),
u':/services/service_down.png', u':/services/service_down.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Move item down one position in the service.'), 'Move item down one position in the service.'),
self.onServiceDown, shortcut=QtCore.Qt.Key_PageDown) self.onServiceDown, shortcuts=[QtCore.Qt.Key_PageDown])
self.serviceManagerList.moveDown.setObjectName(u'moveDown')
ActionList.add_action(self.serviceManagerList.moveDown, u'Service')
self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarButton( self.serviceManagerList.moveBottom = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move to &bottom'), translate('OpenLP.ServiceManager', 'Move to &bottom'),
u':/services/service_bottom.png', u':/services/service_bottom.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Move item to the end of the service.'), 'Move item to the end of the service.'),
self.onServiceEnd, shortcut=QtCore.Qt.Key_End) self.onServiceEnd, shortcuts=[QtCore.Qt.Key_End])
self.serviceManagerList.moveBottom.setObjectName(u'moveBottom')
ActionList.add_action(self.serviceManagerList.moveBottom, u'Service')
self.serviceManagerList.down = self.orderToolbar.addToolbarButton( self.serviceManagerList.down = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move &down'), translate('OpenLP.ServiceManager', 'Move &down'),
None, None,
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Moves the selection down the window.'), 'Moves the selection down the window.'),
self.onMoveSelectionDown, shortcut=QtCore.Qt.Key_Down) self.onMoveSelectionDown, shortcuts=[QtCore.Qt.Key_Down])
self.serviceManagerList.down.setObjectName(u'down')
ActionList.add_action(self.serviceManagerList.down, u'Service')
self.serviceManagerList.down.setVisible(False) self.serviceManagerList.down.setVisible(False)
self.serviceManagerList.up = self.orderToolbar.addToolbarButton( self.serviceManagerList.up = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move up'), translate('OpenLP.ServiceManager', 'Move up'),
None, None,
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Moves the selection up the window.'), 'Moves the selection up the window.'),
self.onMoveSelectionUp, shortcut=QtCore.Qt.Key_Up) self.onMoveSelectionUp, shortcuts=[QtCore.Qt.Key_Up])
self.serviceManagerList.up.setObjectName(u'up')
ActionList.add_action(self.serviceManagerList.up, u'Service')
self.serviceManagerList.up.setVisible(False) self.serviceManagerList.up.setVisible(False)
self.orderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.serviceManagerList.delete = self.orderToolbar.addToolbarButton( self.serviceManagerList.delete = self.orderToolbar.addToolbarButton(
@ -211,22 +223,26 @@ class ServiceManager(QtGui.QWidget):
u':/services/service_expand_all.png', u':/services/service_expand_all.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Expand all the service items.'), 'Expand all the service items.'),
self.onExpandAll, shortcut=QtCore.Qt.Key_Plus) self.onExpandAll, shortcuts=[QtCore.Qt.Key_Plus])
self.serviceManagerList.expand.setObjectName(u'expand')
ActionList.add_action(self.serviceManagerList.expand, u'Service')
self.serviceManagerList.collapse = self.orderToolbar.addToolbarButton( self.serviceManagerList.collapse = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', '&Collapse all'), translate('OpenLP.ServiceManager', '&Collapse all'),
u':/services/service_collapse_all.png', u':/services/service_collapse_all.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Collapse all the service items.'), 'Collapse all the service items.'),
self.onCollapseAll, shortcut=QtCore.Qt.Key_Minus) self.onCollapseAll, shortcuts=[QtCore.Qt.Key_Minus])
self.serviceManagerList.collapse.setObjectName(u'collapse')
ActionList.add_action(self.serviceManagerList.collapse, u'Service')
self.orderToolbar.addSeparator() self.orderToolbar.addSeparator()
self.serviceManagerList.makeLive = self.orderToolbar.addToolbarButton( self.serviceManagerList.makeLive = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Go Live'), translate('OpenLP.ServiceManager', 'Go Live'),
u':/general/general_live.png', u':/general/general_live.png',
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'Send the selected item to Live.'), 'Send the selected item to Live.'), self.makeLive,
self.makeLive, shortcut=QtCore.Qt.Key_Enter, shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return])
alternate=QtCore.Qt.Key_Return) self.serviceManagerList.makeLive.setObjectName(u'orderToolbar')
self.orderToolbar.setObjectName(u'orderToolbar') ActionList.add_action(self.serviceManagerList.makeLive, u'Service')
self.layout.addWidget(self.orderToolbar) self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots # Connect up our signals and slots
QtCore.QObject.connect(self.themeComboBox, QtCore.QObject.connect(self.themeComboBox,
@ -301,7 +317,6 @@ class ServiceManager(QtGui.QWidget):
self.themeMenu = QtGui.QMenu( self.themeMenu = QtGui.QMenu(
translate('OpenLP.ServiceManager', '&Change Item Theme')) translate('OpenLP.ServiceManager', '&Change Item Theme'))
self.menu.addMenu(self.themeMenu) self.menu.addMenu(self.themeMenu)
self.setServiceHotkeys()
self.serviceManagerList.addActions( self.serviceManagerList.addActions(
[self.serviceManagerList.moveDown, [self.serviceManagerList.moveDown,
self.serviceManagerList.moveUp, self.serviceManagerList.moveUp,
@ -315,18 +330,6 @@ class ServiceManager(QtGui.QWidget):
]) ])
self.configUpdated() self.configUpdated()
def setServiceHotkeys(self):
ActionList.add_action(self.serviceManagerList.moveDown, u'Service')
ActionList.add_action(self.serviceManagerList.moveUp, u'Service')
ActionList.add_action(self.serviceManagerList.moveTop, u'Service')
ActionList.add_action(self.serviceManagerList.moveBottom, u'Service')
ActionList.add_action(self.serviceManagerList.makeLive, u'Service')
ActionList.add_action(self.serviceManagerList.up, u'Service')
ActionList.add_action(self.serviceManagerList.down, u'Service')
ActionList.add_action(self.serviceManagerList.expand, u'Service')
ActionList.add_action(self.serviceManagerList.collapse, u'Service')
def setModified(self, modified=True): def setModified(self, modified=True):
""" """
Setter for property "modified". Sets whether or not the current service Setter for property "modified". Sets whether or not the current service

View File

@ -142,11 +142,13 @@ class SlideController(QtGui.QWidget):
u':/slides/slide_previous.png', u':/slides/slide_previous.png',
translate('OpenLP.SlideController', 'Move to previous'), translate('OpenLP.SlideController', 'Move to previous'),
self.onSlideSelectedPrevious) self.onSlideSelectedPrevious)
self.previousItem.setObjectName(u'previousItem')
self.nextItem = self.toolbar.addToolbarButton( self.nextItem = self.toolbar.addToolbarButton(
translate('OpenLP.SlideController', 'Next Slide'), translate('OpenLP.SlideController', 'Next Slide'),
u':/slides/slide_next.png', u':/slides/slide_next.png',
translate('OpenLP.SlideController', 'Move to next'), translate('OpenLP.SlideController', 'Move to next'),
self.onSlideSelectedNext) self.onSlideSelectedNext)
self.nextItem.setObjectName(u'nextItem')
self.toolbar.addToolbarSeparator(u'Close Separator') self.toolbar.addToolbarSeparator(u'Close Separator')
if self.isLive: if self.isLive:
self.hideMenu = QtGui.QToolButton(self.toolbar) self.hideMenu = QtGui.QToolButton(self.toolbar)
@ -363,9 +365,9 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged) QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
def setPreviewHotkeys(self, parent=None): def setPreviewHotkeys(self, parent=None):
self.previousItem.setShortcuts([QtCore.Qt.Key_Up, 0]) self.previousItem.setShortcuts([QtCore.Qt.Key_Up])
ActionList.add_action(self.previousItem, u'Preview Toolbar') ActionList.add_action(self.previousItem, u'Preview Toolbar')
self.nextItem.setShortcuts([QtCore.Qt.Key_Down, 0]) self.nextItem.setShortcuts([QtCore.Qt.Key_Down])
ActionList.add_action(self.nextItem, u'Preview Toolbar') ActionList.add_action(self.nextItem, u'Preview Toolbar')
def setLiveHotkeys(self, parent=None): def setLiveHotkeys(self, parent=None):
@ -376,15 +378,18 @@ class SlideController(QtGui.QWidget):
self.nextItem.setShortcuts([QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown]) self.nextItem.setShortcuts([QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown])
self.nextItem.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut) self.nextItem.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
ActionList.add_action(self.nextItem, u'Live Toolbar') ActionList.add_action(self.nextItem, u'Live Toolbar')
self.previousService = shortcut_action(parent, self.previousService = shortcut_action(parent, u'previousService',
translate('OpenLP.SlideController', 'Previous Service'), [QtCore.Qt.Key_Left], self.servicePrevious, u'Live Toolbar')
[QtCore.Qt.Key_Left, 0], self.servicePrevious, u'Live Toolbar') self.previousService.setText(
self.nextService = shortcut_action(parent, translate('OpenLP.SlideController', 'Previous Service'))
translate('OpenLP.SlideController', 'Next Service'), self.nextService = shortcut_action(parent, 'nextService',
[QtCore.Qt.Key_Right, 0], self.serviceNext, u'Live Toolbar') [QtCore.Qt.Key_Right], self.serviceNext, u'Live Toolbar')
self.escapeItem = shortcut_action(parent, self.nextService.setText(
translate('OpenLP.SlideController', 'Escape Item'), translate('OpenLP.SlideController', 'Next Service'))
[QtCore.Qt.Key_Escape, 0], self.liveEscape, u'Live Toolbar') self.escapeItem = shortcut_action(parent, 'escapeItem',
[QtCore.Qt.Key_Escape], self.liveEscape, u'Live Toolbar')
self.escapeItem.setText(
translate('OpenLP.SlideController', 'Escape Item'))
def liveEscape(self): def liveEscape(self):
self.display.setVisible(False) self.display.setVisible(False)

View File

@ -29,8 +29,6 @@ by the shortcuts system.
""" """
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class ActionCategory(object): class ActionCategory(object):
""" """
The :class:`~openlp.core.utils.ActionCategory` class encapsulates a The :class:`~openlp.core.utils.ActionCategory` class encapsulates a