toolbar: code standards

This commit is contained in:
Andreas Preikschat 2013-03-07 07:48:09 +01:00
parent 14b61cabf4
commit 33ebf40630
10 changed files with 69 additions and 68 deletions

View File

@ -202,7 +202,7 @@ class MediaManagerItem(QtGui.QWidget):
for action in toolbar_actions:
if action[0] == StringContent.Preview:
self.toolbar.addSeparator()
self.toolbar.addToolbarAction(u'%s%sAction' % (self.plugin.name, action[0]),
self.toolbar.add_toolbar_action(u'%s%sAction' % (self.plugin.name, action[0]),
text=self.plugin.getString(action[1])[u'title'], icon=action[2],
tooltip=self.plugin.getString(action[1])[u'tooltip'],
triggers=action[3])

View File

@ -45,7 +45,7 @@ VERSE = u'The Lord said to {r}Noah{/r}: \n' \
'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(50)))
VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(100)))
FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']

View File

@ -53,7 +53,7 @@ class OpenLPToolbar(QtGui.QToolBar):
self.actions = {}
log.debug(u'Init done for %s' % parent.__class__.__name__)
def addToolbarAction(self, name, **kwargs):
def add_toolbar_action(self, name, **kwargs):
"""
A method to help developers easily add a button to the toolbar.
A new QAction is created by calling ``create_action()``. The action is
@ -64,14 +64,14 @@ class OpenLPToolbar(QtGui.QToolBar):
self.actions[name] = action
return action
def addToolbarWidget(self, widget):
def add_toolbar_widget(self, widget):
"""
Add a widget and store it's handle under the widgets object name.
"""
action = self.addWidget(widget)
self.actions[widget.objectName()] = action
def setWidgetVisible(self, widgets, visible=True):
def set_widget_visible(self, widgets, visible=True):
"""
Set the visibitity for a widget or a list of widgets.

View File

@ -268,13 +268,13 @@ class MediaController(object):
controller.media_info = MediaInfo()
# Build a Media ToolBar
controller.mediabar = OpenLPToolbar(controller)
controller.mediabar.addToolbarAction(u'playbackPlay', text=u'media_playback_play',
controller.mediabar.add_toolbar_action(u'playbackPlay', text=u'media_playback_play',
icon=u':/slides/media_playback_start.png',
tooltip=translate('OpenLP.SlideController', 'Start playing media.'), triggers=controller.send_to_plugins)
controller.mediabar.addToolbarAction(u'playbackPause', text=u'media_playback_pause',
controller.mediabar.add_toolbar_action(u'playbackPause', text=u'media_playback_pause',
icon=u':/slides/media_playback_pause.png',
tooltip=translate('OpenLP.SlideController', 'Pause playing media.'), triggers=controller.send_to_plugins)
controller.mediabar.addToolbarAction(u'playbackStop', text=u'media_playback_stop',
controller.mediabar.add_toolbar_action(u'playbackStop', text=u'media_playback_stop',
icon=u':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'), triggers=controller.send_to_plugins)
# Build the seekSlider.
@ -285,7 +285,7 @@ class MediaController(object):
controller.seekSlider.setToolTip(translate('OpenLP.SlideController', 'Video position.'))
controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
controller.seekSlider.setObjectName(u'seekSlider')
controller.mediabar.addToolbarWidget(controller.seekSlider)
controller.mediabar.add_toolbar_widget(controller.seekSlider)
# Build the volumeSlider.
controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
controller.volumeSlider.setTickInterval(10)
@ -297,7 +297,7 @@ class MediaController(object):
controller.volumeSlider.setValue(controller.media_info.volume)
controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24))
controller.volumeSlider.setObjectName(u'volumeSlider')
controller.mediabar.addToolbarWidget(controller.volumeSlider)
controller.mediabar.add_toolbar_widget(controller.volumeSlider)
controller.controller_layout.addWidget(controller.mediabar)
controller.mediabar.setVisible(False)
# Signals

View File

