← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/fbeta3 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/fbeta3 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #752374 in OpenLP: "zipping through service with arrows"
  https://bugs.launchpad.net/openlp/+bug/752374
  Bug #763583 in OpenLP: "Songs should be able to be Cloned"
  https://bugs.launchpad.net/openlp/+bug/763583

For more details, see:
https://code.launchpad.net/~trb143/openlp/fbeta3/+merge/66683

Add ability to clone a song with a full copy of it.
Add missing build_icon and line wrap error.

Slow down event generation to stop flood of messages which crash the system.  UI does not notice the change.
-- 
https://code.launchpad.net/~trb143/openlp/fbeta3/+merge/66683
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/fbeta3 into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-06-12 16:02:52 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-07-02 06:58:29 +0000
@@ -288,6 +288,7 @@
                 self.listView, u':/general/general_add.png',
                 translate('OpenLP.MediaManagerItem',
                 '&Add to selected Service Item'), self.onAddEditClick)
+        self.addCustomContextActions()
         # Create the context menu and add all actions from the listView.
         self.menu = QtGui.QMenu()
         self.menu.addActions(self.listView.actions())
@@ -301,6 +302,13 @@
             QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
             self.contextMenu)
 
+    def addCustomContextActions(self):
+        """
+        Implement this method in your descendent media manager item to
+        add any context menu items. This method is called automatically.
+        """
+        pass
+
     def initialise(self):
         """
         Implement this method in your descendent media manager item to

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-07-01 08:26:26 +0000
+++ openlp/core/ui/servicemanager.py	2011-07-02 06:58:29 +0000
@@ -48,18 +48,18 @@
     """
     Set up key bindings and mouse behaviour for the service list
     """
-    def __init__(self, mainwindow, parent=None, name=None):
+    def __init__(self, serviceManager, parent=None, name=None):
         QtGui.QTreeWidget.__init__(self, parent)
-        self.mainwindow = mainwindow
+        self.serviceManager = serviceManager
 
     def keyPressEvent(self, event):
         if isinstance(event, QtGui.QKeyEvent):
             # here accept the event and do something
             if event.key() == QtCore.Qt.Key_Up:
-                self.mainwindow.onMoveSelectionUp()
+                self.serviceManager.onMoveSelectionUp()
                 event.accept()
             elif event.key() == QtCore.Qt.Key_Down:
-                self.mainwindow.onMoveSelectionDown()
+                self.serviceManager.onMoveSelectionDown()
                 event.accept()
             event.ignore()
         else:

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-06-24 06:53:56 +0000
+++ openlp/core/ui/slidecontroller.py	2011-07-02 06:58:29 +0000
@@ -27,6 +27,7 @@
 
 import logging
 import os
+import time
 
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
@@ -412,9 +413,11 @@
         self.display.videoStop()
 
     def servicePrevious(self):
+        time.sleep(0.1)
         Receiver.send_message('servicemanager_previous_item')
 
     def serviceNext(self):
+        time.sleep(0.1)
         Receiver.send_message('servicemanager_next_item')
 
     def screenSizeChanged(self):

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-06-12 17:56:11 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-07-02 06:58:29 +0000
@@ -34,7 +34,8 @@
     translate
 from openlp.core.lib.searchedit import SearchEdit
 from openlp.core.lib.ui import UiStrings, add_widget_completer, \
-    media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box
+    media_item_combo_box, critical_error_message_box, \
+    find_and_set_in_combo_box, build_icon
 from openlp.plugins.bibles.forms import BibleImportForm
 from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
     VerseReferenceList, get_reference_match
@@ -57,8 +58,8 @@
 
     def __init__(self, parent, plugin, icon):
         self.IconPath = u'songs/song'
-        self.lockIcon = QtGui.QIcon(u':/bibles/bibles_search_lock.png')
-        self.unlockIcon = QtGui.QIcon(u':/bibles/bibles_search_unlock.png')
+        self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png')
+        self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
         MediaManagerItem.__init__(self, parent, plugin, icon)
         # Place to store the search results for both bibles.
         self.settings = self.plugin.settings_tab
@@ -983,7 +984,8 @@
         Search for some Bible verses (by reference).
         """
         bible = unicode(self.quickVersionComboBox.currentText())
-        search_results = self.plugin.manager.get_verses(bible, string, False, False)
+        search_results = self.plugin.manager.get_verses(bible, string, False,
+            False)
         if search_results:
             versetext = u' '.join([verse.text for verse in search_results])
             return [[string, versetext]]

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-06-29 06:53:15 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-07-02 06:58:29 +0000
@@ -35,7 +35,8 @@
 from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
     translate, check_item_selected, PluginStatus
 from openlp.core.lib.searchedit import SearchEdit
-from openlp.core.lib.ui import UiStrings
+from openlp.core.lib.ui import UiStrings, context_menu_action, \
+    context_menu_separator
 from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
     SongImportForm, SongExportForm
 from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
@@ -128,6 +129,13 @@
             QtCore.SIGNAL(u'searchTypeChanged(int)'),
             self.onSearchTextButtonClick)
 
+    def addCustomContextActions(self):
+        context_menu_separator(self.listView)
+        context_menu_action(
+            self.listView, u':/general/general_add.png',
+            translate('OpenLP.MediaManagerItem',
+            '&Clone.'), self.onCloneClick)
+
     def onFocus(self):
         self.searchTextEdit.setFocus()
 
@@ -366,6 +374,23 @@
                 self.plugin.manager.delete_object(Song, item_id)
             self.onSearchTextButtonClick()
 
+    def onCloneClick(self):
+        """
+        Clone a Song
+        """
+        log.debug(u'onCloneClick')
+        if check_item_selected(self.listView, UiStrings().SelectEdit):
+            self.editItem = self.listView.currentItem()
+            item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
+            old_song = self.plugin.manager.get_object(Song, item_id)
+            song_xml = self.openLyrics.song_to_xml(old_song)
+            new_song_id = self.openLyrics.xml_to_song(song_xml)
+            new_song = self.plugin.manager.get_object(Song, new_song_id)
+            new_song.title = u'%s <%s>' % (new_song.title,
+                translate('SongsPlugin.MediaItem', 'copy'))
+            self.plugin.manager.save_object(new_song)
+        self.onSongListLoad()
+
     def generateSlideData(self, service_item, item=None, xmlVersion=False):
         log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
         item_id = self._getIdOfItemToGenerate(item, self.remoteSong)


Follow ups