openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00774
[Merge] lp:~trb143/openlp/fixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Clean up song editing
Fix wonky expansion in service manager
--
https://code.launchpad.net/~trb143/openlp/fixes/+merge/14378
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-10-29 15:57:58 +0000
+++ openlp/core/lib/eventreceiver.py 2009-11-03 18:50:27 +0000
@@ -93,9 +93,6 @@
``config_updated``
Informs components the config has changed
- ``edit_song``
- Requests the current song on the preview display be loaded for edit
-
``preview_song``
Tells the song plugin the edit has finished and the song can be previewed
Only available if the edit was triggered by the Preview button.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-11-03 01:37:08 +0000
+++ openlp/core/ui/servicemanager.py 2009-11-03 18:50:27 +0000
@@ -162,6 +162,7 @@
QtGui.QAbstractItemView.DragDrop)
self.ServiceManagerList.setAlternatingRowColors(True)
self.ServiceManagerList.setHeaderHidden(True)
+ self.ServiceManagerList.setExpandsOnDoubleClick(False)
self.ServiceManagerList.setObjectName(u'ServiceManagerList')
# enable drop
self.ServiceManagerList.__class__.dragEnterEvent = self.dragEnterEvent
@@ -584,7 +585,7 @@
item, count = self.findServiceItem()
if self.serviceItems[item][u'data'].editEnabled:
self.remoteEditTriggered = True
- Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'data'].name,
+ Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'data'].name, u'L:%s' %
self.serviceItems[item][u'data'].editId )
def onRemoteEditClear(self):
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-11-02 01:03:27 +0000
+++ openlp/core/ui/slidecontroller.py 2009-11-03 18:50:27 +0000
@@ -323,7 +323,7 @@
"""
Allows the Preview toolbar to be customised
"""
- if item.name == u'Songs' and item.fromPlugin:
+ if (item.name == u'Songs' or item.name == u'Custom') and item.fromPlugin:
self.Toolbar.makeWidgetsVisible(self.song_list)
else:
self.Toolbar.makeWidgetsInvisible(self.song_list)
@@ -561,7 +561,8 @@
def onEditSong(self):
self.songEdit = True
- Receiver().send_message(u'edit_song')
+ Receiver().send_message(u'%s_edit' % self.commandItem.name, u'P:%s' %
+ self.commandItem.editId )
def onGoLive(self):
"""
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-11-01 09:07:10 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-11-03 18:50:27 +0000
@@ -53,12 +53,10 @@
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
- #fromPreview holds the id of the item if the song editor needs to trigger a preview
- #without closing. It is set to -1 if this function is inactive
- self.fromPreview = -1
- #fromServiceManager holds the id of the item if the song editor needs to trigger posting
- #to the servicemanager without closing. It is set to -1 if this function is inactive
- self.fromServiceManager = -1
+ #Holds information about whether the edit is remotly triggered and which
+ #Song is required.
+ self.remoteTriggered = None
+ self.remoteSong = -1
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8(u'Song')
@@ -129,8 +127,6 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'edit_song'), self.onEventEditSong)
- QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'preview_song'), self.onPreviewClick)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_edit' % self.parent.name), self.onRemoteEdit)
@@ -172,6 +168,14 @@
search_results = self.parent.songmanager.get_song_from_author(
search_keywords)
self.displayResultsAuthor(search_results)
+ #Called to redisplay the song list screen edith from a search
+ #or from the exit of the Song edit dialog. If remote editing is active
+ #Trigger it and clean up so it will not update again.
+ if self.remoteTriggered == u'L':
+ self.onAddClick()
+ if self.remoteTriggered == u'P':
+ self.onPreviewClick()
+ self.onRemoteEditClear()
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
@@ -188,12 +192,6 @@
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name)
- if song.id == self.fromPreview:
- self.ListView.setCurrentItem(song_name)
- self.onPreviewClick()
- self.fromPreview = -1
- if song.id == self.fromServiceManager:
- self.onAddClick()
def displayResultsAuthor(self, searchresults):
log.debug(u'display results Author')
@@ -213,6 +211,11 @@
self.SearchTextEdit.clear()
def onSearchTextEditChanged(self, text):
+ """
+ If search as type enabled invoke the search on each key press.
+ If the Lyrics are being searched do not start till 7 characters
+ have been entered.
+ """
if self.searchAsYouType:
search_length = 1
if self.SearchTypeComboBox.currentIndex() == 1:
@@ -240,28 +243,30 @@
self.song_maintenance_form.exec_()
def onRemoteEditClear(self):
- self.fromServiceManager = -1
+ self.remoteTriggered = None
+ self.remoteSong = -1
def onRemoteEdit(self, songid):
- valid = self.parent.songmanager.get_song(songid)
+ """
+ Called by ServiceManager or SlideController by event passing
+ the Song Id in the payload along with an indicator to say which
+ type of display is required.
+ """
+ fields = songid.split(u':')
+ valid = self.parent.songmanager.get_song(fields[1])
if valid is not None:
- self.fromServiceManager = songid
- self.edit_song_form.loadSong(songid, False)
+ self.remoteSong = fields[1]
+ self.remoteTriggered = fields[0]
+ self.edit_song_form.loadSong(fields[1], (fields[0] == u'P'))
self.edit_song_form.exec_()
def onEditClick(self, preview=False):
item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
- self.fromPreview = -1
- if preview:
- self.fromPreview = item_id
- self.edit_song_form.loadSong(item_id, preview)
+ self.edit_song_form.loadSong(item_id, False)
self.edit_song_form.exec_()
- def onEventEditSong (self):
- self.onEditClick(True)
-
def onDeleteClick(self):
item = self.ListView.currentItem()
if item is not None:
@@ -271,21 +276,17 @@
self.ListView.takeItem(row)
def generateSlideData(self, service_item):
- #raw_slides =[]
raw_footer = []
author_list = u''
author_audit = []
ccl = u''
- if self.fromServiceManager == -1:
+ if self.remoteTriggered is None:
item = self.ListView.currentItem()
if item is None:
return False
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
- item_id = self.fromServiceManager
- #if we are in preview mode do not reset the servicemanage id
- if self.fromPreview != -1:
- self.fromServiceManager = -1
+ item_id = self.remoteSong
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
service_item.editEnabled = True
Follow ups