← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~smpettit/openlp/custom into lp:openlp

 

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/61696

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.

Added a "Add to service" button on the preview toolbar.  Added code to SlideController.py to cause the previewed item to be added to service
-- 
https://code.launchpad.net/~smpettit/openlp/custom/+merge/61696
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/custom into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-05-18 14:27:29 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-05-20 05:29:23 +0000
@@ -113,7 +113,6 @@
         self.retranslateUi()
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'%s_service_load' % self.parent.name.lower()),
-            self.serviceLoad)
 
     def requiredIcons(self):
         """
@@ -502,7 +501,7 @@
         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?

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-05-15 10:38:11 +0000
+++ openlp/core/ui/slidecontroller.py	2011-05-20 05:29:23 +0000
@@ -210,6 +210,11 @@
                 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 @@
         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
+        """
+        Receiver.send_message(u'%s_add_service_item' % self.serviceItem.name)
+
     def onGoLiveClick(self):
         """
         triggered by clicking the Preview slide items

=== 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-20 05:29:23 +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-20 05:29:23 +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-20 05:29:23 +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-20 05:29:23 +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')


Follow ups