Merge lp:~richie-the-g/openlp/sec-global-option into lp:openlp

Proposed by Richard Graham
Status: Needs review
Proposed branch: lp:~richie-the-g/openlp/sec-global-option
Merge into: lp:openlp
Diff against target: 272 lines (+96/-4)
7 files modified
openlp/core/lib/serviceitem.py (+3/-0)
openlp/core/ui/maindisplay.py (+0/-2)
openlp/core/ui/slidecontroller.py (+21/-0)
openlp/plugins/bibles/bibleplugin.py (+3/-1)
openlp/plugins/bibles/lib/biblestab.py (+34/-0)
openlp/plugins/songs/lib/songstab.py (+32/-0)
openlp/plugins/songs/songsplugin.py (+3/-1)
To merge this branch: bzr merge lp:~richie-the-g/openlp/sec-global-option
Reviewer Review Type Date Requested Status
Tim Bentley Needs Fixing
Review via email: mp+294977@code.launchpad.net

This proposal supersedes a proposal from 2016-04-04.

Description of the change

Added option to put an end character at the end of a song or Bible passage. Added option to show the copyright footer of a song or Bible passage on all slides, the first shown slide, or the final slide of an item. All options are in the specific plugin configuration tabs in 'Configure OpenLP'; end character as a text box and footer as a dropdown box. Not included is the 'Custom Slides' plugin; this is due to the fact that the user can already specify whether or not to show the footer, and if a user wants to put a 'tag' onto the end of an item, they can easily type it in themselves!

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

See inline.

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote :

Looking good but a number of improvements required.
All merges need a test or two and something relevant to this would be good.

review: Needs Fixing
Revision history for this message
Richard Graham (richie-the-g) wrote :