@ -111,24 +111,24 @@ class ServiceManagerDialog(object):
"""
# Create the top toolbar
self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarAction(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
self.toolbar.add_toolbar_action(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
self.toolbar.addToolbarAction(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
self.toolbar.add_toolbar_action(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
triggers=self.on_load_service_clicked)
self.toolbar.addToolbarAction(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
self.toolbar.add_toolbar_action(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
self.toolbar.addSeparator()
self.theme_label = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
self.theme_label.setMargin(3)
self.theme_label.setObjectName(u'theme_label')
self.toolbar.addToolbarWidget(self.theme_label)
self.toolbar.add_toolbar_widget(self.theme_label)
self.theme_combo_box = QtGui.QComboBox(self.toolbar)
self.theme_combo_box.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service.'))
self.theme_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
self.theme_combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.theme_combo_box.setObjectName(u'theme_combo_box')
self.toolbar.addToolbarWidget(self.theme_combo_box)
self.toolbar.add_toolbar_widget(self.theme_combo_box)
self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar)
# Create the service manager list
@ -153,48 +153,48 @@ class ServiceManagerDialog(object):
self.order_toolbar = OpenLPToolbar(self)
action_list = ActionList.get_instance()
action_list.add_category(UiStrings().Service, CategoryOrder.standard_toolbar)
self.service_manager_list.moveTop = self.order_toolbar.addToolbarAction(u'moveTop',
self.service_manager_list.moveTop = self.order_toolbar.add_toolbar_action(u'moveTop',
text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=u':/services/service_top.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceTop)
self.service_manager_list.moveUp = self.order_toolbar.addToolbarAction(u'moveUp',
self.service_manager_list.moveUp = self.order_toolbar.add_toolbar_action(u'moveUp',
text=translate('OpenLP.ServiceManager', 'Move &up'), icon=u':/services/service_up.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceUp)
self.service_manager_list.moveDown = self.order_toolbar.addToolbarAction(u'moveDown',
self.service_manager_list.moveDown = self.order_toolbar.add_toolbar_action(u'moveDown',
text=translate('OpenLP.ServiceManager', 'Move &down'), icon=u':/services/service_down.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item down one position in the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceDown)
self.service_manager_list.moveBottom = self.order_toolbar.addToolbarAction(u'moveBottom',
self.service_manager_list.moveBottom = self.order_toolbar.add_toolbar_action(u'moveBottom',
text=translate('OpenLP.ServiceManager', 'Move to &bottom'), icon=u':/services/service_bottom.png',
tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceEnd)
self.service_manager_list.down = self.order_toolbar.addToolbarAction(u'down',
self.service_manager_list.down = self.order_toolbar.add_toolbar_action(u'down',
text=translate('OpenLP.ServiceManager', 'Move &down'), can_shortcuts=True,
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection down the window.'), visible=False,
triggers=self.on_move_selection_down)
action_list.add_action(self.service_manager_list.down)
self.service_manager_list.up = self.order_toolbar.addToolbarAction(u'up',
self.service_manager_list.up = self.order_toolbar.add_toolbar_action(u'up',
text=translate('OpenLP.ServiceManager', 'Move up'), can_shortcuts=True,
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection up the window.'), visible=False,
triggers=self.on_move_selection_up)
action_list.add_action(self.service_manager_list.up)
self.order_toolbar.addSeparator()
self.service_manager_list.delete = self.order_toolbar.addToolbarAction(u'delete', can_shortcuts=True,
self.service_manager_list.delete = self.order_toolbar.add_toolbar_action(u'delete', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Delete From Service'), icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
triggers=self.onDeleteFromService)
self.order_toolbar.addSeparator()
self.service_manager_list.expand = self.order_toolbar.addToolbarAction(u'expand', can_shortcuts=True,
self.service_manager_list.expand = self.order_toolbar.add_toolbar_action(u'expand', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Expand all'), icon=u':/services/service_expand_all.png',
tooltip=translate('OpenLP.ServiceManager', 'Expand all the service items.'),
category=UiStrings().Service, triggers=self.onExpandAll)
self.service_manager_list.collapse = self.order_toolbar.addToolbarAction(u'collapse', can_shortcuts=True,
self.service_manager_list.collapse = self.order_toolbar.add_toolbar_action(u'collapse', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=u':/services/service_collapse_all.png',
tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
category=UiStrings().Service, triggers=self.onCollapseAll)
self.order_toolbar.addSeparator()
self.service_manager_list.make_live = self.order_toolbar.addToolbarAction(u'make_live', can_shortcuts=True,
self.service_manager_list.make_live = self.order_toolbar.add_toolbar_action(u'make_live', can_shortcuts=True,
text=translate('OpenLP.ServiceManager', 'Go Live'), icon=u':/general/general_live.png',
tooltip=translate('OpenLP.ServiceManager', 'Send the selected item to Live.'),
category=UiStrings().Service,

View File

@ -195,7 +195,7 @@ class SlideController(DisplayController):
self.hide_menu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hide_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.addToolbarWidget(self.hide_menu)
self.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, u'blankScreen',
text=translate('OpenLP.SlideController', 'Blank Screen'), icon=u':/slides/slide_blank.png',
checked=False, can_shortcuts=True, category=self.category, triggers=self.onBlankDisplay)
@ -214,24 +214,24 @@ class SlideController(DisplayController):
# Wide menu of display control buttons.
self.blank_screen_button = QtGui.QToolButton(self.toolbar)
self.blank_screen_button.setObjectName(u'blank_screen_button')
self.toolbar.addToolbarWidget(self.blank_screen_button)
self.toolbar.add_toolbar_widget(self.blank_screen_button)
self.blank_screen_button.setDefaultAction(self.blank_screen)
self.theme_screen_button = QtGui.QToolButton(self.toolbar)
self.theme_screen_button.setObjectName(u'theme_screen_button')
self.toolbar.addToolbarWidget(self.theme_screen_button)
self.toolbar.add_toolbar_widget(self.theme_screen_button)
self.theme_screen_button.setDefaultAction(self.theme_screen)
self.desktop_screen_button = QtGui.QToolButton(self.toolbar)
self.desktop_screen_button.setObjectName(u'desktop_screen_button')
self.toolbar.addToolbarWidget(self.desktop_screen_button)
self.toolbar.add_toolbar_widget(self.desktop_screen_button)
self.desktop_screen_button.setDefaultAction(self.desktop_screen)
self.toolbar.addToolbarAction(u'loop_separator', separator=True)
self.toolbar.add_toolbar_action(u'loop_separator', separator=True)
# Play Slides Menu
self.play_slides_menu = QtGui.QToolButton(self.toolbar)
self.play_slides_menu.setObjectName(u'play_slides_menu')
self.play_slides_menu.setText(translate('OpenLP.SlideController', 'Play Slides'))
self.play_slides_menu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.play_slides_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Play Slides'), self.toolbar))
self.toolbar.addToolbarWidget(self.play_slides_menu)
self.toolbar.add_toolbar_widget(self.play_slides_menu)
self.play_slides_loop = create_action(self, u'playSlidesLoop', text=UiStrings().PlaySlidesInLoop,
icon=u':/media/media_time.png', checked=False, can_shortcuts=True,
category=self.category, triggers=self.onPlaySlidesLoop)
@ -250,14 +250,14 @@ class SlideController(DisplayController):
self.delay_spin_box.setRange(1, 180)
self.delay_spin_box.setSuffix(UiStrings().Seconds)
self.delay_spin_box.setToolTip(translate('OpenLP.SlideController', 'Delay between slides in seconds.'))
self.toolbar.addToolbarWidget(self.delay_spin_box)
self.toolbar.add_toolbar_widget(self.delay_spin_box)
else:
self.toolbar.addToolbarAction(u'goLive', icon=u':/general/general_live.png',
self.toolbar.add_toolbar_action(u'goLive', icon=u':/general/general_live.png',
tooltip=translate('OpenLP.SlideController', 'Move to live.'), triggers=self.onGoLive)
self.toolbar.addToolbarAction(u'addToService', icon=u':/general/general_add.png',
self.toolbar.add_toolbar_action(u'addToService', icon=u':/general/general_add.png',
tooltip=translate('OpenLP.SlideController', 'Add to Service.'), triggers=self.onPreviewAddToService)
self.toolbar.addSeparator()
self.toolbar.addToolbarAction(u'editSong', icon=u':/general/general_edit.png',
self.toolbar.add_toolbar_action(u'editSong', icon=u':/general/general_edit.png',
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.'), triggers=self.onEditSong)
self.controller_layout.addWidget(self.toolbar)
# Build the Media Toolbar
@ -269,15 +269,16 @@ class SlideController(DisplayController):
self.song_menu.setText(translate('OpenLP.SlideController', 'Go To'))
self.song_menu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.song_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
self.toolbar.addToolbarWidget(self.song_menu)
self.toolbar.add_toolbar_widget(self.song_menu)
# Stuff for items with background audio.
self.audio_pause_item = self.toolbar.addToolbarAction(u'audioPauseItem',
# FIXME: object name should be changed. But this requires that we migrate the shortcut.
self.audio_pause_item = self.toolbar.add_toolbar_action(u'audioPauseItem',
icon=u':/slides/media_playback_pause.png', text=translate('OpenLP.SlideController', 'Pause Audio'),
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
can_shortcuts=True, triggers=self.onAudioPauseClicked)
self.audioMenu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audio_pause_item.setMenu(self.audioMenu)
self.audio_menu = QtGui.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
self.audio_pause_item.setMenu(self.audio_menu)
self.audio_pause_item.setParent(self.toolbar)
self.toolbar.widgetForAction(self.audio_pause_item).setPopupMode(
QtGui.QToolButton.MenuButtonPopup)
@ -285,15 +286,15 @@ class SlideController(DisplayController):
icon=u':/slides/media_playback_next.png',
tooltip=translate('OpenLP.SlideController', 'Go to next audio track.'),
category=self.category, can_shortcuts=True, triggers=self.onNextTrackClicked)
self.audioMenu.addAction(self.nextTrackItem)
self.trackMenu = self.audioMenu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
self.audio_menu.addAction(self.nextTrackItem)
self.trackMenu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
self.audio_time_label = QtGui.QLabel(u' 00:00 ', self.toolbar)
self.audio_time_label.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
self.audio_time_label.setStyleSheet(AUDIO_TIME_LABEL_STYLESHEET)
self.audio_time_label.setObjectName(u'audio_time_label')
self.toolbar.addToolbarWidget(self.audio_time_label)
self.toolbar.setWidgetVisible(self.audio_list, False)
self.toolbar.setWidgetVisible([u'song_menu'], False)
self.toolbar.add_toolbar_widget(self.audio_time_label)
self.toolbar.set_widget_visible(self.audio_list, False)
self.toolbar.set_widget_visible([u'song_menu'], False)
# Screen preview area
self.preview_frame = QtGui.QFrame(self.splitter)
self.preview_frame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
@ -360,12 +361,12 @@ class SlideController(DisplayController):
if self.is_live:
Registry().register_function(u'slidecontroller_live_spin_delay', self.receive_spin_delay)
Registry().register_function(u'slidecontroller_toggle_display', self.toggle_display)
self.toolbar.setWidgetVisible(self.loop_list, False)
self.toolbar.setWidgetVisible(self.wide_menu, False)
self.toolbar.set_widget_visible(self.loop_list, False)
self.toolbar.set_widget_visible(self.wide_menu, False)
else:
QtCore.QObject.connect(self.preview_list_widget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
self.toolbar.setWidgetVisible([u'editSong'], False)
self.toolbar.set_widget_visible([u'editSong'], False)
if self.is_live:
self.setLiveHotkeys(self)
self.__addActionsToWidget(self.preview_list_widget)
@ -591,12 +592,12 @@ class SlideController(DisplayController):
used_space = self.toolbar.size().width() + self.hide_menu.size().width()
# The + 40 is needed to prevent flickering. This can be considered a "buffer".
if width > used_space + 40 and self.hide_menu.isVisible():
self.toolbar.setWidgetVisible(self.narrow_menu, False)
self.toolbar.setWidgetVisible(self.wide_menu)
self.toolbar.set_widget_visible(self.narrow_menu, False)
self.toolbar.set_widget_visible(self.wide_menu)
# The - 40 is needed to prevent flickering. This can be considered a "buffer".
elif width < used_space - 40 and not self.hide_menu.isVisible():
self.toolbar.setWidgetVisible(self.wide_menu, False)
self.toolbar.setWidgetVisible(self.narrow_menu)
self.toolbar.set_widget_visible(self.wide_menu, False)
self.toolbar.set_widget_visible(self.narrow_menu)
def onSongBarHandler(self):
"""
@ -638,8 +639,8 @@ class SlideController(DisplayController):
self.toolbar.hide()
self.mediabar.hide()
self.song_menu.hide()
self.toolbar.setWidgetVisible(self.loop_list, False)
self.toolbar.setWidgetVisible([u'song_menu'], False)
self.toolbar.set_widget_visible(self.loop_list, False)
self.toolbar.set_widget_visible([u'song_menu'], False)
# Reset the button
self.play_slides_once.setChecked(False)
self.play_slides_once.setIcon(build_icon(u':/media/media_time.png'))
@ -647,9 +648,9 @@ class SlideController(DisplayController):
self.play_slides_loop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
if Settings().value(self.main_window.songsSettingsSection + u'/display songbar') and self.slideList:
self.toolbar.setWidgetVisible([u'song_menu'], True)
self.toolbar.set_widget_visible([u'song_menu'], True)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loop_list)
self.toolbar.set_widget_visible(self.loop_list)
if item.is_media():
self.mediabar.show()
self.previous_item.setVisible(not item.is_media())
@ -666,9 +667,9 @@ class SlideController(DisplayController):
# See bug #791050
self.toolbar.hide()
self.mediabar.hide()
self.toolbar.setWidgetVisible([u'editSong'], False)
self.toolbar.set_widget_visible([u'editSong'], False)
if item.is_capable(ItemCapabilities.CanEdit) and item.from_plugin:
self.toolbar.setWidgetVisible([u'editSong'])
self.toolbar.set_widget_visible([u'editSong'])
elif item.is_media():
self.mediabar.show()
self.previous_item.setVisible(not item.is_media())
@ -1203,7 +1204,7 @@ class SlideController(DisplayController):
"""
Set the visibility of the audio stuff
"""
self.toolbar.setWidgetVisible(self.audio_list, visible)
self.toolbar.set_widget_visible(self.audio_list, visible)
def onAudioPauseClicked(self, checked):
"""

View File

@ -70,27 +70,27 @@ class ThemeManager(QtGui.QWidget):
self.layout.setObjectName(u'layout')
self.toolbar = OpenLPToolbar(self)
self.toolbar.setObjectName(u'toolbar')
self.toolbar.addToolbarAction(u'newTheme',
self.toolbar.add_toolbar_action(u'newTheme',
text=UiStrings().NewTheme, icon=u':/themes/theme_new.png',
tooltip=translate('OpenLP.ThemeManager', 'Create a new theme.'),
triggers=self.onAddTheme)
self.toolbar.addToolbarAction(u'editTheme',
self.toolbar.add_toolbar_action(u'editTheme',
text=translate('OpenLP.ThemeManager', 'Edit Theme'),
icon=u':/themes/theme_edit.png',
tooltip=translate('OpenLP.ThemeManager', 'Edit a theme.'),
triggers=self.on_edit_theme)
self.deleteToolbarAction = self.toolbar.addToolbarAction(u'delete_theme',
self.deleteToolbarAction = self.toolbar.add_toolbar_action(u'delete_theme',
text=translate('OpenLP.ThemeManager', 'Delete Theme'),
icon=u':/general/general_delete.png',
tooltip=translate('OpenLP.ThemeManager', 'Delete a theme.'),
triggers=self.on_delete_theme)
self.toolbar.addSeparator()
self.toolbar.addToolbarAction(u'importTheme',
self.toolbar.add_toolbar_action(u'importTheme',
text=translate('OpenLP.ThemeManager', 'Import Theme'),
icon=u':/general/general_import.png',
tooltip=translate('OpenLP.ThemeManager', 'Import a theme.'),
triggers=self.on_import_theme)
self.toolbar.addToolbarAction(u'exportTheme',
self.toolbar.add_toolbar_action(u'exportTheme',
text=translate('OpenLP.ThemeManager', 'Export Theme'),
icon=u':/general/general_export.png',
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),

View File

@ -84,9 +84,9 @@ class ImageMediaItem(MediaManagerItem):
self.listView.addAction(self.replaceAction)
def addEndHeaderBar(self):
self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction',
self.replaceAction = self.toolbar.add_toolbar_action(u'replaceAction',
icon=u':/slides/slide_blank.png', triggers=self.onReplaceClick)
self.resetAction = self.toolbar.addToolbarAction(u'resetAction',
self.resetAction = self.toolbar.add_toolbar_action(u'resetAction',
icon=u':/system/system_close.png', visible=False, triggers=self.onResetClick)
def onDeleteClick(self):

View File

@ -99,9 +99,9 @@ class MediaMediaItem(MediaManagerItem):
def addEndHeaderBar(self):
# Replace backgrounds do not work at present so remove functionality.
self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction', icon=u':/slides/slide_blank.png',
self.replaceAction = self.toolbar.add_toolbar_action(u'replaceAction', icon=u':/slides/slide_blank.png',
triggers=self.onReplaceClick)
self.resetAction = self.toolbar.addToolbarAction(u'resetAction', icon=u':/system/system_close.png',
self.resetAction = self.toolbar.add_toolbar_action(u'resetAction', icon=u':/system/system_close.png',
visible=False, triggers=self.onResetClick)
self.mediaWidget = QtGui.QWidget(self)
self.mediaWidget.setObjectName(u'mediaWidget')

View File

@ -94,7 +94,7 @@ class SongMediaItem(MediaManagerItem):
def addEndHeaderBar(self):
self.toolbar.addSeparator()
## Song Maintenance Button ##
self.maintenanceAction = self.toolbar.addToolbarAction('maintenanceAction',
self.maintenanceAction = self.toolbar.add_toolbar_action('maintenanceAction',
icon=':/songs/song_maintenance.png',
triggers=self.onSongMaintenanceClick)
self.addSearchToToolBar()