Merge lp:~johnmfl/openlp/delete_temp_songs_add_fields_dupsongreview into lp:openlp

Proposed by Johnthan
Status: Merged
Merged at revision: 2882
Proposed branch: lp:~johnmfl/openlp/delete_temp_songs_add_fields_dupsongreview
Merge into: lp:openlp
Diff against target: 98 lines (+31/-11)
2 files modified
openlp/plugins/songs/forms/songreviewwidget.py (+30/-10)
openlp/plugins/songs/songsplugin.py (+1/-1)
To merge this branch: bzr merge lp:~johnmfl/openlp/delete_temp_songs_add_fields_dupsongreview
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Tomas Groth Approve
Raoul Snyman Approve
Review via email: mp+369062@code.launchpad.net

This proposal supersedes a proposal from 2019-06-19.

Commit message

#1832874
changed songsplugin.py from `is true` to `== True` to force the deletion of
temporary song records in the database on closing OpenLP. This may not be
proper python, but the database appears to need the `== True` to function
correctly.

#1832876
Change songreviewwidget.py to add the `last modified` date and the
`theme` used by the song. The bug lists 3 fields that would help
determine what song to delete...the user only wanted the last modified
date. I added the theme and songbook name, but the songbook name
was not added in this update...If I am the only person that wants the
songbook name it isn't worth the time to add.

Description of the change

#1832874
changed songsplugin.py from `is true` to `== True` to force the deletion of
temporary song records in the database on closing OpenLP. This may not be
proper python, but the database appears to need the `== True` to function
correctly.

#1832876
Change songreviewwidget.py to add the `last modified` date and the
`theme` used by the song. The bug lists 3 fields that would help
determine what song to delete...the user only wanted the last modified
date. I added the theme and songbook name, but the songbook name
was not added in this update...If I am the only person that wants the
songbook name it isn't worth the time to add.

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linting failed, please see https://ci.openlp.io/job/MP-03-Linting/122/ for more details

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linting failed, please see https://ci.openlp.io/job/MP-03-Linting/123/ for more details

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linting passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

macOS tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Technically you are supposed to have a test included, but for this first time I'll let it pass.