The potential issue with using a <br> is one I did consider. However, my tests with this concluded that although it seems like what you say (ie, a page with only the end character on) will happen, this is not the case. My general theme has a maximum of eight lines; when a ninth was added, the ninth was on a separate page (as expected). However, when the end character was added in this way, it was on its own ninth line. This code is in 'production' use at my church on Windows 7 and Windows 10 computers (dev'd on Win10), and the same behaviour is also what happens when running on Mac OSX.

This is potentially some unexpected behaviour in how OpenLP works, as logically it would seem as if this would break in the way you suggest. However, there is similar behaviour (dare I say a bug!) in Custom Slides where if you have a long paragraph with no line breaks that would overflow one page, the paragraph will continue to display even if it is outside the given frame within the page. I am assuming from my experimentation that when a page is generated, it first looks for manual breaks within the page (with the [---] or [===] tags depending on plugin), then line breaks in the text to decide to break at that point.

As the <br> before the end character happens right at the end of the page generation process, my understanding is that the frame dimensions at that point are ignored as the part of the code that deals with that has already been executed when splitting the item up into separate pages (the end character does not appear on the stage view whereas the semi-arbitrary breaks do).

I hope that made some sort of sense!

The blank line in the code I'll raise my hands to - left blank so while coding I could see where I added code to be able to know which was my broken code and which was the proper non-broken code! Removed in other instances; forgot to do it here!

The excuses and explanations out of the way (possibly in reverse order!), I'll look at the other bits and bobs when I get some downtime during the week ahead! Thank you for being patient with me!

Unmerged revisions

2641. By Richard Graham

Added Slide options to Bible passages as well as songs. Didn't do Custom Slides as the user can decide to add an end character simply by typing it in. (Updated base OLP version)

2640. By Richard Graham

Added Slide options to Bible passages as well as songs. Didn't do Custom Slides as the user can decide to add an end character simply by typing it in.

2639. By Richard Graham

Updated a small syntax error picked up. Also included a dropdown for the end info bit, allowing for all slides, the first shown slide, or the last slide in song only.

2638. By Richard Graham

Added option to include a character at the end of a final slide of a song. Formerly this was part of the theme definition; it has been shifted to the global song settings.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2016-05-05 03:57:04 +0000
+++ openlp/core/lib/serviceitem.py 2016-05-17 21:10:14 +0000
@@ -267,6 +267,9 @@
267 'html': html_data.replace('&amp;nbsp;', '&nbsp;'),267 'html': html_data.replace('&amp;nbsp;', '&nbsp;'),
268 'verseTag': verse_tag268 'verseTag': verse_tag
269 })269 })
270 if hasattr(self, 'name') and ((self.name == 'songs') or (self.name == 'bibles')):
271 display_at_end = "<br>" + (Settings().value(self.name + '/end character'))
272 self._display_frames[(len(self._display_frames)) - 1]['html'] += display_at_end
270 elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:273 elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
271 pass274 pass
272 else:275 else:
273276
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2016-05-02 08:05:47 +0000
+++ openlp/core/ui/maindisplay.py 2016-05-17 21:10:14 +0000
@@ -471,8 +471,6 @@
471 html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,471 html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
472 plugins=self.plugin_manager.plugins)472 plugins=self.plugin_manager.plugins)
473 self.web_view.setHtml(html)473 self.web_view.setHtml(html)
474 if service_item.foot_text:
475 self.footer(service_item.foot_text)
476 # if was hidden keep it hidden474 # if was hidden keep it hidden
477 if self.hide_mode and self.is_live and not service_item.is_media():475 if self.hide_mode and self.is_live and not service_item.is_media():
478 if Settings().value('core/auto unblank'):476 if Settings().value('core/auto unblank'):
479477
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2016-05-05 03:57:04 +0000
+++ openlp/core/ui/slidecontroller.py 2016-05-17 21:10:14 +0000
@@ -167,6 +167,7 @@
167 self.panel = QtWidgets.QWidget(self.main_window.control_splitter)167 self.panel = QtWidgets.QWidget(self.main_window.control_splitter)
168 self.slide_list = {}168 self.slide_list = {}
169 self.slide_count = 0169 self.slide_count = 0
170 self.item_slide_count = 0
170 self.slide_image = None171 self.slide_image = None
171 self.controller_width = -1172 self.controller_width = -1
172 # Layout for holding panel173 # Layout for holding panel
@@ -889,6 +890,7 @@
889 else:890 else:
890 row += 1891 row += 1
891 self.slide_list[str(row)] = row - 1892 self.slide_list[str(row)] = row - 1
893 self.item_slide_count = 0 # How many slides of the current item have been shown
892 else:894 else:
893 row += 1895 row += 1
894 self.slide_list[str(row)] = row - 1896 self.slide_list[str(row)] = row - 1
@@ -896,6 +898,7 @@
896 if not self.service_item.is_command() and frame_number == slide_no:898 if not self.service_item.is_command() and frame_number == slide_no:
897 self.service_item.bg_image_bytes = \899 self.service_item.bg_image_bytes = \
898 self.image_manager.get_image_bytes(frame['path'], ImageSource.ImagePlugin)900 self.image_manager.get_image_bytes(frame['path'], ImageSource.ImagePlugin)
901
899 self.preview_widget.replace_service_item(self.service_item, width, slide_no)902 self.preview_widget.replace_service_item(self.service_item, width, slide_no)
900 self.enable_tool_bar(self.service_item)903 self.enable_tool_bar(self.service_item)
901 # Pass to display for viewing.904 # Pass to display for viewing.
@@ -1105,6 +1108,23 @@
1105 to_display = self.service_item.get_rendered_frame(row)1108 to_display = self.service_item.get_rendered_frame(row)
1106 if self.service_item.is_text():1109 if self.service_item.is_text():
1107 self.display.text(to_display, row != old_selected_row)1110 self.display.text(to_display, row != old_selected_row)
1111 if (self.service_item.name == 'songs') or (self.service_item.name == 'bibles'):
1112 if Settings().value(self.service_item.name + '/info on end') == 1:
1113 if self.item_slide_count == 0:
1114 self.display.footer(self.service_item.foot_text)
1115 else:
1116 self.display.footer('')
1117 elif Settings().value(self.service_item.name + '/info on end') == 2:
1118 if row == (len(self.service_item._display_frames)-1):
1119 self.display.footer(self.service_item.foot_text)
1120 else:
1121 self.display.footer('')
1122 else:
1123 self.display.footer(self.service_item.foot_text)
1124 elif self.service_item.foot_text:
1125 self.display.footer(self.service_item.foot_text)
1126 else:
1127 self.display.footer('')
1108 else:1128 else:
1109 if start:1129 if start:
1110 self.display.build_html(self.service_item, to_display)1130 self.display.build_html(self.service_item, to_display)
@@ -1155,6 +1175,7 @@
1155 self.slide_image.setDevicePixelRatio(self.main_window.devicePixelRatio())1175 self.slide_image.setDevicePixelRatio(self.main_window.devicePixelRatio())
1156 self.slide_preview.setPixmap(self.slide_image)1176 self.slide_preview.setPixmap(self.slide_image)
1157 self.slide_count += 11177 self.slide_count += 1
1178 self.item_slide_count += 1
11581179
1159 def grab_maindisplay(self):1180 def grab_maindisplay(self):
1160 """1181 """
11611182
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2016-03-31 16:34:22 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2016-05-17 21:10:14 +0000
@@ -59,7 +59,9 @@
59 'bibles/range separator': '',59 'bibles/range separator': '',
60 'bibles/list separator': '',60 'bibles/list separator': '',
61 'bibles/end separator': '',61 'bibles/end separator': '',
62 'bibles/last directory import': ''62 'bibles/last directory import': '',
63 'bibles/end character': '',
64 'bibles/info on end': 0 # 0: Show on all slides; 1: show on first shown; 2: show on last slide
63}65}
6466
6567
6668
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2015-12-31 22:46:06 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2016-05-17 21:10:14 +0000
@@ -127,6 +127,25 @@
127 self.language_selection_combo_box.addItems(['', '', ''])127 self.language_selection_combo_box.addItems(['', '', ''])
128 self.language_selection_layout.addWidget(self.language_selection_label)128 self.language_selection_layout.addWidget(self.language_selection_label)
129 self.language_selection_layout.addWidget(self.language_selection_combo_box)129 self.language_selection_layout.addWidget(self.language_selection_combo_box)
130
131 self.end_settings_group_box = QtWidgets.QGroupBox(self.left_column)
132 self.end_settings_group_box.setObjectName('end_settings_group_box')
133 self.end_settings_layout = QtWidgets.QFormLayout(self.end_settings_group_box)
134 self.end_settings_layout.setObjectName('end_settings_layout')
135 self.end_character_label = QtWidgets.QLabel(self.end_settings_group_box)
136 self.end_character_label.setObjectName('end_character_label')
137 self.end_character_line_edit = QtWidgets.QLineEdit(self.end_settings_group_box)
138 self.end_character_line_edit.setObjectName('end_character_line_edit')
139 self.end_character_line_edit.setMaxLength(1)
140 self.end_settings_layout.addRow(self.end_character_label, self.end_character_line_edit)
141 self.info_on_end_label = QtWidgets.QLabel(self.end_settings_group_box)
142 self.info_on_end_label.setObjectName('info_on_end_label')
143 self.info_on_end_combo_box = QtWidgets.QComboBox(self.end_settings_group_box)
144 self.info_on_end_combo_box.setObjectName('info_on_end_combo_box')
145 self.info_on_end_combo_box.addItems(['', '', ''])
146 self.end_settings_layout.addRow(self.info_on_end_label, self.info_on_end_combo_box)
147
148 self.right_layout.addWidget(self.end_settings_group_box)
130 self.right_layout.addWidget(self.language_selection_group_box)149 self.right_layout.addWidget(self.language_selection_group_box)
131 self.left_layout.addStretch()150 self.left_layout.addStretch()
132 self.right_layout.addStretch()151 self.right_layout.addStretch()
@@ -151,6 +170,7 @@
151 self.end_separator_line_edit.editingFinished.connect(self.on_end_separator_line_edit_finished)170 self.end_separator_line_edit.editingFinished.connect(self.on_end_separator_line_edit_finished)
152 Registry().register_function('theme_update_list', self.update_theme_list)171 Registry().register_function('theme_update_list', self.update_theme_list)
153 self.language_selection_combo_box.activated.connect(self.on_language_selection_combo_box_changed)172 self.language_selection_combo_box.activated.connect(self.on_language_selection_combo_box_changed)
173 self.info_on_end_combo_box.activated.connect(self.on_info_on_end_combo_box_changed)
154174
155 def retranslateUi(self):175 def retranslateUi(self):
156 self.verse_display_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))176 self.verse_display_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
@@ -194,6 +214,12 @@
194 LanguageSelection.Application, translate('BiblesPlugin.BiblesTab', 'Application Language'))214 LanguageSelection.Application, translate('BiblesPlugin.BiblesTab', 'Application Language'))
195 self.language_selection_combo_box.setItemText(215 self.language_selection_combo_box.setItemText(
196 LanguageSelection.English, translate('BiblesPlugin.BiblesTab', 'English'))216 LanguageSelection.English, translate('BiblesPlugin.BiblesTab', 'English'))
217 self.end_settings_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'End slide behaviour'))
218 self.end_character_label.setText(translate('BiblesPlugin.BiblesTab', 'Bible passage end character:'))
219 self.info_on_end_label.setText(translate('BiblesPlugin.BiblesTab', 'Show copyright info on:'))
220 self.info_on_end_combo_box.setItemText(0, translate('BiblesPlugin.BiblesTab', 'All slides (Recommended)'))
221 self.info_on_end_combo_box.setItemText(1, translate('BiblesPlugin.BiblesTab', 'First shown slide only'))
222 self.info_on_end_combo_box.setItemText(2, translate('BiblesPlugin.BiblesTab', 'Final slide of Bible passage only'))
197223
198 def on_bible_theme_combo_box_changed(self):224 def on_bible_theme_combo_box_changed(self):
199 self.bible_theme = self.bible_theme_combo_box.currentText()225 self.bible_theme = self.bible_theme_combo_box.currentText()
@@ -302,6 +328,9 @@
302 self.end_separator_line_edit.setText(get_reference_separator('sep_e_default'))328 self.end_separator_line_edit.setText(get_reference_separator('sep_e_default'))
303 self.end_separator_line_edit.setPalette(self.get_grey_text_palette(True))329 self.end_separator_line_edit.setPalette(self.get_grey_text_palette(True))
304330
331 def on_info_on_end_combo_box_changed(self):
332 self.info_on_end = self.info_on_end_combo_box.currentIndex()
333
305 def load(self):334 def load(self):
306 settings = Settings()335 settings = Settings()
307 settings.beginGroup(self.settings_section)336 settings.beginGroup(self.settings_section)
@@ -355,6 +384,9 @@
355 self.end_separator_check_box.setChecked(True)384 self.end_separator_check_box.setChecked(True)
356 self.language_selection = settings.value('book name language')385 self.language_selection = settings.value('book name language')
357 self.language_selection_combo_box.setCurrentIndex(self.language_selection)386 self.language_selection_combo_box.setCurrentIndex(self.language_selection)
387 self.end_character_line_edit.setText(settings.value('end character'))
388 self.info_on_end = settings.value('info on end')
389 self.info_on_end_combo_box.setCurrentIndex(self.info_on_end)
358 settings.endGroup()390 settings.endGroup()
359391
360 def save(self):392 def save(self):
@@ -386,6 +418,8 @@
386 if self.language_selection != settings.value('book name language'):418 if self.language_selection != settings.value('book name language'):
387 settings.setValue('book name language', self.language_selection)419 settings.setValue('book name language', self.language_selection)
388 self.settings_form.register_post_process('bibles_load_list')420 self.settings_form.register_post_process('bibles_load_list')
421 settings.setValue('end character', self.end_character_line_edit.text())
422 settings.setValue('info on end', self.info_on_end)
389 settings.endGroup()423 settings.endGroup()
390 if self.tab_visited:424 if self.tab_visited:
391 self.settings_form.register_post_process('bibles_config_updated')425 self.settings_form.register_post_process('bibles_config_updated')
392426
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2015-12-31 22:46:06 +0000
+++ openlp/plugins/songs/lib/songstab.py 2016-05-17 21:10:14 +0000
@@ -57,6 +57,23 @@
57 self.display_copyright_check_box.setObjectName('copyright_check_box')57 self.display_copyright_check_box.setObjectName('copyright_check_box')
58 self.mode_layout.addWidget(self.display_copyright_check_box)58 self.mode_layout.addWidget(self.display_copyright_check_box)
59 self.left_layout.addWidget(self.mode_group_box)59 self.left_layout.addWidget(self.mode_group_box)
60 self.end_settings_group_box = QtWidgets.QGroupBox(self.left_column)
61 self.end_settings_group_box.setObjectName('end_settings_group_box')
62 self.end_settings_layout = QtWidgets.QFormLayout(self.end_settings_group_box)
63 self.end_settings_layout.setObjectName('end_settings_layout')
64 self.end_character_label = QtWidgets.QLabel(self.end_settings_group_box)
65 self.end_character_label.setObjectName('end_character_label')
66 self.end_character_line_edit = QtWidgets.QLineEdit(self.end_settings_group_box)
67 self.end_character_line_edit.setObjectName('end_character_line_edit')
68 self.end_character_line_edit.setMaxLength(1)
69 self.end_settings_layout.addRow(self.end_character_label, self.end_character_line_edit)
70 self.info_on_end_label = QtWidgets.QLabel(self.end_settings_group_box)
71 self.info_on_end_label.setObjectName('info_on_end_label')
72 self.info_on_end_combo_box = QtWidgets.QComboBox(self.end_settings_group_box)
73 self.info_on_end_combo_box.setObjectName('info_on_end_combo_box')
74 self.info_on_end_combo_box.addItems(['', '', ''])
75 self.end_settings_layout.addRow(self.info_on_end_label, self.info_on_end_combo_box)
76 self.right_layout.addWidget(self.end_settings_group_box)
60 self.left_layout.addStretch()77 self.left_layout.addStretch()
61 self.right_layout.addStretch()78 self.right_layout.addStretch()
62 self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)79 self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
@@ -64,6 +81,7 @@
64 self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)81 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)82 self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
66 self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)83 self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)
84 self.info_on_end_combo_box.activated.connect(self.on_info_on_end_combo_box_changed)
6785
68 def retranslateUi(self):86 def retranslateUi(self):
69 self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))87 self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
@@ -76,6 +94,12 @@
76 self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',94 self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',
77 'Display "%s" symbol before copyright info') %95 'Display "%s" symbol before copyright info') %
78 SongStrings.CopyrightSymbol)96 SongStrings.CopyrightSymbol)
97 self.end_settings_group_box.setTitle(translate('SongsPlugin.SongsTab', 'End slide behaviour'))
98 self.end_character_label.setText(translate('SongsPlugin.SongsTab', 'Song end character:'))
99 self.info_on_end_label.setText(translate('SongsPlugin.SongsTab', 'Show copyright info on:'))
100 self.info_on_end_combo_box.setItemText(0, translate('SongsPlugin.SongsTab', 'All slides (Recommended)'))
101 self.info_on_end_combo_box.setItemText(1, translate('SongsPlugin.SongsTab', 'First shown slide only'))
102 self.info_on_end_combo_box.setItemText(2, translate('SongsPlugin.SongsTab', 'Final slide of song only'))
79103
80 def on_search_as_type_check_box_changed(self, check_state):104 def on_search_as_type_check_box_changed(self, check_state):
81 self.song_search = (check_state == QtCore.Qt.Checked)105 self.song_search = (check_state == QtCore.Qt.Checked)
@@ -95,6 +119,9 @@
95 def on_copyright_check_box_changed(self, check_state):119 def on_copyright_check_box_changed(self, check_state):
96 self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)120 self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)
97121
122 def on_info_on_end_combo_box_changed(self):
123 self.info_on_end = self.info_on_end_combo_box.currentIndex()
124
98 def load(self):125 def load(self):
99 settings = Settings()126 settings = Settings()
100 settings.beginGroup(self.settings_section)127 settings.beginGroup(self.settings_section)
@@ -108,6 +135,9 @@
108 self.add_from_service_check_box.setChecked(self.update_load)135 self.add_from_service_check_box.setChecked(self.update_load)
109 self.display_songbook_check_box.setChecked(self.display_songbook)136 self.display_songbook_check_box.setChecked(self.display_songbook)
110 self.display_copyright_check_box.setChecked(self.display_copyright_symbol)137 self.display_copyright_check_box.setChecked(self.display_copyright_symbol)
138 self.end_character_line_edit.setText(settings.value('end character'))
139 self.info_on_end = settings.value('info on end')
140 self.info_on_end_combo_box.setCurrentIndex(self.info_on_end)
111 settings.endGroup()141 settings.endGroup()
112142
113 def save(self):143 def save(self):
@@ -118,6 +148,8 @@
118 settings.setValue('add song from service', self.update_load)148 settings.setValue('add song from service', self.update_load)
119 settings.setValue('display songbook', self.display_songbook)149 settings.setValue('display songbook', self.display_songbook)
120 settings.setValue('display copyright symbol', self.display_copyright_symbol)150 settings.setValue('display copyright symbol', self.display_copyright_symbol)
151 settings.setValue('end character', self.end_character_line_edit.text())
152 settings.setValue('info on end', self.info_on_end)
121 settings.endGroup()153 settings.endGroup()
122 if self.tab_visited:154 if self.tab_visited:
123 self.settings_form.register_post_process('songs_config_updated')155 self.settings_form.register_post_process('songs_config_updated')
124156
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2016-03-31 16:34:22 +0000
+++ openlp/plugins/songs/songsplugin.py 2016-05-17 21:10:14 +0000
@@ -64,7 +64,9 @@
64 'songs/last directory export': '',64 'songs/last directory export': '',
65 'songs/songselect username': '',65 'songs/songselect username': '',
66 'songs/songselect password': '',66 'songs/songselect password': '',
67 'songs/songselect searches': ''67 'songs/songselect searches': '',
68 'songs/end character': '',
69 'songs/info on end': 0 # 0: Show on all slides; 1: Show on first shown slide; 2: Show on end slide
68}70}
6971
7072