openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #04862
[Merge] lp:~googol-hush/openlp/fixes into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
#690774 "Add missing songs" floods the database with duplicates
https://bugs.launchpad.net/bugs/690774
- camelCase for Ui_FileRenameDialog
- Fixed bug #690774
- Keep copyright field empty if the imported song (from the service list) does not have any copyright information.
--
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/44057
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/fixes into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2010-11-27 20:51:54 +0000
+++ openlp/core/lib/serviceitem.py 2010-12-17 14:44:09 +0000
@@ -44,6 +44,7 @@
Image = 2
Command = 3
+
class ItemCapabilities(object):
"""
Provides an enumeration of a serviceitem's capabilities
=== modified file 'openlp/core/ui/filerenamedialog.py'
--- openlp/core/ui/filerenamedialog.py 2010-11-03 18:03:28 +0000
+++ openlp/core/ui/filerenamedialog.py 2010-12-17 14:44:09 +0000
@@ -30,24 +30,24 @@
class Ui_FileRenameDialog(object):
def setupUi(self, FileRenameDialog):
- FileRenameDialog.setObjectName("FileRenameDialog")
+ FileRenameDialog.setObjectName(u'FileRenameDialog')
FileRenameDialog.resize(400, 87)
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog)
self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok)
- self.buttonBox.setObjectName("buttonBox")
+ self.buttonBox.setObjectName(u'buttonBox')
self.widget = QtGui.QWidget(FileRenameDialog)
self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35))
- self.widget.setObjectName("widget")
+ self.widget.setObjectName(u'widget')
self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.FileRenameLabel = QtGui.QLabel(self.widget)
- self.FileRenameLabel.setObjectName("FileRenameLabel")
- self.horizontalLayout.addWidget(self.FileRenameLabel)
- self.FileNameEdit = QtGui.QLineEdit(self.widget)
- self.FileNameEdit.setObjectName("FileNameEdit")
- self.horizontalLayout.addWidget(self.FileNameEdit)
+ self.horizontalLayout.setObjectName(u'horizontalLayout')
+ self.fileRenameLabel = QtGui.QLabel(self.widget)
+ self.fileRenameLabel.setObjectName(u'fileRenameLabel')
+ self.horizontalLayout.addWidget(self.fileRenameLabel)
+ self.fileNameEdit = QtGui.QLineEdit(self.widget)
+ self.fileNameEdit.setObjectName(u'fileNameEdit')
+ self.horizontalLayout.addWidget(self.fileNameEdit)
self.retranslateUi(FileRenameDialog)
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog)
@@ -55,6 +55,5 @@
def retranslateUi(self, FileRenameDialog):
FileRenameDialog.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename'))
- self.FileRenameLabel.setText(translate('OpenLP.FileRenameForm',
+ self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:'))
-
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2010-12-11 20:49:50 +0000
+++ openlp/core/ui/thememanager.py 2010-12-17 14:44:09 +0000
@@ -225,10 +225,10 @@
"""
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
- self.fileRenameForm.FileNameEdit.setText(oldThemeName)
+ self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = u''
if self.fileRenameForm.exec_():
- newThemeName = unicode(self.fileRenameForm.FileNameEdit.text())
+ newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
oldThemeData = self.getThemeData(oldThemeName)
self.deleteTheme(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName)
@@ -239,10 +239,10 @@
"""
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
- self.fileRenameForm.FileNameEdit.setText(oldThemeName)
+ self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = u''
if self.fileRenameForm.exec_():
- newThemeName = unicode(self.fileRenameForm.FileNameEdit.text())
+ newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName)
self.loadThemes()
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2010-12-09 15:08:04 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2010-12-17 14:44:09 +0000
@@ -44,6 +44,7 @@
self.PluginName = u'Songs'
BaseListWithDnD.__init__(self, parent)
+
class SongMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Songs.
@@ -392,7 +393,7 @@
author_audit.append(unicode(author.display_name))
raw_footer.append(song.title)
raw_footer.append(author_list)
- raw_footer.append(song.copyright )
+ raw_footer.append(song.copyright)
raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
QtCore.QSettings().value(u'general/ccli number',
@@ -417,27 +418,37 @@
item.data_string[u'title'].split(u'@')[0].lower() ,
Song.search_title.asc())
author_list = item.data_string[u'authors'].split(u', ')
+ # The service item always has an author (at least it has u'' as
+ # author). However, songs saved in the database do not have to have
+ # an author.
+ if u'' in author_list:
+ author_list.remove(u'')
editId = 0
uuid = item._uuid
+ add_song = True
if search_results:
for song in search_results:
- count = 0
- for author in song.authors:
- if author.display_name in author_list:
- count += 1
- # All Authors the same
- if count == len(author_list):
+ same_authors = True
+ # If the author counts are different, we do not have to do
+ # any further checking. This is also important when a song
+ # does not have any author (because we can not loop over an
+ # empty list).
+ if len(song.authors) == len(author_list):
+ for author in song.authors:
+ if author.display_name not in author_list:
+ same_authors = False
+ else:
+ same_authors = False
+ # All authors are the same, so we can stop here and the song
+ # does not have to be saved.
+ if same_authors:
+ add_song = False
editId = song.id
- else:
- # Authors different
- if self.addSongFromService:
- editId = self.openLyrics. \
- xml_to_song(item.xml_version)
- else:
- # Title does not match
+ break
+ if add_song:
if self.addSongFromService:
editId = self.openLyrics.xml_to_song(item.xml_version)
- # Update service with correct song id
+ # Update service with correct song id.
if editId != 0:
Receiver.send_message(u'service_item_update',
u'%s:%s' %(editId, uuid))
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2010-12-11 10:46:11 +0000
+++ openlp/plugins/songs/lib/xml.py 2010-12-17 14:44:09 +0000
@@ -297,6 +297,8 @@
song_xml = objectify.fromstring(xml)
properties = song_xml.properties
song.copyright = unicode(properties.copyright.text)
+ if song.copyright == u'None':
+ song.copyright = u''
song.verse_order = unicode(properties.verseOrder.text)
if song.verse_order == u'None':
song.verse_order = u''
@@ -357,7 +359,7 @@
def _add_text_to_element(self, tag, parent, text=None, label=None):
if label:
- element = etree.Element(tag, name = unicode(label))
+ element = etree.Element(tag, name=unicode(label))
else:
element = etree.Element(tag)
if text:
Follow ups