Merge lp:~suutari-olli/openlp/add-bible-license-field into lp:openlp

Proposed by Azaziah
Status: Superseded
Proposed branch: lp:~suutari-olli/openlp/add-bible-license-field
Merge into: lp:openlp
Diff against target: 400 lines (+125/-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 (+23/-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
Reviewer Review Type Date Requested Status
Raoul Snyman Needs Fixing
Tim Bentley Pending
Review via email: mp+312426@code.launchpad.net

This proposal supersedes a proposal from 2016-09-18.

This proposal has been superseded by a proposal from 2016-12-18.

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 2711)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1856/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1767/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1705/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1449/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/1039/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1107/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/975/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/127/

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Needs a test just a minor fix is not enough
Some inline comments.

review: Needs Fixing
Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

Thanks for the comments, I've replied to them.

Revision history for this message
Azaziah (suutari-olli) wrote : Posted in a previous version of this proposal

> 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.

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

A few small fixes and then you should be good to go.

review: Needs Fixing
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"

Revision history for this message
Azaziah (suutari-olli) wrote :

Thanks for the review, I've fixed them.

2713. By Azaziah

- Merged trunk on 23.12.16

2714. By Azaziah

- Merged trunk on 8.1.17

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/common/uistrings.py'
--- openlp/core/common/uistrings.py 2016-11-12 10:00:36 +0000
+++ openlp/core/common/uistrings.py 2016-12-18 06:07:36 +0000
@@ -59,6 +59,13 @@
59 self.Automatic = translate('OpenLP.Ui', 'Automatic')59 self.Automatic = translate('OpenLP.Ui', 'Automatic')
60 self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')60 self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')
61 self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:')61 self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:')
62 self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short')
63 self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter '
64 'than 3 characters long.</strong><br><br>Please try again with '
65 'a longer search.')
66 self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available')
67 self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>'
68 'Please use the Import Wizard to install one or more Bibles.')
62 self.Bottom = translate('OpenLP.Ui', 'Bottom')69 self.Bottom = translate('OpenLP.Ui', 'Bottom')
63 self.Browse = translate('OpenLP.Ui', 'Browse...')70 self.Browse = translate('OpenLP.Ui', 'Browse...')
64 self.Cancel = translate('OpenLP.Ui', 'Cancel')71 self.Cancel = translate('OpenLP.Ui', 'Cancel')
@@ -118,6 +125,8 @@
118 self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4")125 self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4")
119 self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')126 self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
120 self.OpenService = translate('OpenLP.Ui', 'Open service.')127 self.OpenService = translate('OpenLP.Ui', 'Open service.')
128 self.OptionalShowInFooter = translate('OpenLP.Ui', 'Optional, this will be displayed in footer.')
129 self.OptionalHideInFooter = translate('OpenLP.Ui', 'Optional, this won\'t be displayed in footer.')
121 self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop')130 self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop')
122 self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End')131 self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End')
123 self.Preview = translate('OpenLP.Ui', 'Preview')132 self.Preview = translate('OpenLP.Ui', 'Preview')
@@ -131,6 +140,7 @@
131 'player is disabled.')140 'player is disabled.')
132 self.ResetBG = translate('OpenLP.Ui', 'Reset Background')141 self.ResetBG = translate('OpenLP.Ui', 'Reset Background')
133 self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.')142 self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.')
143 self.RequiredShowInFooter = translate('OpenLP.Ui', 'Required, this will be displayed in footer.')
134 self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')144 self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
135 self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')145 self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
136 self.Search = translate('OpenLP.Ui', 'Search')146 self.Search = translate('OpenLP.Ui', 'Search')
@@ -159,13 +169,6 @@
159 self.View = translate('OpenLP.Ui', 'View')169 self.View = translate('OpenLP.Ui', 'View')
160 self.ViewMode = translate('OpenLP.Ui', 'View Mode')170 self.ViewMode = translate('OpenLP.Ui', 'View Mode')
161 self.Video = translate('OpenLP.Ui', 'Video')171 self.Video = translate('OpenLP.Ui', 'Video')
162 self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short')
163 self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter '
164 'than 3 characters long.</strong><br><br>Please try again with '
165 'a longer search.')
166 self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available')
167 self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>'
168 'Please use the Import Wizard to install one or more Bibles.')
169 book_chapter = translate('OpenLP.Ui', 'Book Chapter')172 book_chapter = translate('OpenLP.Ui', 'Book Chapter')
170 chapter = translate('OpenLP.Ui', 'Chapter')173 chapter = translate('OpenLP.Ui', 'Chapter')
171 verse = translate('OpenLP.Ui', 'Verse')174 verse = translate('OpenLP.Ui', 'Verse')
172175
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2016-11-25 14:21:27 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2016-12-18 06:07:36 +0000
@@ -408,6 +408,12 @@
408 self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)408 self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)
409 self.permissions_edit.setObjectName('PermissionsEdit')409 self.permissions_edit.setObjectName('PermissionsEdit')
410 self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)410 self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)
411 self.full_license_label = QtWidgets.QLabel(self.license_details_page)
412 self.full_license_label.setObjectName('FullLicenseLabel')
413 self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.full_license_label)
414 self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_page)
415 self.full_license_edit.setObjectName('FullLicenseEdit')
416 self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.full_license_edit)
411 self.addPage(self.license_details_page)417 self.addPage(self.license_details_page)
412418
413 def retranslateUi(self):419 def retranslateUi(self):
@@ -480,6 +486,7 @@
480 self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))486 self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
481 self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))487 self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
482 self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))488 self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
489 self.full_license_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Full license:'))
483 self.progress_page.setTitle(WizardStrings.Importing)490 self.progress_page.setTitle(WizardStrings.Importing)
484 self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',491 self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
485 'Please wait while your Bible is imported.'))492 'Please wait while your Bible is imported.'))
@@ -504,6 +511,7 @@
504 elif self.currentPage() == self.select_page:511 elif self.currentPage() == self.select_page:
505 self.version_name_edit.clear()512 self.version_name_edit.clear()
506 self.permissions_edit.clear()513 self.permissions_edit.clear()
514 self.full_license_edit.clear()
507 self.copyright_edit.clear()515 self.copyright_edit.clear()
508 if self.field('source_format') == BibleFormat.OSIS:516 if self.field('source_format') == BibleFormat.OSIS:
509 if not self.field('osis_location'):517 if not self.field('osis_location'):
@@ -763,6 +771,7 @@
763 self.license_details_page.registerField('license_version', self.version_name_edit)771 self.license_details_page.registerField('license_version', self.version_name_edit)
764 self.license_details_page.registerField('license_copyright', self.copyright_edit)772 self.license_details_page.registerField('license_copyright', self.copyright_edit)
765 self.license_details_page.registerField('license_permissions', self.permissions_edit)773 self.license_details_page.registerField('license_permissions', self.permissions_edit)
774 self.license_details_page.registerField("license_full_license", self.full_license_edit, 'plainText')
766775
767 def set_defaults(self):776 def set_defaults(self):
768 """777 """
@@ -787,8 +796,13 @@
787 self.setField('proxy_username', settings.value('proxy username'))796 self.setField('proxy_username', settings.value('proxy username'))
788 self.setField('proxy_password', settings.value('proxy password'))797 self.setField('proxy_password', settings.value('proxy password'))
789 self.setField('license_version', self.version_name_edit.text())798 self.setField('license_version', self.version_name_edit.text())
799 self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
790 self.setField('license_copyright', self.copyright_edit.text())800 self.setField('license_copyright', self.copyright_edit.text())
801 self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
791 self.setField('license_permissions', self.permissions_edit.text())802 self.setField('license_permissions', self.permissions_edit.text())
803 self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter)
804 self.setField('license_full_license', self.full_license_edit.toPlainText())
805 self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter)
792 self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)806 self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
793 settings.endGroup()807 settings.endGroup()
794808
@@ -812,6 +826,7 @@
812 license_version = self.field('license_version')826 license_version = self.field('license_version')
813 license_copyright = self.field('license_copyright')827 license_copyright = self.field('license_copyright')
814 license_permissions = self.field('license_permissions')828 license_permissions = self.field('license_permissions')
829 license_full_license = self.field('license_full_license')
815 importer = None830 importer = None
816 if bible_type == BibleFormat.OSIS:831 if bible_type == BibleFormat.OSIS:
817 # Import an OSIS bible.832 # Import an OSIS bible.
@@ -861,10 +876,10 @@
861 sword_path=self.field('sword_zip_path'),876 sword_path=self.field('sword_zip_path'),
862 sword_key=self.sword_zipbible_combo_box.itemData(877 sword_key=self.sword_zipbible_combo_box.itemData(
863 self.sword_zipbible_combo_box.currentIndex()))878 self.sword_zipbible_combo_box.currentIndex()))
864
865 try:879 try:
866 if importer.do_import(license_version) and not importer.stop_import_flag:880 if importer.do_import(license_version) and not importer.stop_import_flag:
867 self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions)881 self.manager.save_meta_data(license_version, license_version,
882 license_copyright, license_permissions, license_full_license)
868 self.manager.reload_bibles()883 self.manager.reload_bibles()
869 if bible_type == BibleFormat.WebDownload:884 if bible_type == BibleFormat.WebDownload:
870 self.progress_label.setText(885 self.progress_label.setText(
871886
=== modified file 'openlp/plugins/bibles/forms/editbibledialog.py'
--- openlp/plugins/bibles/forms/editbibledialog.py 2016-10-27 17:45:50 +0000
+++ openlp/plugins/bibles/forms/editbibledialog.py 2016-12-18 06:07:36 +0000
@@ -68,6 +68,12 @@
68 self.permissions_edit.setObjectName('permissions_edit')68 self.permissions_edit.setObjectName('permissions_edit')
69 self.permissions_label.setBuddy(self.permissions_edit)69 self.permissions_label.setBuddy(self.permissions_edit)
70 self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)70 self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)
71 self.full_license_label = QtWidgets.QLabel(self.license_details_group_box)
72 self.full_license_label.setObjectName('full_license_label')
73 self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_group_box)
74 self.full_license_edit.setObjectName('full_license_edit')
75 self.full_license_label.setBuddy(self.full_license_edit)
76 self.license_details_layout.addRow(self.full_license_label, self.full_license_edit)
71 self.meta_tab_layout.addWidget(self.license_details_group_box)77 self.meta_tab_layout.addWidget(self.license_details_group_box)
72 self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab)78 self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab)
73 self.language_selection_group_box.setObjectName('language_selection_group_box')79 self.language_selection_group_box.setObjectName('language_selection_group_box')
@@ -132,6 +138,7 @@
132 self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))138 self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
133 self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))139 self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
134 self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))140 self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
141 self.full_license_label.setText(translate('BiblesPlugin.EditBibleForm', 'Full license:'))
135 self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))142 self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
136 self.language_selection_label.setText(143 self.language_selection_label.setText(
137 translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and '144 translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and '
138145
=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py 2016-05-21 08:31:24 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py 2016-12-18 06:07:36 +0000
@@ -61,10 +61,28 @@
61 """61 """
62 log.debug('Load Bible')62 log.debug('Load Bible')
63 self.bible = bible63 self.bible = bible
64 self.version_name_edit.setText(self.manager.get_meta_data(self.bible, 'name').value)
65 self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value)
66 self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value)
67 book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')64 book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
65 """
66 Try loading the metadata, if the field does not exist in the metadata, continue executing the code,
67 missing fields will be created on "self.accept" (save).
68 """
69 meta = self.manager.get_meta_data(self.bible, 'name')
70 copyright = self.manager.get_meta_data(self.bible, 'copyright')
71 permission = self.manager.get_meta_data(self.bible, 'permissions')
72 full_license = self.manager.get_meta_data(self.bible, 'full_license')
73 if meta:
74 self.version_name_edit.setText(meta.value)
75 if copyright:
76 self.copyright_edit.setText(copyright.value)
77 if permission:
78 self.permissions_edit.setText(permission.value)
79 if full_license:
80 self.full_license_edit.setPlainText(full_license.value)
81 # Set placeholder texts for the fields.
82 self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
83 self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
84 self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter)
85 self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter)
68 if book_name_language and book_name_language.value != 'None':86 if book_name_language and book_name_language.value != 'None':
69 self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)87 self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
70 self.books = {}88 self.books = {}
@@ -107,6 +125,7 @@
107 version = self.version_name_edit.text()125 version = self.version_name_edit.text()
108 copyright = self.copyright_edit.text()126 copyright = self.copyright_edit.text()
109 permissions = self.permissions_edit.text()127 permissions = self.permissions_edit.text()
128 full_license = self.full_license_edit.toPlainText()
110 book_name_language = self.language_selection_combo_box.currentIndex() - 1129 book_name_language = self.language_selection_combo_box.currentIndex() - 1
111 if book_name_language == -1:130 if book_name_language == -1:
112 book_name_language = None131 book_name_language = None
@@ -121,7 +140,7 @@
121 if not self.validate_book(custom_names[abbr], abbr):140 if not self.validate_book(custom_names[abbr], abbr):
122 return141 return
123 self.application.set_busy_cursor()142 self.application.set_busy_cursor()
124 self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)143 self.manager.save_meta_data(self.bible, version, copyright, permissions, full_license, book_name_language)
125 if not self.web_bible:144 if not self.web_bible:
126 for abbr, book in self.books.items():145 for abbr, book in self.books.items():
127 if book:146 if book:
128147
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2016-11-24 21:48:51 +0000
+++ openlp/plugins/bibles/lib/manager.py 2016-12-18 06:07:36 +0000
@@ -380,17 +380,17 @@
380 else:380 else:
381 return None381 return None
382382
383 def save_meta_data(self, bible, version, copyright, permissions, book_name_language=None):383 def save_meta_data(self, bible, version, copyright, permissions, full_license, book_name_language=None):
384 """384 """
385 Saves the bibles meta data.385 Saves the bibles meta data.
386 """386 """
387 log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible,387 log.debug('save_meta data {bible}, {version}, {copyright},'
388 version=version,388 ' {perms}, {full_license}'.format(bible=bible, version=version, copyright=copyright,
389 copyright=copyright,389 perms=permissions, full_license=full_license))
390 perms=permissions))
391 self.db_cache[bible].save_meta('name', version)390 self.db_cache[bible].save_meta('name', version)
392 self.db_cache[bible].save_meta('copyright', copyright)391 self.db_cache[bible].save_meta('copyright', copyright)
393 self.db_cache[bible].save_meta('permissions', permissions)392 self.db_cache[bible].save_meta('permissions', permissions)
393 self.db_cache[bible].save_meta('full_license', full_license)
394 self.db_cache[bible].save_meta('book_name_language', book_name_language)394 self.db_cache[bible].save_meta('book_name_language', book_name_language)
395395
396 def get_meta_data(self, bible, key):396 def get_meta_data(self, bible, key):
397397
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2016-11-15 22:44:11 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2016-12-18 06:07:36 +0000
@@ -126,6 +126,7 @@
126 self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit')126 self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit')
127 self.add_song_from_service = Settings().value(self.settings_section + '/add song from service')127 self.add_song_from_service = Settings().value(self.settings_section + '/add song from service')
128 self.display_songbook = Settings().value(self.settings_section + '/display songbook')128 self.display_songbook = Settings().value(self.settings_section + '/display songbook')
129 self.display_written_by_text = Settings().value(self.settings_section + '/display written by')
129 self.display_copyright_symbol = Settings().value(self.settings_section + '/display copyright symbol')130 self.display_copyright_symbol = Settings().value(self.settings_section + '/display copyright symbol')
130131
131 def retranslateUi(self):132 def retranslateUi(self):
@@ -640,8 +641,12 @@
640 item.raw_footer = []641 item.raw_footer = []
641 item.raw_footer.append(song.title)642 item.raw_footer.append(song.title)
642 if authors_none:643 if authors_none:
643 item.raw_footer.append("{text}: {authors}".format(text=translate('OpenLP.Ui', 'Written by'),644 # If the setting for showing "Written by:" is enabled, show it before unspecified authors.
644 authors=create_separated_list(authors_none)))645 if Settings().value('songs/display written by'):
646 item.raw_footer.append("{text}: {authors}".format(text=translate('OpenLP.Ui', 'Written by'),
647 authors=create_separated_list(authors_none)))
648 else:
649 item.raw_footer.append("{authors}".format(authors=create_separated_list(authors_none)))
645 if authors_words_music:650 if authors_words_music:
646 item.raw_footer.append("{text}: {authors}".format(text=AuthorType.Types[AuthorType.WordsAndMusic],651 item.raw_footer.append("{text}: {authors}".format(text=AuthorType.Types[AuthorType.WordsAndMusic],
647 authors=create_separated_list(authors_words_music)))652 authors=create_separated_list(authors_words_music)))
648653
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2016-07-24 20:20:25 +0000
+++ openlp/plugins/songs/lib/songstab.py 2016-12-18 06:07:36 +0000
@@ -53,6 +53,9 @@
53 self.display_songbook_check_box = QtWidgets.QCheckBox(self.mode_group_box)53 self.display_songbook_check_box = QtWidgets.QCheckBox(self.mode_group_box)
54 self.display_songbook_check_box.setObjectName('songbook_check_box')54 self.display_songbook_check_box.setObjectName('songbook_check_box')
55 self.mode_layout.addWidget(self.display_songbook_check_box)55 self.mode_layout.addWidget(self.display_songbook_check_box)
56 self.display_written_by_check_box = QtWidgets.QCheckBox(self.mode_group_box)
57 self.display_written_by_check_box.setObjectName('written_by_check_box')
58 self.mode_layout.addWidget(self.display_written_by_check_box)
56 self.display_copyright_check_box = QtWidgets.QCheckBox(self.mode_group_box)59 self.display_copyright_check_box = QtWidgets.QCheckBox(self.mode_group_box)
57 self.display_copyright_check_box.setObjectName('copyright_check_box')60 self.display_copyright_check_box.setObjectName('copyright_check_box')
58 self.mode_layout.addWidget(self.display_copyright_check_box)61 self.mode_layout.addWidget(self.display_copyright_check_box)
@@ -63,16 +66,19 @@
63 self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)66 self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
64 self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)67 self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
65 self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)68 self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
69 self.display_written_by_check_box.stateChanged.connect(self.on_written_by_check_box_changed)
66 self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)70 self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)
6771
68 def retranslateUi(self):72 def retranslateUi(self):
69 self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))73 self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Song related settings'))
70 self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab',74 self.tool_bar_active_check_box.setText(translate('SongsPlugin.SongsTab',
71 'Enable "Go to verse" button in Live panel'))75 'Enable "Go to verse" button in Live panel'))
72 self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))76 self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
73 self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',77 self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',
74 'Import missing songs from Service files'))78 'Import missing songs from Service files'))
75 self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer'))79 self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer'))
80 self.display_written_by_check_box.setText(translate(
81 'SongsPlugin.SongsTab', 'Show "Written by:" in footer for unspecified authors'))
76 self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',82 self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',
77 'Display "{symbol}" symbol before copyright '83 'Display "{symbol}" symbol before copyright '
78 'info').format(symbol=SongStrings.CopyrightSymbol))84 'info').format(symbol=SongStrings.CopyrightSymbol))
@@ -92,6 +98,9 @@
92 def on_songbook_check_box_changed(self, check_state):98 def on_songbook_check_box_changed(self, check_state):
93 self.display_songbook = (check_state == QtCore.Qt.Checked)99 self.display_songbook = (check_state == QtCore.Qt.Checked)
94100
101 def on_written_by_check_box_changed(self, check_state):
102 self.display_written_by = (check_state == QtCore.Qt.Checked)
103
95 def on_copyright_check_box_changed(self, check_state):104 def on_copyright_check_box_changed(self, check_state):
96 self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)105 self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)
97106
@@ -102,11 +111,13 @@
102 self.update_edit = settings.value('update service on edit')111 self.update_edit = settings.value('update service on edit')
103 self.update_load = settings.value('add song from service')112 self.update_load = settings.value('add song from service')
104 self.display_songbook = settings.value('display songbook')113 self.display_songbook = settings.value('display songbook')
114 self.display_written_by = settings.value('display written by')
105 self.display_copyright_symbol = settings.value('display copyright symbol')115 self.display_copyright_symbol = settings.value('display copyright symbol')
106 self.tool_bar_active_check_box.setChecked(self.tool_bar)116 self.tool_bar_active_check_box.setChecked(self.tool_bar)
107 self.update_on_edit_check_box.setChecked(self.update_edit)117 self.update_on_edit_check_box.setChecked(self.update_edit)
108 self.add_from_service_check_box.setChecked(self.update_load)118 self.add_from_service_check_box.setChecked(self.update_load)
109 self.display_songbook_check_box.setChecked(self.display_songbook)119 self.display_songbook_check_box.setChecked(self.display_songbook)
120 self.display_written_by_check_box.setChecked(self.display_written_by)
110 self.display_copyright_check_box.setChecked(self.display_copyright_symbol)121 self.display_copyright_check_box.setChecked(self.display_copyright_symbol)
111 settings.endGroup()122 settings.endGroup()
112123
@@ -117,6 +128,7 @@
117 settings.setValue('update service on edit', self.update_edit)128 settings.setValue('update service on edit', self.update_edit)
118 settings.setValue('add song from service', self.update_load)129 settings.setValue('add song from service', self.update_load)
119 settings.setValue('display songbook', self.display_songbook)130 settings.setValue('display songbook', self.display_songbook)
131 settings.setValue('display written by', self.display_written_by)
120 settings.setValue('display copyright symbol', self.display_copyright_symbol)132 settings.setValue('display copyright symbol', self.display_copyright_symbol)
121 settings.endGroup()133 settings.endGroup()
122 if self.tab_visited:134 if self.tab_visited:
123135
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2016-09-19 18:51:48 +0000
+++ openlp/plugins/songs/songsplugin.py 2016-12-18 06:07:36 +0000
@@ -60,6 +60,7 @@
60 'songs/add song from service': True,60 'songs/add song from service': True,
61 'songs/display songbar': True,61 'songs/display songbar': True,
62 'songs/display songbook': False,62 'songs/display songbook': False,
63 'songs/display written by': True,
63 'songs/display copyright symbol': False,64 'songs/display copyright symbol': False,
64 'songs/last directory import': '',65 'songs/last directory import': '',
65 'songs/last directory export': '',66 'songs/last directory export': '',
6667
=== modified file 'tests/functional/openlp_plugins/songs/test_mediaitem.py'
--- tests/functional/openlp_plugins/songs/test_mediaitem.py 2016-05-31 21:40:13 +0000
+++ tests/functional/openlp_plugins/songs/test_mediaitem.py 2016-12-18 06:07:36 +0000
@@ -295,11 +295,18 @@
295 mock_qlist_widget.setData.assert_called_once_with(MockedUserRole, mock_song.id)295 mock_qlist_widget.setData.assert_called_once_with(MockedUserRole, mock_song.id)
296 self.media_item.list_view.addItem.assert_called_once_with(mock_qlist_widget)296 self.media_item.list_view.addItem.assert_called_once_with(mock_qlist_widget)
297297
298 def test_build_song_footer_one_author(self):298 @patch(u'openlp.plugins.songs.lib.mediaitem.Settings')
299 def test_build_song_footer_one_author_show_written_by(self, MockedSettings):
299 """300 """
300 Test build songs footer with basic song and one author301 Test build songs footer with basic song and one author
301 """302 """
302 # GIVEN: A Song and a Service Item303 # GIVEN: A Song and a Service Item, mocked settings: True for 'songs/display written by'
304 # and False for 'core/ccli number' (ccli will cause traceback if true)
305
306 mocked_settings = MagicMock()
307 mocked_settings.value.side_effect = [True, False]
308 MockedSettings.return_value = mocked_settings
309
303 mock_song = MagicMock()310 mock_song = MagicMock()
304 mock_song.title = 'My Song'311 mock_song.title = 'My Song'
305 mock_song.authors_songs = []312 mock_song.authors_songs = []
@@ -320,6 +327,39 @@
320 self.assertEqual(author_list, ['my author'],327 self.assertEqual(author_list, ['my author'],
321 'The author list should be returned correctly with one author')328 'The author list should be returned correctly with one author')
322329
330 @patch(u'openlp.plugins.songs.lib.mediaitem.Settings')
331 def test_build_song_footer_one_author_hide_written_by(self, MockedSettings):
332 """
333 Test build songs footer with basic song and one author
334 """
335 # GIVEN: A Song and a Service Item, mocked settings: False for 'songs/display written by'
336 # and False for 'core/ccli number' (ccli will cause traceback if true)
337
338 mocked_settings = MagicMock()
339 mocked_settings.value.side_effect = [False, False]
340 MockedSettings.return_value = mocked_settings
341
342 mock_song = MagicMock()
343 mock_song.title = 'My Song'
344 mock_song.authors_songs = []
345 mock_author = MagicMock()
346 mock_author.display_name = 'my author'
347 mock_author_song = MagicMock()
348 mock_author_song.author = mock_author
349 mock_song.authors_songs.append(mock_author_song)
350 mock_song.copyright = 'My copyright'
351 service_item = ServiceItem(None)
352
353 # WHEN: I generate the Footer with default settings
354 author_list = self.media_item.generate_footer(service_item, mock_song)
355
356 # THEN: I get the following Array returned
357 self.assertEqual(service_item.raw_footer, ['My Song', 'my author', 'My copyright'],
358 'The array should be returned correctly with a song, one author and copyright,'
359 'text Written by should not be part of the text.')
360 self.assertEqual(author_list, ['my author'],
361 'The author list should be returned correctly with one author')
362
323 def test_build_song_footer_two_authors(self):363 def test_build_song_footer_two_authors(self):
324 """364 """
325 Test build songs footer with basic song and two authors365 Test build songs footer with basic song and two authors