forked from openlp/openlp
Amend Song and Custom to remember the item on exit from edit.
bzr-revno: 1561
This commit is contained in:
commit
ecb188dfdd
@ -111,10 +111,14 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.requiredIcons()
|
||||
self.setupUi()
|
||||
self.retranslateUi()
|
||||
self.autoSelectItem = None
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_service_load' % self.parent.name.lower()),
|
||||
self.serviceLoad)
|
||||
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_set_autoselect_item' % self.parent.name.lower()),
|
||||
self.setAutoSelectItem)
|
||||
|
||||
def requiredIcons(self):
|
||||
"""
|
||||
This method is called to define the icons for the plugin.
|
||||
@ -467,6 +471,9 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if keepFocus:
|
||||
self.listView.setFocus()
|
||||
|
||||
def setAutoSelectItem(self, itemToSelect=None):
|
||||
self.autoSelectItem = itemToSelect
|
||||
|
||||
def onLiveClick(self):
|
||||
"""
|
||||
Send an item live by building a service item then adding that service
|
||||
@ -502,7 +509,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||
translate('OpenLP.MediaManagerItem',
|
||||
'You must select one or more items.'))
|
||||
'You must select one or more items to add.'))
|
||||
else:
|
||||
# Is it posssible to process multiple list items to generate
|
||||
# multiple service items?
|
||||
|
@ -210,6 +210,11 @@ class SlideController(QtGui.QWidget):
|
||||
u'Go Live', u':/general/general_live.png',
|
||||
translate('OpenLP.SlideController', 'Move to live'),
|
||||
self.onGoLive)
|
||||
self.toolbar.addToolbarButton(
|
||||
# Does not need translating - control string.
|
||||
u'Add to Service', u':/general/general_add.png',
|
||||
translate('OpenLP.SlideController', 'Add to Service'),
|
||||
self.onPreviewAddToService)
|
||||
self.toolbar.addToolbarSeparator(u'Close Separator')
|
||||
self.toolbar.addToolbarButton(
|
||||
# Does not need translating - control string.
|
||||
@ -1044,6 +1049,12 @@ class SlideController(QtGui.QWidget):
|
||||
Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(),
|
||||
u'P:%s' % self.serviceItem.edit_id)
|
||||
|
||||
def onPreviewAddToService(self):
|
||||
"""
|
||||
From the preview display request the Item to be added to service
|
||||
"""
|
||||
self.parent.ServiceManagerContents.addServiceItem(self.serviceItem)
|
||||
|
||||
def onGoLiveClick(self):
|
||||
"""
|
||||
triggered by clicking the Preview slide items
|
||||
|
@ -114,6 +114,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
def accept(self):
|
||||
log.debug(u'accept')
|
||||
if self.saveCustom():
|
||||
Receiver.send_message(u'custom_set_autoselect_item',
|
||||
self.customSlide.title)
|
||||
Receiver.send_message(u'custom_load_list')
|
||||
QtGui.QDialog.accept(self)
|
||||
|
||||
|
@ -140,6 +140,9 @@ class CustomMediaItem(MediaManagerItem):
|
||||
custom_name.setData(
|
||||
QtCore.Qt.UserRole, QtCore.QVariant(customSlide.id))
|
||||
self.listView.addItem(custom_name)
|
||||
# Auto-select the item if name has been set
|
||||
if customSlide.title == self.autoSelectItem :
|
||||
self.listView.setCurrentItem(custom_name)
|
||||
|
||||
def onNewClick(self):
|
||||
self.parent.edit_custom_form.loadCustom(0)
|
||||
|
@ -695,6 +695,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.clearCaches()
|
||||
if self._validate_song():
|
||||
self.saveSong()
|
||||
Receiver.send_message(u'songs_set_autoselect_item',
|
||||
unicode(self.titleEdit.text()))
|
||||
Receiver.send_message(u'songs_load_list')
|
||||
QtGui.QDialog.accept(self)
|
||||
|
||||
|
@ -237,6 +237,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
song_name = QtGui.QListWidgetItem(song_detail)
|
||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||
self.listView.addItem(song_name)
|
||||
# Auto-select the item if name has been set
|
||||
if song.title == self.autoSelectItem :
|
||||
self.listView.setCurrentItem(song_name)
|
||||
|
||||
def displayResultsAuthor(self, searchresults):
|
||||
log.debug(u'display results Author')
|
||||
|
Loading…
Reference in New Issue
Block a user