review: Approve
Revision history for this message
Tomas Groth (tomasgroth) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/forms/songreviewwidget.py'
2--- openlp/plugins/songs/forms/songreviewwidget.py 2019-04-13 13:00:22 +0000
3+++ openlp/plugins/songs/forms/songreviewwidget.py 2019-06-19 20:56:02 +0000
4@@ -88,52 +88,72 @@
5 self.song_alternate_title_content.setText(self.song.alternate_title)
6 self.song_alternate_title_content.setWordWrap(True)
7 self.song_info_form_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.song_alternate_title_content)
8+ # Add last modified date.
9+ self.song_last_modified_label = QtWidgets.QLabel(self)
10+ self.song_last_modified_label.setObjectName('last_modified_label')
11+ self.song_last_modified_label.setText('Last Modified:')
12+ self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.song_last_modified_label)
13+ self.song_last_modified_content = QtWidgets.QLabel(self)
14+ self.song_last_modified_content.setObjectName('last_modified_content')
15+ self.song_last_modified_content.setText(self.song.last_modified.strftime("%Y-%m-%d %H:%M:%S"))
16+ self.song_last_modified_content.setWordWrap(True)
17+ self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.song_last_modified_content)
18+ # Add Theme widget.
19+ self.song_theme_label = QtWidgets.QLabel(self)
20+ self.song_theme_label.setObjectName('song_theme_label')
21+ self.song_theme_label.setText('Theme:')
22+ self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.song_theme_label)
23+ self.song_theme_content = QtWidgets.QLabel(self)
24+ self.song_theme_content.setObjectName('song_theme_content')
25+ self.song_theme_content.setText(self.song.theme_name)
26+ self.song_theme_content.setWordWrap(True)
27+ self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.song_theme_content)
28 # Add CCLI number widget.
29 self.song_ccli_number_label = QtWidgets.QLabel(self)
30 self.song_ccli_number_label.setObjectName('song_ccli_number_label')
31- self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.song_ccli_number_label)
32+ self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.song_ccli_number_label)
33 self.song_ccli_number_content = QtWidgets.QLabel(self)
34 self.song_ccli_number_content.setObjectName('song_ccli_number_content')
35 self.song_ccli_number_content.setText(self.song.ccli_number)
36 self.song_ccli_number_content.setWordWrap(True)
37- self.song_info_form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.song_ccli_number_content)
38+ self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.song_ccli_number_content)
39 # Add copyright widget.
40 self.song_copyright_label = QtWidgets.QLabel(self)
41 self.song_copyright_label.setObjectName('song_copyright_label')
42- self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.song_copyright_label)
43+ self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.song_copyright_label)
44 self.song_copyright_content = QtWidgets.QLabel(self)
45 self.song_copyright_content.setObjectName('song_copyright_content')
46 self.song_copyright_content.setWordWrap(True)
47 self.song_copyright_content.setText(self.song.copyright)
48- self.song_info_form_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.song_copyright_content)
49+ self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.song_copyright_content)
50 # Add comments widget.
51 self.song_comments_label = QtWidgets.QLabel(self)
52 self.song_comments_label.setObjectName('song_comments_label')
53- self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.song_comments_label)
54+ self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.song_comments_label)
55 self.song_comments_content = QtWidgets.QLabel(self)
56 self.song_comments_content.setObjectName('song_comments_content')
57 self.song_comments_content.setText(self.song.comments)
58 self.song_comments_content.setWordWrap(True)
59- self.song_info_form_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.song_comments_content)
60+ self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.song_comments_content)
61 # Add authors widget.
62 self.song_authors_label = QtWidgets.QLabel(self)
63 self.song_authors_label.setObjectName('song_authors_label')
64- self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.song_authors_label)
65+ self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.song_authors_label)
66 self.song_authors_content = QtWidgets.QLabel(self)
67 self.song_authors_content.setObjectName('song_authors_content')
68 self.song_authors_content.setWordWrap(True)
69 authors_text = ', '.join([author.display_name for author in self.song.authors])
70 self.song_authors_content.setText(authors_text)
71- self.song_info_form_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.song_authors_content)
72+ self.song_info_form_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.song_authors_content)
73 # Add verse order widget.
74 self.song_verse_order_label = QtWidgets.QLabel(self)
75 self.song_verse_order_label.setObjectName('song_verse_order_label')
76- self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.song_verse_order_label)
77+ self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.song_verse_order_label)
78 self.song_verse_order_content = QtWidgets.QLabel(self)
79 self.song_verse_order_content.setObjectName('song_verse_order_content')
80 self.song_verse_order_content.setText(self.song.verse_order)
81 self.song_verse_order_content.setWordWrap(True)
82- self.song_info_form_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.song_verse_order_content)
83+ self.song_info_form_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.song_verse_order_content)
84 self.song_group_box_layout.addLayout(self.song_info_form_layout)
85 # Add verses widget.
86 self.song_info_verse_list_widget = QtWidgets.QTableWidget(self.song_group_box)
87
88=== modified file 'openlp/plugins/songs/songsplugin.py'
89--- openlp/plugins/songs/songsplugin.py 2019-06-10 20:10:38 +0000
90+++ openlp/plugins/songs/songsplugin.py 2019-06-19 20:56:02 +0000
91@@ -423,7 +423,7 @@
92 """
93 Remove temporary songs from the database
94 """
95- songs = self.manager.get_all_objects(Song, Song.temporary is True)
96+ songs = self.manager.get_all_objects(Song, Song.temporary == True) # noqa: E712
97 for song in songs:
98 self.manager.delete_object(Song, song.id)
99