openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #28976
[Merge] lp:~richie-the-g/openlp/song-end-character into lp:openlp
Richard Graham has proposed merging lp:~richie-the-g/openlp/song-end-character into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~richie-the-g/openlp/song-end-character/+merge/290359
Added the option to put a character at the end of the final slide of a song (as suggested at forums.openlp.org/discussion/2121/). Character is specified in the theme under <display><endCharacter>, and specified by the user in the Theme Wizard. Allows themes without this XML definition to be used.
--
Your team OpenLP Core is requested to review the proposed merge of lp:~richie-the-g/openlp/song-end-character into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2015-12-31 22:46:06 +0000
+++ openlp/core/lib/serviceitem.py 2016-03-29 19:32:08 +0000
@@ -267,6 +267,14 @@
'html': html_data.replace('&nbsp;', ' '),
'verseTag': verse_tag
})
+ else:
+ try:
+ # Code to add a symbol to the end of the text on the final slide.
+ display_at_end = "<br>" + self.theme_data.display_end_character
+ self._display_frames[(len(self._display_frames))-1]['html'] += display_at_end
+ except AttributeError:
+ pass
+
elif self.service_item_type == ServiceItemType.Image or self.service_item_type == ServiceItemType.Command:
pass
else:
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2015-12-31 22:46:06 +0000
+++ openlp/core/lib/theme.py 2016-03-29 19:32:08 +0000
@@ -318,13 +318,14 @@
element.appendChild(value)
background.appendChild(element)
- def add_display(self, horizontal, vertical, transition):
+ def add_display(self, horizontal, vertical, transition, end_char):
"""
Add a Display options.
:param horizontal: The horizontal alignment of the text.
:param vertical: The vertical alignment of the text.
:param transition: Whether the slide transition is active.
+ :param end_char: The end character (if there is one) for the final slide.
"""
background = self.theme_xml.createElement('display')
self.theme.appendChild(background)
@@ -343,6 +344,11 @@
value = self.theme_xml.createTextNode(str(transition))
element.appendChild(value)
background.appendChild(element)
+ # End Character
+ element = self.theme_xml.createElement('endCharacter')
+ value = self.theme_xml.createTextNode(str(end_char))
+ element.appendChild(value)
+ background.appendChild(element)
def child_element(self, element, tag, value):
"""
@@ -555,5 +561,6 @@
self.add_display(
self.display_horizontal_align,
self.display_vertical_align,
- self.display_slide_transition
+ self.display_slide_transition,
+ self.display_end_character
)
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2016-01-08 21:44:22 +0000
+++ openlp/core/ui/themeform.py 2016-03-29 19:32:08 +0000
@@ -134,6 +134,7 @@
self.background_page.registerField('horizontal', self.horizontal_combo_box)
self.background_page.registerField('vertical', self.vertical_combo_box)
self.background_page.registerField('slide_transition', self.transitions_check_box)
+ self.background_page.registerField('end_char', self.end_char_line_edit)
self.background_page.registerField('name', self.theme_name_edit)
def calculate_lines(self):
@@ -367,6 +368,12 @@
self.setField('horizontal', self.theme.display_horizontal_align)
self.setField('vertical', self.theme.display_vertical_align)
self.setField('slide_transition', self.theme.display_slide_transition)
+ try:
+ self.setField('end_char', self.theme.display_end_character)
+ except AttributeError:
+ pass
+ # This is in a 'try' to allow for themes without this attribute in the XML
+ # to correctly load.
def set_preview_page_values(self):
"""
@@ -469,7 +476,7 @@
def update_theme(self):
"""
Update the theme object from the UI for fields not already updated
- when the are changed.
+ when they are changed.
"""
if not self.update_theme_allowed:
return
@@ -498,6 +505,7 @@
self.theme.display_horizontal_align = self.horizontal_combo_box.currentIndex()
self.theme.display_vertical_align = self.vertical_combo_box.currentIndex()
self.theme.display_slide_transition = self.field('slide_transition')
+ self.theme.display_end_character = self.end_char_line_edit.text() # "~"
def accept(self):
"""
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2015-12-31 22:46:06 +0000
+++ openlp/core/ui/themewizard.py 2016-03-29 19:32:08 +0000
@@ -261,6 +261,13 @@
self.transitions_check_box.setObjectName('transitions_check_box')
self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box)
self.alignment_layout.setItem(3, QtWidgets.QFormLayout.LabelRole, self.spacer)
+ self.end_char_label = QtWidgets.QLabel(self.alignment_page)
+ self.end_char_label.setObjectName('end_char_label')
+ self.end_char_label.setText('End character:')
+ self.end_char_line_edit = QtWidgets.QLineEdit(self.alignment_page)
+ self.end_char_line_edit.setObjectName('end_char_line_edit')
+ self.end_char_line_edit.setMaxLength(1)
+ self.alignment_layout.addRow(self.end_char_label, self.end_char_line_edit)
theme_wizard.addPage(self.alignment_page)
# Area Position Page
self.area_position_page = QtWidgets.QWizardPage()
@@ -396,7 +403,7 @@
self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)
self.background_combo_box.setItemText(BackgroundType.Transparent,
translate('OpenLP.ThemeWizard', 'Transparent'))
- self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
+ self.color_label.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
@@ -416,7 +423,7 @@
self.main_area_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '
'characteristics for the Display text'))
self.main_font_label.setText(translate('OpenLP.ThemeWizard', 'Font:'))
- self.main_color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
+ self.main_color_label.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.main_size_label.setText(translate('OpenLP.ThemeWizard', 'Size:'))
self.main_size_spin_box.setSuffix(UiStrings().FontSizePtUnit)
self.line_spacing_label.setText(translate('OpenLP.ThemeWizard', 'Line Spacing:'))
@@ -433,7 +440,7 @@
self.footer_area_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display '
'characteristics for the Footer text'))
self.footer_font_label.setText(translate('OpenLP.ThemeWizard', 'Font:'))
- self.footer_color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
+ self.footer_color_label.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.footer_size_label.setText(translate('OpenLP.ThemeWizard', 'Size:'))
self.footer_size_spin_box.setSuffix(UiStrings().FontSizePtUnit)
self.alignment_page.setTitle(translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
@@ -473,6 +480,7 @@
self.preview_page.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
+ self.end_char_line_edit.setText(translate('OpenLP.ThemeWizard', 'Song end character:'))
# Align all QFormLayouts towards each other.
label_width = max(self.background_label.minimumSizeHint().width(),
self.horizontal_label.minimumSizeHint().width())
Follow ups