Stevan Pettit has proposed merging lp:~smpettit/openlp/custom into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~smpettit/openlp/custom/+merge/61677
Added code to Custom and Songs to reselect the selected item, after an edit of
the item is finished.
Prior to this change, when the item list was refreshed and the selection was
lost.
--
https://code.launchpad.net/~smpettit/openlp/custom/+merge/61677
Your team OpenLP Core is requested to review the proposed merge of
lp:~smpettit/openlp/custom into lp:openlp.
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2011-05-19 03:19:36 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2011-05-19 22:50:13 +0000
@@ -114,6 +114,8 @@
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)
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2011-05-19 04:48:10 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2011-05-19 22:50:13 +0000
@@ -62,6 +62,7 @@
# which Custom is required.
self.remoteCustom = -1
self.manager = parent.manager
+ self.setAutoSelectItem()
def addEndHeaderBar(self):
self.addToolbarSeparator()
@@ -106,6 +107,9 @@
QtCore.QObject.connect(Receiver.get_receiver(),
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.SIGNAL(u'custom_preview'), self.onPreviewClick)
def retranslateUi(self):
@@ -140,6 +144,12 @@
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 setAutoSelectItem(self,itemToSelect="*"):
+ self.autoSelectItem = itemToSelect
def onNewClick(self):
self.parent.edit_custom_form.loadCustom(0)
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2011-04-29 06:15:10 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2011-05-19 22:50:13 +0000
@@ -695,6 +695,8 @@
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)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2011-05-19 04:42:10 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2011-05-19 22:50:13 +0000
@@ -73,6 +73,7 @@
self.editItem = None
self.quickPreviewAllowed = True
self.hasSearch = True
+ self.setAutoSelectItem()
def addEndHeaderBar(self):
self.addToolbarSeparator()
@@ -123,6 +124,9 @@
QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'songs_set_autoselect_item'),
+ self.setAutoSelectItem)
def configUpdated(self):
self.searchAsYouType = QtCore.QSettings().value(
@@ -159,6 +163,9 @@
QtCore.QVariant(SongSearch.Entire)).toInt()[0])
self.configUpdated()
+ def setAutoSelectItem(self,itemToSelect="*"):
+ self.autoSelectItem = itemToSelect
+
def onSearchTextButtonClick(self):
# Save the current search type to the configuration.
QtCore.QSettings().setValue(u'%s/last search type' %
@@ -237,6 +244,9 @@
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')
_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openlp-core
More help : https://help.launchpad.net/ListHelp