Fix #1832874 and #1832876 del temp song files add info to dup song delete form

This commit is contained in:
Johnmfl 2019-06-18 20:28:09 -04:00
parent 87b408f0eb
commit beb3861ae7
2 changed files with 33 additions and 12 deletions

View File

@ -25,10 +25,11 @@ A widget representing a song in the duplicate song removal wizard review page.
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType, db
from openlp.plugins.songs.lib.openlyricsxml import SongXML from openlp.plugins.songs.lib.openlyricsxml import SongXML
class SongReviewWidget(QtWidgets.QWidget): class SongReviewWidget(QtWidgets.QWidget):
""" """
A widget representing a song on the duplicate song review page. A widget representing a song on the duplicate song review page.
@ -88,52 +89,72 @@ class SongReviewWidget(QtWidgets.QWidget):
self.song_alternate_title_content.setText(self.song.alternate_title) self.song_alternate_title_content.setText(self.song.alternate_title)
self.song_alternate_title_content.setWordWrap(True) self.song_alternate_title_content.setWordWrap(True)
self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.song_alternate_title_content) self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.song_alternate_title_content)
# Add last modified date.
self.song_last_modified_label = QtWidgets.QLabel(self)
self.song_last_modified_label.setObjectName('last_modified_label')
self.song_last_modified_label.setText('Last Modified:')
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.song_last_modified_label)
self.song_last_modified_content = QtWidgets.QLabel(self)
self.song_last_modified_content.setObjectName('last_modified_content')
self.song_last_modified_content.setText(self.song.last_modified.strftime("%Y-%m-%d %H:%M:%S"))
self.song_last_modified_content.setWordWrap(True)
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.song_last_modified_content)
# Add Theme widget.
self.song_theme_label = QtWidgets.QLabel(self)
self.song_theme_label.setObjectName('song_theme_label')
self.song_theme_label.setText('Theme:')
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.song_theme_label)
self.song_theme_content = QtWidgets.QLabel(self)
self.song_theme_content.setObjectName('song_theme_content')
self.song_theme_content.setText(self.song.theme_name)
self.song_theme_content.setWordWrap(True)
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.song_theme_content)
# Add CCLI number widget. # Add CCLI number widget.
self.song_ccli_number_label = QtWidgets.QLabel(self) self.song_ccli_number_label = QtWidgets.QLabel(self)
self.song_ccli_number_label.setObjectName('song_ccli_number_label') self.song_ccli_number_label.setObjectName('song_ccli_number_label')
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.song_ccli_number_label) self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.song_ccli_number_label)
self.song_ccli_number_content = QtWidgets.QLabel(self) self.song_ccli_number_content = QtWidgets.QLabel(self)
self.song_ccli_number_content.setObjectName('song_ccli_number_content') self.song_ccli_number_content.setObjectName('song_ccli_number_content')
self.song_ccli_number_content.setText(self.song.ccli_number) self.song_ccli_number_content.setText(self.song.ccli_number)
self.song_ccli_number_content.setWordWrap(True) self.song_ccli_number_content.setWordWrap(True)
self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.song_ccli_number_content) self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.song_ccli_number_content)
# Add copyright widget. # Add copyright widget.
self.song_copyright_label = QtWidgets.QLabel(self) self.song_copyright_label = QtWidgets.QLabel(self)
self.song_copyright_label.setObjectName('song_copyright_label') self.song_copyright_label.setObjectName('song_copyright_label')
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.song_copyright_label) self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.song_copyright_label)
self.song_copyright_content = QtWidgets.QLabel(self) self.song_copyright_content = QtWidgets.QLabel(self)
self.song_copyright_content.setObjectName('song_copyright_content') self.song_copyright_content.setObjectName('song_copyright_content')
self.song_copyright_content.setWordWrap(True) self.song_copyright_content.setWordWrap(True)
self.song_copyright_content.setText(self.song.copyright) self.song_copyright_content.setText(self.song.copyright)
self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.song_copyright_content) self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.song_copyright_content)
# Add comments widget. # Add comments widget.
self.song_comments_label = QtWidgets.QLabel(self) self.song_comments_label = QtWidgets.QLabel(self)
self.song_comments_label.setObjectName('song_comments_label') self.song_comments_label.setObjectName('song_comments_label')
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.song_comments_label) self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.song_comments_label)
self.song_comments_content = QtWidgets.QLabel(self) self.song_comments_content = QtWidgets.QLabel(self)
self.song_comments_content.setObjectName('song_comments_content') self.song_comments_content.setObjectName('song_comments_content')
self.song_comments_content.setText(self.song.comments) self.song_comments_content.setText(self.song.comments)
self.song_comments_content.setWordWrap(True) self.song_comments_content.setWordWrap(True)
self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.song_comments_content) self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.song_comments_content)
# Add authors widget. # Add authors widget.
self.song_authors_label = QtWidgets.QLabel(self) self.song_authors_label = QtWidgets.QLabel(self)
self.song_authors_label.setObjectName('song_authors_label') self.song_authors_label.setObjectName('song_authors_label')
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.song_authors_label) self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.song_authors_label)
self.song_authors_content = QtWidgets.QLabel(self) self.song_authors_content = QtWidgets.QLabel(self)
self.song_authors_content.setObjectName('song_authors_content') self.song_authors_content.setObjectName('song_authors_content')
self.song_authors_content.setWordWrap(True) self.song_authors_content.setWordWrap(True)
authors_text = ', '.join([author.display_name for author in self.song.authors]) authors_text = ', '.join([author.display_name for author in self.song.authors])
self.song_authors_content.setText(authors_text) self.song_authors_content.setText(authors_text)
self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.song_authors_content) self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.song_authors_content)
# Add verse order widget. # Add verse order widget.
self.song_verse_order_label = QtWidgets.QLabel(self) self.song_verse_order_label = QtWidgets.QLabel(self)
self.song_verse_order_label.setObjectName('song_verse_order_label') self.song_verse_order_label.setObjectName('song_verse_order_label')
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.song_verse_order_label) self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.song_verse_order_label)
self.song_verse_order_content = QtWidgets.QLabel(self) self.song_verse_order_content = QtWidgets.QLabel(self)
self.song_verse_order_content.setObjectName('song_verse_order_content') self.song_verse_order_content.setObjectName('song_verse_order_content')
self.song_verse_order_content.setText(self.song.verse_order) self.song_verse_order_content.setText(self.song.verse_order)
self.song_verse_order_content.setWordWrap(True) self.song_verse_order_content.setWordWrap(True)
self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.song_verse_order_content) self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.song_verse_order_content)
self.song_group_box_layout.addLayout(self.song_info_form_layout) self.song_group_box_layout.addLayout(self.song_info_form_layout)
# Add verses widget. # Add verses widget.
self.song_info_verse_list_widget = QtWidgets.QTableWidget(self.song_group_box) self.song_info_verse_list_widget = QtWidgets.QTableWidget(self.song_group_box)

View File

@ -423,7 +423,7 @@ class SongsPlugin(Plugin):
""" """
Remove temporary songs from the database Remove temporary songs from the database
""" """
songs = self.manager.get_all_objects(Song, Song.temporary is True) songs = self.manager.get_all_objects(Song, Song.temporary == True)
for song in songs: for song in songs:
self.manager.delete_object(Song, song.id) self.manager.delete_object(Song, song.id)