Merge lp:~suutari-olli/openlp/add-bible-license-field into lp:openlp
- add-bible-license-field
- Merge into trunk
Status: | Superseded | ||||||||
---|---|---|---|---|---|---|---|---|---|
Proposed branch: | lp:~suutari-olli/openlp/add-bible-license-field | ||||||||
Merge into: | lp:openlp | ||||||||
Diff against target: |
404 lines (+129/-23) 9 files modified
openlp/core/common/uistrings.py (+10/-7) openlp/plugins/bibles/forms/bibleimportform.py (+17/-2) openlp/plugins/bibles/forms/editbibledialog.py (+7/-0) openlp/plugins/bibles/forms/editbibleform.py (+27/-4) openlp/plugins/bibles/lib/manager.py (+5/-5) openlp/plugins/songs/lib/mediaitem.py (+7/-2) openlp/plugins/songs/lib/songstab.py (+13/-1) openlp/plugins/songs/songsplugin.py (+1/-0) tests/functional/openlp_plugins/songs/test_mediaitem.py (+42/-2) |
||||||||
To merge this branch: | bzr merge lp:~suutari-olli/openlp/add-bible-license-field | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | Needs Fixing | ||
Review via email: mp+306048@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-12-04.
Commit message
Description of the change
In this branch:
- Added "Full License" field for Bibles (1623631)
- Added a setting for controlling visibility of "Written by:" (1557579)
- Added placeholder texts for Bible metadata fields
- Re-organized uistrings to alphabetical order
lp:~suutari-olli/openlp/add-bible-license-field (revision 2707)
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
[[1;32mSUCCESS
Azaziah (suutari-olli) wrote : | # |
Thanks for the comments, I've replied to them.
Azaziah (suutari-olli) wrote : | # |
> Needs a test just a minor fix is not enough
> Some inline comments.
I've replied to the comments,
will work on a test later.
- 2710. By Azaziah
-
- Added a test for checking hidden "Written by" text.
- 2711. By Azaziah
-
- Removed 1 "å" that had slipped in to the code.
- 2712. By Azaziah
-
- Changed one pair of " to '
- Changed the code for checking Bible meta exists
- Changed the default value for the new setting to "True" - 2713. By Azaziah
-
- Merged trunk on 23.12.16
- 2714. By Azaziah
-
- Merged trunk on 8.1.17
Unmerged revisions
Preview Diff
1 | === modified file 'openlp/core/common/uistrings.py' |
2 | --- openlp/core/common/uistrings.py 2016-11-12 10:00:36 +0000 |
3 | +++ openlp/core/common/uistrings.py 2016-12-04 03:22:31 +0000 |
4 | @@ -59,6 +59,13 @@ |
5 | self.Automatic = translate('OpenLP.Ui', 'Automatic') |
6 | self.BackgroundColor = translate('OpenLP.Ui', 'Background Color') |
7 | self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:') |
8 | + self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short') |
9 | + self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter ' |
10 | + 'than 3 characters long.</strong><br><br>Please try again with ' |
11 | + 'a longer search.') |
12 | + self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available') |
13 | + self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>' |
14 | + 'Please use the Import Wizard to install one or more Bibles.') |
15 | self.Bottom = translate('OpenLP.Ui', 'Bottom') |
16 | self.Browse = translate('OpenLP.Ui', 'Browse...') |
17 | self.Cancel = translate('OpenLP.Ui', 'Cancel') |
18 | @@ -118,6 +125,8 @@ |
19 | self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4") |
20 | self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?') |
21 | self.OpenService = translate('OpenLP.Ui', 'Open service.') |
22 | + self.OptionalShowInFooter = translate('OpenLP.Ui', 'Optional, this will be displayed in footer.') |
23 | + self.OptionalHideInFooter = translate('OpenLP.Ui', 'Optional, this won\'t be displayed in footer.') |
24 | self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop') |
25 | self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End') |
26 | self.Preview = translate('OpenLP.Ui', 'Preview') |
27 | @@ -131,6 +140,7 @@ |
28 | 'player is disabled.') |
29 | self.ResetBG = translate('OpenLP.Ui', 'Reset Background') |
30 | self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.') |
31 | + self.RequiredShowInFooter = translate('OpenLP.Ui', 'Required, this will be displayed in footer.') |
32 | self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds') |
33 | self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview') |
34 | self.Search = translate('OpenLP.Ui', 'Search') |
35 | @@ -159,13 +169,6 @@ |
36 | self.View = translate('OpenLP.Ui', 'View') |
37 | self.ViewMode = translate('OpenLP.Ui', 'View Mode') |
38 | self.Video = translate('OpenLP.Ui', 'Video') |
39 | - self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short') |
40 | - self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter ' |
41 | - 'than 3 characters long.</strong><br><br>Please try again with ' |
42 | - 'a longer search.') |
43 | - self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available') |
44 | - self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>' |
45 | - 'Please use the Import Wizard to install one or more Bibles.') |
46 | book_chapter = translate('OpenLP.Ui', 'Book Chapter') |
47 | chapter = translate('OpenLP.Ui', 'Chapter') |
48 | verse = translate('OpenLP.Ui', 'Verse') |
49 | |
50 | === modified file 'openlp/plugins/bibles/forms/bibleimportform.py' |
51 | --- openlp/plugins/bibles/forms/bibleimportform.py 2016-08-29 16:11:09 +0000 |
52 | +++ openlp/plugins/bibles/forms/bibleimportform.py 2016-12-04 03:22:31 +0000 |
53 | @@ -380,6 +380,12 @@ |
54 | self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page) |
55 | self.permissions_edit.setObjectName('PermissionsEdit') |
56 | self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit) |
57 | + self.full_license_label = QtWidgets.QLabel(self.license_details_page) |
58 | + self.full_license_label.setObjectName('FullLicenseLabel') |
59 | + self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.full_license_label) |
60 | + self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_page) |
61 | + self.full_license_edit.setObjectName('FullLicenseEdit') |
62 | + self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.full_license_edit) |
63 | self.addPage(self.license_details_page) |
64 | |
65 | def retranslateUi(self): |
66 | @@ -450,6 +456,7 @@ |
67 | self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:')) |
68 | self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:')) |
69 | self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:')) |
70 | + self.full_license_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Full license:')) |
71 | self.progress_page.setTitle(WizardStrings.Importing) |
72 | self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm', |
73 | 'Please wait while your Bible is imported.')) |
74 | @@ -473,6 +480,7 @@ |
75 | elif self.currentPage() == self.select_page: |
76 | self.version_name_edit.clear() |
77 | self.permissions_edit.clear() |
78 | + self.full_license_edit.clear() |
79 | self.copyright_edit.clear() |
80 | if self.field('source_format') == BibleFormat.OSIS: |
81 | if not self.field('osis_location'): |
82 | @@ -717,6 +725,7 @@ |
83 | self.license_details_page.registerField('license_version', self.version_name_edit) |
84 | self.license_details_page.registerField('license_copyright', self.copyright_edit) |
85 | self.license_details_page.registerField('license_permissions', self.permissions_edit) |
86 | + self.license_details_page.registerField("license_full_license", self.full_license_edit, "plainText") |
87 | |
88 | def set_defaults(self): |
89 | """ |
90 | @@ -741,8 +750,13 @@ |
91 | self.setField('proxy_username', settings.value('proxy username')) |
92 | self.setField('proxy_password', settings.value('proxy password')) |
93 | self.setField('license_version', self.version_name_edit.text()) |
94 | + self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter) |
95 | self.setField('license_copyright', self.copyright_edit.text()) |
96 | + self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter) |
97 | self.setField('license_permissions', self.permissions_edit.text()) |
98 | + self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter) |
99 | + self.setField('license_full_license', self.full_license_edit.toPlainText()) |
100 | + self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter) |
101 | self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk) |
102 | settings.endGroup() |
103 | |
104 | @@ -766,6 +780,7 @@ |
105 | license_version = self.field('license_version') |
106 | license_copyright = self.field('license_copyright') |
107 | license_permissions = self.field('license_permissions') |
108 | + license_full_license = self.field('license_full_license') |
109 | importer = None |
110 | if bible_type == BibleFormat.OSIS: |
111 | # Import an OSIS bible. |
112 | @@ -811,10 +826,10 @@ |
113 | sword_path=self.field('sword_zip_path'), |
114 | sword_key=self.sword_zipbible_combo_box.itemData( |
115 | self.sword_zipbible_combo_box.currentIndex())) |
116 | - |
117 | try: |
118 | if importer.do_import(license_version) and not importer.stop_import_flag: |
119 | - self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions) |
120 | + self.manager.save_meta_data(license_version, license_version, |
121 | + license_copyright, license_permissions, license_full_license) |
122 | self.manager.reload_bibles() |
123 | if bible_type == BibleFormat.WebDownload: |
124 | self.progress_label.setText( |
125 | |
126 | === modified file 'openlp/plugins/bibles/forms/editbibledialog.py' |
127 | --- openlp/plugins/bibles/forms/editbibledialog.py 2016-10-27 17:45:50 +0000 |
128 | +++ openlp/plugins/bibles/forms/editbibledialog.py 2016-12-04 03:22:31 +0000 |
129 | @@ -68,6 +68,12 @@ |
130 | self.permissions_edit.setObjectName('permissions_edit') |
131 | self.permissions_label.setBuddy(self.permissions_edit) |
132 | self.license_details_layout.addRow(self.permissions_label, self.permissions_edit) |
133 | + self.full_license_label = QtWidgets.QLabel(self.license_details_group_box) |
134 | + self.full_license_label.setObjectName('full_license_label') |
135 | + self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_group_box) |
136 | + self.full_license_edit.setObjectName('full_license_edit') |
137 | + self.full_license_label.setBuddy(self.full_license_edit) |
138 | + self.license_details_layout.addRow(self.full_license_label, self.full_license_edit) |
139 | self.meta_tab_layout.addWidget(self.license_details_group_box) |
140 | self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab) |
141 | self.language_selection_group_box.setObjectName('language_selection_group_box') |
142 | @@ -132,6 +138,7 @@ |
143 | self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:')) |
144 | self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:')) |
145 | self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:')) |
146 | + self.full_license_label.setText(translate('BiblesPlugin.EditBibleForm', 'Full license:')) |
147 | self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language')) |
148 | self.language_selection_label.setText( |
149 | translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and ' |
150 | |
151 | === modified file 'openlp/plugins/bibles/forms/editbibleform.py' |
152 | --- openlp/plugins/bibles/forms/editbibleform.py 2016-05-21 08:31:24 +0000 |
153 | +++ openlp/plugins/bibles/forms/editbibleform.py 2016-12-04 03:22:31 +0000 |
154 | @@ -61,10 +61,32 @@ |
155 | """ |
156 | log.debug('Load Bible') |
157 | self.bible = bible |
158 | - self.version_name_edit.setText(self.manager.get_meta_data(self.bible, 'name').value) |
159 | - self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value) |
160 | - self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value) |
161 | book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language') |
162 | + """ |
163 | + Try loading the metadata, if the field does not exist in the metadata, continue executing the code, |
164 | + missing fields will be created on "self.accept" (save). |
165 | + """ |
166 | + try: |
167 | + self.version_name_edit.setText(self.manager.get_meta_data(self.bible, 'name').value) |
168 | + except AttributeError: |
169 | + pass |
170 | + try: |
171 | + self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value) |
172 | + except AttributeError: |
173 | + pass |
174 | + try: |
175 | + self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value) |
176 | + except AttributeError: |
177 | + pass |
178 | + try: |
179 | + self.full_license_edit.setPlainText(self.manager.get_meta_data(self.bible, 'full_license').value) |
180 | + except AttributeError: |
181 | + pass |
182 | + # Set placeholder texts for the fields. |
183 | + self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter) |
184 | + self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter) |
185 | + self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter) |
186 | + self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter) |
187 | if book_name_language and book_name_language.value != 'None': |
188 | self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1) |
189 | self.books = {} |
190 | @@ -107,6 +129,7 @@ |
191 | version = self.version_name_edit.text() |
192 | copyright = self.copyright_edit.text() |
193 | permissions = self.permissions_edit.text() |
194 | + full_license = self.full_license_edit.toPlainText() |
195 | book_name_language = self.language_selection_combo_box.currentIndex() - 1 |
196 | if book_name_language == -1: |
197 | book_name_language = None |
198 | @@ -121,7 +144,7 @@ |
199 | if not self.validate_book(custom_names[abbr], abbr): |
200 | return |
201 | self.application.set_busy_cursor() |
202 | - self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language) |
203 | + self.manager.save_meta_data(self.bible, version, copyright, permissions, full_license, book_name_language) |
204 | if not self.web_bible: |
205 | for abbr, book in self.books.items(): |
206 | if book: |
207 | |
208 | === modified file 'openlp/plugins/bibles/lib/manager.py' |
209 | --- openlp/plugins/bibles/lib/manager.py 2016-11-01 19:17:57 +0000 |
210 | +++ openlp/plugins/bibles/lib/manager.py 2016-12-04 03:22:31 +0000 |
211 | @@ -375,17 +375,17 @@ |
212 | else: |
213 | return None |
214 | |
215 | - def save_meta_data(self, bible, version, copyright, permissions, book_name_language=None): |
216 | + def save_meta_data(self, bible, version, copyright, permissions, full_license, book_name_language=None): |
217 | """ |
218 | Saves the bibles meta data. |
219 | """ |
220 | - log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible, |
221 | - version=version, |
222 | - copyright=copyright, |
223 | - perms=permissions)) |
224 | + log.debug('save_meta data {bible}, {version}, {copyright},' |
225 | + ' {perms}, {full_license}'.format(bible=bible, version=version, copyright=copyright, |
226 | + perms=permissions, full_license=full_license)) |
227 | self.db_cache[bible].save_meta('name', version) |
228 | self.db_cache[bible].save_meta('copyright', copyright) |
229 | self.db_cache[bible].save_meta('permissions', permissions) |
230 | + self.db_cache[bible].save_meta('full_license', full_license) |
231 | self.db_cache[bible].save_meta('book_name_language', book_name_language) |
232 | |
233 | def get_meta_data(self, bible, key): |
234 | |
235 | === modified file 'openlp/plugins/songs/lib/mediaitem.py' |
236 | --- openlp/plugins/songs/lib/mediaitem.py 2016-11-15 22:44:11 +0000 |
237 | +++ openlp/plugins/songs/lib/mediaitem.py 2016-12-04 03:22:31 +0000 |
238 | @@ -126,6 +126,7 @@ |
239 | self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit') |
240 | self.add_song_from_service = Settings().value(self.settings_section + '/add song from service') |
241 | self.display_songbook = Settings().value(self.settings_section + '/display songbook') |
242 | + self.display_written_by_text = Settings().value(self.settings_section + '/display written by') |
243 | self.display_copyright_symbol = Settings().value(self.settings_section + '/display copyright symbol') |
244 | |
245 | def retranslateUi(self): |
246 | @@ -640,8 +641,12 @@ |
247 | item.raw_footer = [] |
248 | item.raw_footer.append(song.title) |
249 | if authors_none: |
250 | - item.raw_footer.append("{text}: {authors}".format(text=translate('OpenLP.Ui', 'Written by'), |
251 | - authors=create_separated_list(authors_none))) |
252 | + # If the setting for showing "Written by:" is enabled, show it before unspecified authors. |
253 | + if Settings().value('songs/display written by'): |
254 | + item.raw_footer.append("{text}: {authors}".format(text=translate('OpenLP.Ui', 'Written by'), |
255 | + authors=create_separated_list(authors_none))) |
256 | + else: |
257 | + item.raw_footer.append("{authors}".format(authors=create_separated_list(authors_none))) |
258 | if authors_words_music: |
259 | item.raw_footer.append("{text}: {authors}".format(text=AuthorType.Types[AuthorType.WordsAndMusic], |
260 | authors=create_separated_list(authors_words_music))) |
261 | |
262 | === modified file 'openlp/plugins/songs/lib/songstab.py' |
263 | --- openlp/plugins/songs/lib/songstab.py 2016-07-24 20:20:25 +0000 |
264 | +++ openlp/plugins/songs/lib/songstab.py 2016-12-04 03:22:31 +0000 |
265 | @@ -53,6 +53,9 @@ |
266 | self.display_songbook_check_box = QtWidgets.QCheckBox(self.mode_group_box) |
267 | self.display_songbook_check_box.setObjectName('songbook_check_box') |
268 | self.mode_layout.addWidget(self.display_songbook_check_box) |
269 | + self.display_written_by_check_box = QtWidgets.QCheckBox(self.mode_group_box) |
270 | + self.display_written_by_check_box.setObjectName('written_by_check_box') |
271 | + self.mode_layout.addWidget(self.display_written_by_check_box) |
272 | self.display_copyright_check_box = QtWidgets.QCheckBox(self.mode_group_box) |
273 | self.display_copyright_check_box.setObjectName('copyright_check_box') |
274 | self.mode_layout.addWidget(self.display_copyright_check_box) |
275 | @@ -63,16 +66,19 @@ |
276 | self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed) |
277 | self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed) |
278 | self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed) |
279 | + self.display_written_by_check_box.stateChanged.connect(self.on_written_by_check_box_changed) |
280 | self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed) |
281 | |
282 | def retranslateUi(self): |
283 | - self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode')) |
284 | + self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Song related settings')) |
285 | self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab', |
286 | 'Enable "Go to verse" button in Live panel')) |
287 | self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit')) |
288 | self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab', |
289 | 'Import missing songs from Service files')) |
290 | self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer')) |
291 | + self.display_written_by_check_box.setText(translate( |
292 | + 'SongsPlugin.SongsTab', 'Show "Written by:" in footer for unspecified authors')) |
293 | self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab', |
294 | 'Display "{symbol}" symbol before copyright ' |
295 | 'info').format(symbol=SongStrings.CopyrightSymbol)) |
296 | @@ -92,6 +98,9 @@ |
297 | def on_songbook_check_box_changed(self, check_state): |
298 | self.display_songbook = (check_state == QtCore.Qt.Checked) |
299 | |
300 | + def on_written_by_check_box_changed(self, check_state): |
301 | + self.display_written_by = (check_state == QtCore.Qt.Checked) |
302 | + |
303 | def on_copyright_check_box_changed(self, check_state): |
304 | self.display_copyright_symbol = (check_state == QtCore.Qt.Checked) |
305 | |
306 | @@ -102,11 +111,13 @@ |
307 | self.update_edit = settings.value('update service on edit') |
308 | self.update_load = settings.value('add song from service') |
309 | self.display_songbook = settings.value('display songbook') |
310 | + self.display_written_by = settings.value('display written by') |
311 | self.display_copyright_symbol = settings.value('display copyright symbol') |
312 | self.tool_bar_active_check_box.setChecked(self.tool_bar) |
313 | self.update_on_edit_check_box.setChecked(self.update_edit) |
314 | self.add_from_service_check_box.setChecked(self.update_load) |
315 | self.display_songbook_check_box.setChecked(self.display_songbook) |
316 | + self.display_written_by_check_box.setChecked(self.display_written_by) |
317 | self.display_copyright_check_box.setChecked(self.display_copyright_symbol) |
318 | settings.endGroup() |
319 | |
320 | @@ -117,6 +128,7 @@ |
321 | settings.setValue('update service on edit', self.update_edit) |
322 | settings.setValue('add song from service', self.update_load) |
323 | settings.setValue('display songbook', self.display_songbook) |
324 | + settings.setValue('display written by', self.display_written_by) |
325 | settings.setValue('display copyright symbol', self.display_copyright_symbol) |
326 | settings.endGroup() |
327 | if self.tab_visited: |
328 | |
329 | === modified file 'openlp/plugins/songs/songsplugin.py' |
330 | --- openlp/plugins/songs/songsplugin.py 2016-09-19 18:51:48 +0000 |
331 | +++ openlp/plugins/songs/songsplugin.py 2016-12-04 03:22:31 +0000 |
332 | @@ -60,6 +60,7 @@ |
333 | 'songs/add song from service': True, |
334 | 'songs/display songbar': True, |
335 | 'songs/display songbook': False, |
336 | + 'songs/display written by': False, |
337 | 'songs/display copyright symbol': False, |
338 | 'songs/last directory import': '', |
339 | 'songs/last directory export': '', |
340 | |
341 | === modified file 'tests/functional/openlp_plugins/songs/test_mediaitem.py' |
342 | --- tests/functional/openlp_plugins/songs/test_mediaitem.py 2016-05-31 21:40:13 +0000 |
343 | +++ tests/functional/openlp_plugins/songs/test_mediaitem.py 2016-12-04 03:22:31 +0000 |
344 | @@ -295,11 +295,18 @@ |
345 | mock_qlist_widget.setData.assert_called_once_with(MockedUserRole, mock_song.id) |
346 | self.media_item.list_view.addItem.assert_called_once_with(mock_qlist_widget) |
347 | |
348 | - def test_build_song_footer_one_author(self): |
349 | + @patch(u'openlp.plugins.songs.lib.mediaitem.Settings') |
350 | + def test_build_song_footer_one_author_show_written_by(self, MockedSettings): |
351 | """ |
352 | Test build songs footer with basic song and one author |
353 | """ |
354 | - # GIVEN: A Song and a Service Item |
355 | + # GIVEN: A Song and a Service Item, mocked settings: True for 'songs/display written by' |
356 | + # and False for 'core/ccli number' (ccli will cause traceback if true) |
357 | + |
358 | + mocked_settings = MagicMock() |
359 | + mocked_settings.value.side_effect = [True, False] |
360 | + MockedSettings.return_value = mocked_settings |
361 | + |
362 | mock_song = MagicMock() |
363 | mock_song.title = 'My Song' |
364 | mock_song.authors_songs = [] |
365 | @@ -320,6 +327,39 @@ |
366 | self.assertEqual(author_list, ['my author'], |
367 | 'The author list should be returned correctly with one author') |
368 | |
369 | + @patch(u'openlp.plugins.songs.lib.mediaitem.Settings') |
370 | + def test_build_song_footer_one_author_hide_written_by(self, MockedSettings): |
371 | + """ |
372 | + Test build songs footer with basic song and one author |
373 | + """ |
374 | + # GIVEN: A Song and a Service Item, mocked settings: False for 'songs/display written by' |
375 | + # and False for 'core/ccli number' (ccli will cause traceback if true) |
376 | + |
377 | + mocked_settings = MagicMock() |
378 | + mocked_settings.value.side_effect = [False, False] |
379 | + MockedSettings.return_value = mocked_settings |
380 | + |
381 | + mock_song = MagicMock() |
382 | + mock_song.title = 'My Song' |
383 | + mock_song.authors_songs = [] |
384 | + mock_author = MagicMock() |
385 | + mock_author.display_name = 'my author' |
386 | + mock_author_song = MagicMock() |
387 | + mock_author_song.author = mock_author |
388 | + mock_song.authors_songs.append(mock_author_song) |
389 | + mock_song.copyright = 'My copyright' |
390 | + service_item = ServiceItem(None) |
391 | + |
392 | + # WHEN: I generate the Footer with default settings |
393 | + author_list = self.media_item.generate_footer(service_item, mock_song) |
394 | + |
395 | + # THEN: I get the following Array returned |
396 | + self.assertEqual(service_item.raw_footer, ['My Song', 'my author', 'My copyright'], |
397 | + 'The array should be returned correctly with a song, one author and copyright,' |
398 | + 'text Written by should not be part of the text.') |
399 | + self.assertEqual(author_list, ['my author'], |
400 | + 'The author list should be returned correctly with one author') |
401 | + |
402 | def test_build_song_footer_two_authors(self): |
403 | """ |
404 | Test build songs footer with basic song and two authors |
Needs a test just a minor fix is not enough
Some inline comments.