forked from openlp/openlp
minor updates
This commit is contained in:
parent
c8dad716cc
commit
6586104f6e
@ -55,6 +55,7 @@ def report_song_list():
|
|||||||
if not report_file_name.endswith('csv'):
|
if not report_file_name.endswith('csv'):
|
||||||
report_file_name += '.csv'
|
report_file_name += '.csv'
|
||||||
file_handle = None
|
file_handle = None
|
||||||
|
Registry().get('application').set_busy_cursor()
|
||||||
try:
|
try:
|
||||||
file_handle = open(report_file_name, 'wt')
|
file_handle = open(report_file_name, 'wt')
|
||||||
fieldnames = ('Title', 'Alternative Title', 'Copyright', 'Author(s)', 'Song Book', 'Topic')
|
fieldnames = ('Title', 'Alternative Title', 'Copyright', 'Author(s)', 'Song Book', 'Topic')
|
||||||
@ -66,29 +67,31 @@ def report_song_list():
|
|||||||
author_list = []
|
author_list = []
|
||||||
for author_song in song.authors_songs:
|
for author_song in song.authors_songs:
|
||||||
author_list.append(author_song.author.display_name)
|
author_list.append(author_song.author.display_name)
|
||||||
author_string = '{name}'.format(name=' | '.join(author_list))
|
author_string = ' | '.join(author_list)
|
||||||
book_list = []
|
book_list = []
|
||||||
for book_song in song.songbook_entries:
|
for book_song in song.songbook_entries:
|
||||||
if hasattr(book_song, 'entry') and book_song.entry:
|
if hasattr(book_song, 'entry') and book_song.entry:
|
||||||
book_list.append('{name} #{entry}'.format(name=book_song.songbook.name, entry=book_song.entry))
|
book_list.append('{name} #{entry}'.format(name=book_song.songbook.name, entry=book_song.entry))
|
||||||
book_string = '{name}'.format(name=' | '.join(book_list))
|
book_string = ' | '.join(book_list)
|
||||||
topic_list = []
|
topic_list = []
|
||||||
for topic_song in song.topics:
|
for topic_song in song.topics:
|
||||||
if hasattr(topic_song, 'name'):
|
if hasattr(topic_song, 'name'):
|
||||||
topic_list.append(topic_song.name)
|
topic_list.append(topic_song.name)
|
||||||
topic_string = '{name}'.format(name=' | '.join(topic_list))
|
topic_string = ' | '.join(topic_list)
|
||||||
writer.writerow({'Title': song.title,
|
writer.writerow({'Title': song.title,
|
||||||
'Alternative Title': song.alternate_title,
|
'Alternative Title': song.alternate_title,
|
||||||
'Copyright': song.copyright,
|
'Copyright': song.copyright,
|
||||||
'Author(s)': author_string,
|
'Author(s)': author_string,
|
||||||
'Song Book': book_string,
|
'Song Book': book_string,
|
||||||
'Topic': topic_string})
|
'Topic': topic_string})
|
||||||
|
Registry().get('application').set_normal_cursor()
|
||||||
main_window.information_message(
|
main_window.information_message(
|
||||||
translate('SongPlugin.ReportSongList', 'Report Creation'),
|
translate('SongPlugin.ReportSongList', 'Report Creation'),
|
||||||
translate('SongPlugin.ReportSongList',
|
translate('SongPlugin.ReportSongList',
|
||||||
'Report \n{name} \nhas been successfully created. ').format(name=report_file_name)
|
'Report \n{name} \nhas been successfully created. ').format(name=report_file_name)
|
||||||
)
|
)
|
||||||
except OSError as ose:
|
except OSError as ose:
|
||||||
|
Registry().get('application').set_normal_cursor()
|
||||||
log.exception('Failed to write out song usage records')
|
log.exception('Failed to write out song usage records')
|
||||||
critical_error_message_box(translate('SongPlugin.ReportSongList', 'Song Extraction Failed'),
|
critical_error_message_box(translate('SongPlugin.ReportSongList', 'Song Extraction Failed'),
|
||||||
translate('SongPlugin.ReportSongList',
|
translate('SongPlugin.ReportSongList',
|
||||||
|
Loading…
Reference in New Issue
Block a user