diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py
index 572d96ade..91a95cddc 100644
--- a/openlp/core/lib/renderer.py
+++ b/openlp/core/lib/renderer.py
@@ -173,6 +173,7 @@ class Renderer(object):
page = []
split_lines = []
for line in text:
+ split = False
#Must be a blank line so keep it.
if len(line) == 0:
line = u' '
@@ -196,6 +197,9 @@ class Renderer(object):
split_text = line[:pos]
split_lines.append(split_text)
line = line[pos:]
+ if len(line) > 0 :
+ line = u'%s%s' % \
+ (u' '[:self._theme.font_main_indentation], line)
#Text fits in a line now
for line in split_lines:
page.append(line)
diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py
index 10f2d857a..908ea7ebf 100644
--- a/openlp/core/lib/themexmlhandler.py
+++ b/openlp/core/lib/themexmlhandler.py
@@ -51,6 +51,7 @@ blankthemexml=\
30
Normal
False
+ 0
@@ -59,6 +60,7 @@ blankthemexml=\
12
Normal
False
+ 0
@@ -167,7 +169,7 @@ class ThemeXML(object):
self.child_element(background, u'filename', filename)
def add_font(self, name, color, proportion, override, fonttype=u'main',
- weight=u'Normal', italics=u'False', xpos=0, ypos=0, width=0, height=0):
+ weight=u'Normal', italics=u'False', indentation=0, xpos=0, ypos=0, width=0, height=0):
"""
Add a Font.
@@ -192,6 +194,9 @@ class ThemeXML(object):
``italics``
Does the font render to italics Defaults to 0 Normal
+ ``indentation``
+ Number of characters the wrap line is indented
+
``xpos``
The X position of the text block.
@@ -217,6 +222,9 @@ class ThemeXML(object):
self.child_element(background, u'weight', weight)
#Create italics name element
self.child_element(background, u'italics', italics)
+ #Create indentation name element
+ self.child_element(background, u'indentation', unicode(indentation))
+
#Create Location element
element = self.theme_xml.createElement(u'location')
element.setAttribute(u'override',override)
diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py
index 63ffea5d8..4b99b6969 100644
--- a/openlp/core/ui/amendthemedialog.py
+++ b/openlp/core/ui/amendthemedialog.py
@@ -177,6 +177,16 @@ class Ui_AmendThemeDialog(object):
self.FontMainWeightLabel.setObjectName("FontMainWeightLabel")
self.MainFontLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.FontMainWeightLabel)
self.MainLeftLayout.addWidget(self.FontMainGroupBox)
+ self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox)
+ self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel")
+ self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapIndentationLabel)
+ self.FontMainLineSpacingSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
+ self.FontMainLineSpacingSpinBox.setObjectName("FontMainLineSpacingSpinBox")
+ self.FontMainLineSpacingSpinBox.setMaximum(10)
+ self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineSpacingSpinBox)
+ self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox)
+ self.FontMainLinesPageLabel.setObjectName("FontMainLinesPageLabel")
+ self.MainFontLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.FontMainLinesPageLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.MainLeftLayout.addItem(spacerItem1)
self.FontMainLayout.addWidget(self.MainLeftWidget)
@@ -528,7 +538,9 @@ class Ui_AmendThemeDialog(object):
AmendThemeDialog.setTabOrder(self.GradientComboBox, self.FontMainComboBox)
AmendThemeDialog.setTabOrder(self.FontMainComboBox, self.FontMainColorPushButton)
AmendThemeDialog.setTabOrder(self.FontMainColorPushButton, self.FontMainSizeSpinBox)
- AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainDefaultCheckBox)
+ AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox, self.FontMainWeightComboBox)
+ AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox, self.FontMainLineSpacingSpinBox)
+ AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox, self.FontMainDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox, self.FontMainXSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainXSpinBox, self.FontMainYSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainYSpinBox, self.FontMainWidthSpinBox)
@@ -536,7 +548,8 @@ class Ui_AmendThemeDialog(object):
AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox, self.FontFooterComboBox)
AmendThemeDialog.setTabOrder(self.FontFooterComboBox, self.FontFooterColorPushButton)
AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton, self.FontFooterSizeSpinBox)
- AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterDefaultCheckBox)
+ AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox, self.FontFooterWeightComboBox)
+ AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox, self.FontFooterDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox, self.FontFooterXSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox, self.FontFooterYSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox, self.FontFooterWidthSpinBox)
@@ -571,10 +584,11 @@ class Ui_AmendThemeDialog(object):
self.FontMainColorLabel.setText(translate(u'AmendThemeDialog', u'Font Color:'))
self.FontMainSize.setText(translate(u'AmendThemeDialog', u'Size:'))
self.FontMainSizeSpinBox.setSuffix(translate(u'AmendThemeDialog', u'pt'))
- self.FontMainWeightComboBox.setItemText(0, translate("AmendThemeDialog", u'Normal'))
- self.FontMainWeightComboBox.setItemText(1, translate("AmendThemeDialog", u'Bold'))
- self.FontMainWeightComboBox.setItemText(2, translate("AmendThemeDialog", u'Italics'))
- self.FontMainWeightComboBox.setItemText(3, translate("AmendThemeDialog", u'Bold/Italics'))
+ self.FontMainWrapIndentationLabel.setText(translate(u'AmendThemeDialog', u'Wrap Indentation'))
+ self.FontMainWeightComboBox.setItemText(0, translate(u'AmendThemeDialog', u'Normal'))
+ self.FontMainWeightComboBox.setItemText(1, translate(u'AmendThemeDialog', u'Bold'))
+ self.FontMainWeightComboBox.setItemText(2, translate(u'AmendThemeDialog', u'Italics'))
+ self.FontMainWeightComboBox.setItemText(3, translate(u'AmendThemeDialog', u'Bold/Italics'))
self.FontMainWeightLabel.setText(translate("AmendThemeDialog", u'Font Weight:'))
self.MainLocationGroupBox.setTitle(translate(u'AmendThemeDialog', u'Display Location'))
self.DefaultLocationLabel.setText(translate(u'AmendThemeDialog', u'Use Default Location:'))
diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py
index 8ff978b68..af039852e 100644
--- a/openlp/core/ui/amendthemeform.py
+++ b/openlp/core/ui/amendthemeform.py
@@ -100,6 +100,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.QObject.connect(self.FontMainHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainHeightSpinBoxChanged)
+ QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
+ QtCore.SIGNAL(u'editingFinished()'),
+ self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontFooterDefaultCheckBoxChanged)
@@ -150,6 +153,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
unicode(self.theme.font_main_override), u'main',
unicode(self.theme.font_main_weight),
unicode(self.theme.font_main_italics),
+ unicode(self.theme.font_main_indentation),
unicode(self.theme.font_main_x),
unicode(self.theme.font_main_y),
unicode(self.theme.font_main_width),
@@ -160,6 +164,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
unicode(self.theme.font_footer_override), u'footer',
unicode(self.theme.font_footer_weight),
unicode(self.theme.font_footer_italics),
+ 0,
unicode(self.theme.font_footer_x),
unicode(self.theme.font_footer_y),
unicode(self.theme.font_footer_width),
@@ -187,6 +192,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.parse(xml)
self.theme.extend_image_filename(self.path)
self.thememanager.cleanTheme(self.theme)
+ # Stop the initial screen setup generating 1 preview per field!
self.allowPreview = False
self.paintUi(self.theme)
self.allowPreview = True
@@ -252,6 +258,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
self.FontMainHeightSpinBox.setValue(int( \
self.theme.font_main_height))
+ self.FontMainLineSpacingSpinBox.setValue(int( \
+ self.theme.font_main_indentation))
self.stateChanging(self.theme)
self.previewTheme(self.theme)
@@ -270,6 +278,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.font_main_width = self.FontMainWidthSpinBox.value()
self.previewTheme(self.theme)
+ def onFontMainLineSpacingSpinBoxChanged(self):
+ if self.theme.font_main_indentation != self.FontMainLineSpacingSpinBox.value():
+ self.theme.font_main_indentation = self.FontMainLineSpacingSpinBox.value()
+ self.previewTheme(self.theme)
+
def onFontMainHeightSpinBoxChanged(self):
if self.theme.font_main_height != self.FontMainHeightSpinBox.value():
self.theme.font_main_height = self.FontMainHeightSpinBox.value()
@@ -498,7 +511,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.FontMainWeightComboBox.setCurrentIndex(2)
else:
self.FontMainWeightComboBox.setCurrentIndex(3)
-
+ self.FontMainLineSpacingSpinBox.setValue(int(self.theme.font_main_indentation))
self.FontMainXSpinBox.setValue(int(self.theme.font_main_x))
self.FontMainYSpinBox.setValue(int(self.theme.font_main_y))
self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
@@ -653,5 +666,17 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def previewTheme(self, theme):
if self.allowPreview:
+ #calculate main number of rows
+ main_weight = 50
+ if self.theme.font_main_weight == u'Bold':
+ main_weight = 75
+ mainFont = QtGui.QFont(self.theme.font_main_name,
+ int(self.theme.font_main_proportion), # size
+ int(main_weight), # weight
+ self.theme.font_main_italics)# italic
+ metrics = QtGui.QFontMetrics(mainFont)
+ page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2 ) - 1
+ self.FontMainLinesPageLabel.setText(
+ translate(u'ThemeManager', u'Slide Height is %s rows' % page_length ))
frame = self.thememanager.generateImage(theme)
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py
index 50e433534..84f88c726 100644
--- a/openlp/core/ui/thememanager.py
+++ b/openlp/core/ui/thememanager.py
@@ -510,6 +510,7 @@ class ThemeManager(QtGui.QWidget):
theme.font_main_color = theme.font_main_color.strip()
theme.font_main_height = theme.font_main_height.strip()
theme.font_main_italics = str_to_bool(theme.font_main_italics)
+ theme.font_main_indentation = int(theme.font_main_indentation)
theme.font_main_name = theme.font_main_name.strip()
#theme.font_main_override
theme.font_main_proportion = theme.font_main_proportion.strip()
diff --git a/resources/forms/amendthemedialog.ui b/resources/forms/amendthemedialog.ui
index 84fa8b7bd..90ed34cc5 100644
--- a/resources/forms/amendthemedialog.ui
+++ b/resources/forms/amendthemedialog.ui
@@ -17,7 +17,7 @@
Theme Maintance
-
+
:/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp
@@ -64,7 +64,7 @@
-
- 0
+ 2
@@ -312,15 +312,32 @@
0
-
- 16
-
pt
999
+
+ 16
+
+
+
+ -
+
+
+ Wrap Indentation
+
+
+
+ -
+
+
+ -
+
+
+ TextLabel
+
@@ -425,15 +442,15 @@
0
-
- 0
-
px
9999
+
+ 0
+
-
@@ -609,15 +626,15 @@
0
-
- 10
-
pt
999
+
+ 10
+
@@ -728,15 +745,15 @@
0
-
- 0
-
px
9999
+
+ 0
+
-
@@ -753,15 +770,15 @@
0
-
- 0
-
px
9999
+
+ 0
+
-