forked from openlp/openlp
modified:
openlp/plugins/custom/forms/editcustomform.py openlp/plugins/custom/lib/mediaitem.py openlp/plugins/songs/forms/editsongform.py openlp/plugins/songs/lib/mediaitem.py
This commit is contained in:
parent
32127d51bb
commit
206ee04db6
@ -114,6 +114,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
def accept(self):
|
def accept(self):
|
||||||
log.debug(u'accept')
|
log.debug(u'accept')
|
||||||
if self.saveCustom():
|
if self.saveCustom():
|
||||||
|
Receiver.send_message(u'custom_set_autoselect_item',
|
||||||
|
self.customSlide.title)
|
||||||
Receiver.send_message(u'custom_load_list')
|
Receiver.send_message(u'custom_load_list')
|
||||||
QtGui.QDialog.accept(self)
|
QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
# which Custom is required.
|
# which Custom is required.
|
||||||
self.remoteCustom = -1
|
self.remoteCustom = -1
|
||||||
self.manager = parent.manager
|
self.manager = parent.manager
|
||||||
|
self.setAutoSelectItem()
|
||||||
|
|
||||||
def addEndHeaderBar(self):
|
def addEndHeaderBar(self):
|
||||||
self.addToolbarSeparator()
|
self.addToolbarSeparator()
|
||||||
@ -105,6 +106,9 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
|
QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
|
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'custom_set_autoselect_item'),
|
||||||
|
self.setAutoSelectItem)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
|
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
|
||||||
|
|
||||||
@ -140,10 +144,16 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
custom_name.setData(
|
custom_name.setData(
|
||||||
QtCore.Qt.UserRole, QtCore.QVariant(customSlide.id))
|
QtCore.Qt.UserRole, QtCore.QVariant(customSlide.id))
|
||||||
self.listView.addItem(custom_name)
|
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 setAutoSelectItem(self,itemToSelect="*"):
|
||||||
|
self.autoSelectItem = itemToSelect
|
||||||
|
|
||||||
def onNewClick(self):
|
def onNewClick(self):
|
||||||
self.parent.edit_custom_form.loadCustom(0)
|
self.parent.edit_custom_form.loadCustom(0)
|
||||||
self.parent.edit_custom_form.exec_()
|
self.parent.edit_custom_fom.exec_()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
|
|
||||||
def onRemoteEditClear(self):
|
def onRemoteEditClear(self):
|
||||||
|
@ -695,6 +695,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.clearCaches()
|
self.clearCaches()
|
||||||
if self._validate_song():
|
if self._validate_song():
|
||||||
self.saveSong()
|
self.saveSong()
|
||||||
|
Receiver.send_message(u'songs_set_autoselect_item',
|
||||||
|
unicode(self.titleEdit.text()))
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
QtGui.QDialog.accept(self)
|
QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.editItem = None
|
self.editItem = None
|
||||||
self.quickPreviewAllowed = True
|
self.quickPreviewAllowed = True
|
||||||
self.hasSearch = True
|
self.hasSearch = True
|
||||||
|
self.setAutoSelectItem()
|
||||||
|
|
||||||
def addEndHeaderBar(self):
|
def addEndHeaderBar(self):
|
||||||
self.addToolbarSeparator()
|
self.addToolbarSeparator()
|
||||||
@ -123,6 +124,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.QObject.connect(self.searchTextEdit,
|
QtCore.QObject.connect(self.searchTextEdit,
|
||||||
QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
self.onSearchTextButtonClick)
|
self.onSearchTextButtonClick)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'songs_set_autoselect_item'),
|
||||||
|
self.setAutoSelectItem)
|
||||||
|
|
||||||
def configUpdated(self):
|
def configUpdated(self):
|
||||||
self.searchAsYouType = QtCore.QSettings().value(
|
self.searchAsYouType = QtCore.QSettings().value(
|
||||||
@ -159,6 +163,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
|
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
|
|
||||||
|
def setAutoSelectItem(self,itemToSelect="*"):
|
||||||
|
self.autoSelectItem = itemToSelect
|
||||||
|
|
||||||
def onSearchTextButtonClick(self):
|
def onSearchTextButtonClick(self):
|
||||||
# Save the current search type to the configuration.
|
# Save the current search type to the configuration.
|
||||||
QtCore.QSettings().setValue(u'%s/last search type' %
|
QtCore.QSettings().setValue(u'%s/last search type' %
|
||||||
@ -237,6 +244,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
song_name = QtGui.QListWidgetItem(song_detail)
|
song_name = QtGui.QListWidgetItem(song_detail)
|
||||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||||
self.listView.addItem(song_name)
|
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):
|
def displayResultsAuthor(self, searchresults):
|
||||||
log.debug(u'display results Author')
|
log.debug(u'display results Author')
|
||||||
|
Loading…
Reference in New Issue
Block a user