← 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:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~smpettit/openlp/custom/+merge/61875

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/61875
Your team OpenLP Core is subscribed to branch 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-21 20:35:50 +0000
@@ -114,7 +114,10 @@
         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 +470,9 @@
                 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 +508,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-20 10:23:48 +0000
+++ openlp/core/ui/slidecontroller.py	2011-05-21 20:35:50 +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
+        """
+        self.parent.ServiceManagerContents.addServiceItem(self.serviceItem)
+
     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-21 20:35:50 +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-21 20:35:50 +0000
@@ -62,6 +62,7 @@
         # which Custom is required.
         self.remoteCustom = -1
         self.manager = parent.manager
+        self.autoSelectItem = None
 
     def addEndHeaderBar(self):
         self.addToolbarSeparator()
@@ -140,6 +141,9 @@
             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)

=== 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-21 20:35:50 +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-21 20:35:50 +0000
@@ -73,6 +73,7 @@
         self.editItem = None
         self.quickPreviewAllowed = True
         self.hasSearch = True
+        self.autoSelectItem = None
 
     def addEndHeaderBar(self):
         self.addToolbarSeparator()
@@ -237,6 +238,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