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
1=== modified file 'openlp/core/lib/serviceitem.py'
2--- openlp/core/lib/serviceitem.py 2016-05-05 03:57:04 +0000
3+++ openlp/core/lib/serviceitem.py 2016-05-17 21:10:14 +0000
4@@ -267,6 +267,9 @@
5 'html': html_data.replace('&amp;nbsp;', '&nbsp;'),
6 'verseTag': verse_tag
7 })
8+ if hasattr(self, 'name') and ((self.name == 'songs') or (self.name == 'bibles')):
9+ display_at_end = "<br>" + (Settings().value(self.name + '/end character'))
10+ self._display_frames[(len(self._display_frames)) - 1]['html'] += display_at_end
11 elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
12 pass
13 else:
14
15=== modified file 'openlp/core/ui/maindisplay.py'
16--- openlp/core/ui/maindisplay.py 2016-05-02 08:05:47 +0000
17+++ openlp/core/ui/maindisplay.py 2016-05-17 21:10:14 +0000
18@@ -471,8 +471,6 @@
19 html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
20 plugins=self.plugin_manager.plugins)
21 self.web_view.setHtml(html)
22- if service_item.foot_text:
23- self.footer(service_item.foot_text)
24 # if was hidden keep it hidden
25 if self.hide_mode and self.is_live and not service_item.is_media():
26 if Settings().value('core/auto unblank'):
27
28=== modified file 'openlp/core/ui/slidecontroller.py'
29--- openlp/core/ui/slidecontroller.py 2016-05-05 03:57:04 +0000
30+++ openlp/core/ui/slidecontroller.py 2016-05-17 21:10:14 +0000
31@@ -167,6 +167,7 @@
32 self.panel = QtWidgets.QWidget(self.main_window.control_splitter)
33 self.slide_list = {}
34 self.slide_count = 0
35+ self.item_slide_count = 0
36 self.slide_image = None
37 self.controller_width = -1
38 # Layout for holding panel
39@@ -889,6 +890,7 @@
40 else:
41 row += 1
42 self.slide_list[str(row)] = row - 1
43+ self.item_slide_count = 0 # How many slides of the current item have been shown
44 else:
45 row += 1
46 self.slide_list[str(row)] = row - 1
47@@ -896,6 +898,7 @@
48 if not self.service_item.is_command() and frame_number == slide_no:
49 self.service_item.bg_image_bytes = \
50 self.image_manager.get_image_bytes(frame['path'], ImageSource.ImagePlugin)
51+
52 self.preview_widget.replace_service_item(self.service_item, width, slide_no)
53 self.enable_tool_bar(self.service_item)
54 # Pass to display for viewing.
55@@ -1105,6 +1108,23 @@
56 to_display = self.service_item.get_rendered_frame(row)
57 if self.service_item.is_text():
58 self.display.text(to_display, row != old_selected_row)
59+ if (self.service_item.name == 'songs') or (self.service_item.name == 'bibles'):
60+ if Settings().value(self.service_item.name + '/info on end') == 1:
61+ if self.item_slide_count == 0:
62+ self.display.footer(self.service_item.foot_text)
63+ else:
64+ self.display.footer('')
65+ elif Settings().value(self.service_item.name + '/info on end') == 2:
66+ if row == (len(self.service_item._display_frames)-1):
67+ self.display.footer(self.service_item.foot_text)
68+ else:
69+ self.display.footer('')
70+ else:
71+ self.display.footer(self.service_item.foot_text)
72+ elif self.service_item.foot_text:
73+ self.display.footer(self.service_item.foot_text)
74+ else:
75+ self.display.footer('')
76 else:
77 if start:
78 self.display.build_html(self.service_item, to_display)
79@@ -1155,6 +1175,7 @@
80 self.slide_image.setDevicePixelRatio(self.main_window.devicePixelRatio())
81 self.slide_preview.setPixmap(self.slide_image)
82 self.slide_count += 1
83+ self.item_slide_count += 1
84
85 def grab_maindisplay(self):
86 """
87
88=== modified file 'openlp/plugins/bibles/bibleplugin.py'
89--- openlp/plugins/bibles/bibleplugin.py 2016-03-31 16:34:22 +0000
90+++ openlp/plugins/bibles/bibleplugin.py 2016-05-17 21:10:14 +0000
91@@ -59,7 +59,9 @@
92 'bibles/range separator': '',
93 'bibles/list separator': '',
94 'bibles/end separator': '',
95- 'bibles/last directory import': ''
96+ 'bibles/last directory import': '',
97+ 'bibles/end character': '',
98+ 'bibles/info on end': 0 # 0: Show on all slides; 1: show on first shown; 2: show on last slide
99 }
100
101
102
103=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
104--- openlp/plugins/bibles/lib/biblestab.py 2015-12-31 22:46:06 +0000
105+++ openlp/plugins/bibles/lib/biblestab.py 2016-05-17 21:10:14 +0000
106@@ -127,6 +127,25 @@
107 self.language_selection_combo_box.addItems(['', '', ''])
108 self.language_selection_layout.addWidget(self.language_selection_label)
109 self.language_selection_layout.addWidget(self.language_selection_combo_box)
110+
111+ self.end_settings_group_box = QtWidgets.QGroupBox(self.left_column)
112+ self.end_settings_group_box.setObjectName('end_settings_group_box')
113+ self.end_settings_layout = QtWidgets.QFormLayout(self.end_settings_group_box)
114+ self.end_settings_layout.setObjectName('end_settings_layout')
115+ self.end_character_label = QtWidgets.QLabel(self.end_settings_group_box)
116+ self.end_character_label.setObjectName('end_character_label')
117+ self.end_character_line_edit = QtWidgets.QLineEdit(self.end_settings_group_box)
118+ self.end_character_line_edit.setObjectName('end_character_line_edit')
119+ self.end_character_line_edit.setMaxLength(1)
120+ self.end_settings_layout.addRow(self.end_character_label, self.end_character_line_edit)
121+ self.info_on_end_label = QtWidgets.QLabel(self.end_settings_group_box)
122+ self.info_on_end_label.setObjectName('info_on_end_label')
123+ self.info_on_end_combo_box = QtWidgets.QComboBox(self.end_settings_group_box)
124+ self.info_on_end_combo_box.setObjectName('info_on_end_combo_box')
125+ self.info_on_end_combo_box.addItems(['', '', ''])
126+ self.end_settings_layout.addRow(self.info_on_end_label, self.info_on_end_combo_box)
127+
128+ self.right_layout.addWidget(self.end_settings_group_box)
129 self.right_layout.addWidget(self.language_selection_group_box)
130 self.left_layout.addStretch()
131 self.right_layout.addStretch()
132@@ -151,6 +170,7 @@
133 self.end_separator_line_edit.editingFinished.connect(self.on_end_separator_line_edit_finished)
134 Registry().register_function('theme_update_list', self.update_theme_list)
135 self.language_selection_combo_box.activated.connect(self.on_language_selection_combo_box_changed)
136+ self.info_on_end_combo_box.activated.connect(self.on_info_on_end_combo_box_changed)
137
138 def retranslateUi(self):
139 self.verse_display_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
140@@ -194,6 +214,12 @@
141 LanguageSelection.Application, translate('BiblesPlugin.BiblesTab', 'Application Language'))
142 self.language_selection_combo_box.setItemText(
143 LanguageSelection.English, translate('BiblesPlugin.BiblesTab', 'English'))
144+ self.end_settings_group_box.setTitle(translate('BiblesPlugin.BiblesTab', 'End slide behaviour'))
145+ self.end_character_label.setText(translate('BiblesPlugin.BiblesTab', 'Bible passage end character:'))
146+ self.info_on_end_label.setText(translate('BiblesPlugin.BiblesTab', 'Show copyright info on:'))
147+ self.info_on_end_combo_box.setItemText(0, translate('BiblesPlugin.BiblesTab', 'All slides (Recommended)'))
148+ self.info_on_end_combo_box.setItemText(1, translate('BiblesPlugin.BiblesTab', 'First shown slide only'))
149+ self.info_on_end_combo_box.setItemText(2, translate('BiblesPlugin.BiblesTab', 'Final slide of Bible passage only'))
150
151 def on_bible_theme_combo_box_changed(self):
152 self.bible_theme = self.bible_theme_combo_box.currentText()
153@@ -302,6 +328,9 @@
154 self.end_separator_line_edit.setText(get_reference_separator('sep_e_default'))
155 self.end_separator_line_edit.setPalette(self.get_grey_text_palette(True))
156
157+ def on_info_on_end_combo_box_changed(self):
158+ self.info_on_end = self.info_on_end_combo_box.currentIndex()
159+
160 def load(self):
161 settings = Settings()
162 settings.beginGroup(self.settings_section)
163@@ -355,6 +384,9 @@
164 self.end_separator_check_box.setChecked(True)
165 self.language_selection = settings.value('book name language')
166 self.language_selection_combo_box.setCurrentIndex(self.language_selection)
167+ self.end_character_line_edit.setText(settings.value('end character'))
168+ self.info_on_end = settings.value('info on end')
169+ self.info_on_end_combo_box.setCurrentIndex(self.info_on_end)
170 settings.endGroup()
171
172 def save(self):
173@@ -386,6 +418,8 @@
174 if self.language_selection != settings.value('book name language'):
175 settings.setValue('book name language', self.language_selection)
176 self.settings_form.register_post_process('bibles_load_list')
177+ settings.setValue('end character', self.end_character_line_edit.text())
178+ settings.setValue('info on end', self.info_on_end)
179 settings.endGroup()
180 if self.tab_visited:
181 self.settings_form.register_post_process('bibles_config_updated')
182
183=== modified file 'openlp/plugins/songs/lib/songstab.py'
184--- openlp/plugins/songs/lib/songstab.py 2015-12-31 22:46:06 +0000
185+++ openlp/plugins/songs/lib/songstab.py 2016-05-17 21:10:14 +0000
186@@ -57,6 +57,23 @@
187 self.display_copyright_check_box.setObjectName('copyright_check_box')
188 self.mode_layout.addWidget(self.display_copyright_check_box)
189 self.left_layout.addWidget(self.mode_group_box)
190+ self.end_settings_group_box = QtWidgets.QGroupBox(self.left_column)
191+ self.end_settings_group_box.setObjectName('end_settings_group_box')
192+ self.end_settings_layout = QtWidgets.QFormLayout(self.end_settings_group_box)
193+ self.end_settings_layout.setObjectName('end_settings_layout')
194+ self.end_character_label = QtWidgets.QLabel(self.end_settings_group_box)
195+ self.end_character_label.setObjectName('end_character_label')
196+ self.end_character_line_edit = QtWidgets.QLineEdit(self.end_settings_group_box)
197+ self.end_character_line_edit.setObjectName('end_character_line_edit')
198+ self.end_character_line_edit.setMaxLength(1)
199+ self.end_settings_layout.addRow(self.end_character_label, self.end_character_line_edit)
200+ self.info_on_end_label = QtWidgets.QLabel(self.end_settings_group_box)
201+ self.info_on_end_label.setObjectName('info_on_end_label')
202+ self.info_on_end_combo_box = QtWidgets.QComboBox(self.end_settings_group_box)
203+ self.info_on_end_combo_box.setObjectName('info_on_end_combo_box')
204+ self.info_on_end_combo_box.addItems(['', '', ''])
205+ self.end_settings_layout.addRow(self.info_on_end_label, self.info_on_end_combo_box)
206+ self.right_layout.addWidget(self.end_settings_group_box)
207 self.left_layout.addStretch()
208 self.right_layout.addStretch()
209 self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
210@@ -64,6 +81,7 @@
211 self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
212 self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
213 self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)
214+ self.info_on_end_combo_box.activated.connect(self.on_info_on_end_combo_box_changed)
215
216 def retranslateUi(self):
217 self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
218@@ -76,6 +94,12 @@
219 self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',
220 'Display "%s" symbol before copyright info') %
221 SongStrings.CopyrightSymbol)
222+ self.end_settings_group_box.setTitle(translate('SongsPlugin.SongsTab', 'End slide behaviour'))
223+ self.end_character_label.setText(translate('SongsPlugin.SongsTab', 'Song end character:'))
224+ self.info_on_end_label.setText(translate('SongsPlugin.SongsTab', 'Show copyright info on:'))
225+ self.info_on_end_combo_box.setItemText(0, translate('SongsPlugin.SongsTab', 'All slides (Recommended)'))
226+ self.info_on_end_combo_box.setItemText(1, translate('SongsPlugin.SongsTab', 'First shown slide only'))
227+ self.info_on_end_combo_box.setItemText(2, translate('SongsPlugin.SongsTab', 'Final slide of song only'))
228
229 def on_search_as_type_check_box_changed(self, check_state):
230 self.song_search = (check_state == QtCore.Qt.Checked)
231@@ -95,6 +119,9 @@
232 def on_copyright_check_box_changed(self, check_state):
233 self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)
234
235+ def on_info_on_end_combo_box_changed(self):
236+ self.info_on_end = self.info_on_end_combo_box.currentIndex()
237+
238 def load(self):
239 settings = Settings()
240 settings.beginGroup(self.settings_section)
241@@ -108,6 +135,9 @@
242 self.add_from_service_check_box.setChecked(self.update_load)
243 self.display_songbook_check_box.setChecked(self.display_songbook)
244 self.display_copyright_check_box.setChecked(self.display_copyright_symbol)
245+ self.end_character_line_edit.setText(settings.value('end character'))
246+ self.info_on_end = settings.value('info on end')
247+ self.info_on_end_combo_box.setCurrentIndex(self.info_on_end)
248 settings.endGroup()
249
250 def save(self):
251@@ -118,6 +148,8 @@
252 settings.setValue('add song from service', self.update_load)
253 settings.setValue('display songbook', self.display_songbook)
254 settings.setValue('display copyright symbol', self.display_copyright_symbol)
255+ settings.setValue('end character', self.end_character_line_edit.text())
256+ settings.setValue('info on end', self.info_on_end)
257 settings.endGroup()
258 if self.tab_visited:
259 self.settings_form.register_post_process('songs_config_updated')
260
261=== modified file 'openlp/plugins/songs/songsplugin.py'
262--- openlp/plugins/songs/songsplugin.py 2016-03-31 16:34:22 +0000
263+++ openlp/plugins/songs/songsplugin.py 2016-05-17 21:10:14 +0000
264@@ -64,7 +64,9 @@
265 'songs/last directory export': '',
266 'songs/songselect username': '',
267 'songs/songselect password': '',
268- 'songs/songselect searches': ''
269+ 'songs/songselect searches': '',
270+ 'songs/end character': '',
271+ 'songs/info on end': 0 # 0: Show on all slides; 1: Show on first shown slide; 2: Show on end slide
272 }
273
274