- 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.

bzr-revno: 1151
Fixes: https://launchpad.net/bugs/690774
This commit is contained in:
andreas 2010-12-18 08:53:29 +00:00 committed by Tim Bentley
commit 18e75b7824
5 changed files with 45 additions and 32 deletions

View File

@ -44,6 +44,7 @@ class ServiceItemType(object):
Image = 2
Command = 3
class ItemCapabilities(object):
"""
Provides an enumeration of a serviceitem's capabilities

View File

@ -30,24 +30,24 @@ from openlp.core.lib import translate
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 @@ class Ui_FileRenameDialog(object):
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:'))

View File

@ -225,10 +225,10 @@ class ThemeManager(QtGui.QWidget):
"""
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 @@ class ThemeManager(QtGui.QWidget):
"""
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()

View File

@ -44,6 +44,7 @@ class SongListView(BaseListWithDnD):
self.PluginName = u'Songs'
BaseListWithDnD.__init__(self, parent)
class SongMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Songs.
@ -392,7 +393,7 @@ class SongMediaItem(MediaManagerItem):
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 @@ class SongMediaItem(MediaManagerItem):
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):
editId = song.id
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:
# Authors different
if self.addSongFromService:
editId = self.openLyrics. \
xml_to_song(item.xml_version)
else:
# Title does not match
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
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))

View File

@ -297,6 +297,8 @@ class OpenLyricsParser(object):
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 @@ class OpenLyricsParser(object):
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: