forked from openlp/openlp
Songs
This commit is contained in:
parent
9590de703a
commit
375884b1bb
@ -271,9 +271,15 @@ window.OpenLP = {
|
||||
if (typeof value[0] !== "number"){
|
||||
value[0] = OpenLP.escapeString(value[0])
|
||||
}
|
||||
var txt = "";
|
||||
if (value[2].length > 0) {
|
||||
txt = value[1] + " ( " + value[2] + " )";
|
||||
} else {
|
||||
txt = value[1];
|
||||
}
|
||||
ul.append($("<li>").append($("<a>").attr("href", "#options")
|
||||
.attr("data-rel", "dialog").attr("value", value[0])
|
||||
.click(OpenLP.showOptions).text(value[1])));
|
||||
.click(OpenLP.showOptions).text(txt)));
|
||||
});
|
||||
}
|
||||
ul.listview("refresh");
|
||||
|
@ -178,7 +178,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
||||
if invalid_verses:
|
||||
valid = create_separated_list(verse_names)
|
||||
if len(invalid_verses) > 1:
|
||||
msg = translate('SongsPlugin.EditSongForm', 'There are no verses corresponding to "%(invalid)s".'
|
||||
msg = translate('SongsPlugin.EditSongForm', 'There are no verses corresponding to "%(invalid)s". '
|
||||
'Valid entries are %(valid)s.\nPlease enter the verses separated by spaces.') % \
|
||||
{'invalid': ', '.join(invalid_verses), 'valid': valid}
|
||||
else:
|
||||
|
@ -115,7 +115,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
Is triggered when the songs config is updated
|
||||
"""
|
||||
log.debug('config_updated')
|
||||
self.search_as_you_type = Settings().value(self.settings_section + '/search as type')
|
||||
self.search_as_you_type = Settings().value('advanced/search as type')
|
||||
self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit')
|
||||
self.add_song_from_service = Settings().value(self.settings_section + '/add song from service')
|
||||
self.display_songbook = Settings().value(self.settings_section + '/display songbook')
|
||||
@ -590,4 +590,4 @@ class SongMediaItem(MediaManagerItem):
|
||||
:param show_error: Is this an error?
|
||||
"""
|
||||
search_results = self.search_entire(string)
|
||||
return [[song.id, song.title] for song in search_results]
|
||||
return [[song.id, song.title, song.alternate_title] for song in search_results]
|
||||
|
@ -121,17 +121,7 @@ class SongXML(object):
|
||||
"""
|
||||
self.song_xml = None
|
||||
verse_list = []
|
||||
if not xml.startswith('<?xml') and not xml.startswith('<song'):
|
||||
# This is an old style song, without XML. Let's handle it correctly by iterating through the verses, and
|
||||
# then recreating the internal xml object as well.
|
||||
self.song_xml = objectify.fromstring('<song version="1.0" />')
|
||||
self.lyrics = etree.SubElement(self.song_xml, 'lyrics')
|
||||
verses = xml.split('\n\n')
|
||||
for count, verse in enumerate(verses):
|
||||
verse_list.append([{'type': 'v', 'label': str(count)}, str(verse)])
|
||||
self.add_verse_to_lyrics('v', str(count), verse)
|
||||
return verse_list
|
||||
elif xml.startswith('<?xml'):
|
||||
if xml.startswith('<?xml'):
|
||||
xml = xml[38:]
|
||||
try:
|
||||
self.song_xml = objectify.fromstring(xml)
|
||||
|
@ -41,9 +41,6 @@ class SongsTab(SettingsTab):
|
||||
self.mode_group_box.setObjectName('mode_group_box')
|
||||
self.mode_layout = QtGui.QVBoxLayout(self.mode_group_box)
|
||||
self.mode_layout.setObjectName('mode_layout')
|
||||
self.search_as_type_check_box = QtGui.QCheckBox(self.mode_group_box)
|
||||
self.search_as_type_check_box.setObjectName('SearchAsType_check_box')
|
||||
self.mode_layout.addWidget(self.search_as_type_check_box)
|
||||
self.tool_bar_active_check_box = QtGui.QCheckBox(self.mode_group_box)
|
||||
self.tool_bar_active_check_box.setObjectName('tool_bar_active_check_box')
|
||||
self.mode_layout.addWidget(self.tool_bar_active_check_box)
|
||||
@ -62,7 +59,6 @@ class SongsTab(SettingsTab):
|
||||
self.left_layout.addWidget(self.mode_group_box)
|
||||
self.left_layout.addStretch()
|
||||
self.right_layout.addStretch()
|
||||
self.search_as_type_check_box.stateChanged.connect(self.on_search_as_type_check_box_changed)
|
||||
self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
|
||||
self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
|
||||
self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
|
||||
@ -71,7 +67,6 @@ class SongsTab(SettingsTab):
|
||||
|
||||
def retranslateUi(self):
|
||||
self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
|
||||
self.search_as_type_check_box.setText(translate('SongsPlugin.SongsTab', 'Enable search as you type'))
|
||||
self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab',
|
||||
'Display verses on live tool bar'))
|
||||
self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
|
||||
@ -103,13 +98,11 @@ class SongsTab(SettingsTab):
|
||||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settings_section)
|
||||
self.song_search = settings.value('search as type')
|
||||
self.tool_bar = settings.value('display songbar')
|
||||
self.update_edit = settings.value('update service on edit')
|
||||
self.update_load = settings.value('add song from service')
|
||||
self.display_songbook = settings.value('display songbook')
|
||||
self.display_copyright_symbol = settings.value('display copyright symbol')
|
||||
self.search_as_type_check_box.setChecked(self.song_search)
|
||||
self.tool_bar_active_check_box.setChecked(self.tool_bar)
|
||||
self.update_on_edit_check_box.setChecked(self.update_edit)
|
||||
self.add_from_service_check_box.setChecked(self.update_load)
|
||||
@ -120,7 +113,6 @@ class SongsTab(SettingsTab):
|
||||
def save(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settings_section)
|
||||
settings.setValue('search as type', self.song_search)
|
||||
settings.setValue('display songbar', self.tool_bar)
|
||||
settings.setValue('update service on edit', self.update_edit)
|
||||
settings.setValue('add song from service', self.update_load)
|
||||
|
@ -57,7 +57,6 @@ __default_settings__ = {
|
||||
'songs/last search type': SongSearch.Entire,
|
||||
'songs/last import type': SongFormat.OpenLyrics,
|
||||
'songs/update service on edit': False,
|
||||
'songs/search as type': True,
|
||||
'songs/add song from service': True,
|
||||
'songs/display songbar': True,
|
||||
'songs/display songbook': False,
|
||||
@ -226,11 +225,9 @@ class SongsPlugin(Plugin):
|
||||
Called to find out if the song plugin is currently using a theme.
|
||||
|
||||
:param theme: The theme to check for usage
|
||||
:return: True if the theme is being used, otherwise returns False
|
||||
:return: count of the number of times the theme is used.
|
||||
"""
|
||||
if self.manager.get_all_objects(Song, Song.theme_name == theme):
|
||||
return True
|
||||
return False
|
||||
return len(self.manager.get_all_objects(Song, Song.theme_name == theme))
|
||||
|
||||
def rename_theme(self, old_theme, new_theme):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user