diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 78e37a76a..3cb38bfa0 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -43,9 +43,8 @@ class Renderer(object): self._rect = None self._debug = 0 self._right_margin = 64 # the amount of right indent - self._shadow_offset = 5 - self._shadow_offset_footer = 3 - self._outline_offset = 2 + self._display_shadow_size_footer = 0 + self._display_outline_size_footer = 0 self.theme_name = None self._theme = None self._bg_image_filename = None @@ -426,23 +425,25 @@ class Renderer(object): # dont allow alignment messing with footers if footer: align = 0 - shadow_offset = self._shadow_offset_footer + display_shadow_size = self._display_shadow_size_footer + display_outline_size = self._display_outline_size_footer else: align = self._theme.display_horizontalAlign - shadow_offset = self._shadow_offset + display_shadow_size = int(self._theme.display_shadow_size) + display_outline_size = int(self._theme.display_outline_size) for linenum in range(len(lines)): line = lines[linenum] #find out how wide line is w, h = self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=False) if self._theme.display_shadow: - w += shadow_offset - h += shadow_offset + w += display_shadow_size + h += display_shadow_size if self._theme.display_outline: # pixels either side - w += 2 * self._outline_offset + w += 2 * display_outline_size # pixels top/bottom - h += 2 * self._outline_offset + h += 2 * display_outline_size if align == 0: # left align rightextent = x + w # shift right from last line's rh edge @@ -464,36 +465,36 @@ class Renderer(object): # now draw the text, and any outlines/shadows if self._theme.display_shadow: self._get_extent_and_render(line, footer, - tlcorner=(x + shadow_offset, y + shadow_offset), + tlcorner=(x + display_shadow_size, y + display_shadow_size), draw=True, color = self._theme.display_shadow_color) if self._theme.display_outline: self._get_extent_and_render(line, footer, - (x + self._outline_offset, y), draw=True, + (x + display_outline_size, y), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x, y + self._outline_offset), draw=True, + (x, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x, y - self._outline_offset), draw=True, + (x, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y), draw=True, + (x - display_outline_size, y), draw=True, color = self._theme.display_outline_color) - if self._outline_offset > 1: + if display_outline_size > 1: self._get_extent_and_render(line, footer, - (x + self._outline_offset, y + self._outline_offset), + (x + display_outline_size, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y + self._outline_offset), + (x - display_outline_size, y + display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x + self._outline_offset, y - self._outline_offset), + (x + display_outline_size, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer, - (x - self._outline_offset, y - self._outline_offset), + (x - display_outline_size, y - display_outline_size), draw=True, color = self._theme.display_outline_color) self._get_extent_and_render(line, footer,tlcorner=(x, y), diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 42743d1bd..6b12f50dc 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -65,8 +65,8 @@ blankthemexml=\ - True - False + True + False 0 0 0 @@ -238,7 +238,7 @@ class ThemeXML(object): background.appendChild(element) def add_display(self, shadow, shadow_color, outline, outline_color, - horizontal, vertical, wrap, transition): + horizontal, vertical, wrap, transition, shadow_pixel=5, outline_pixel=2): """ Add a Display options. @@ -272,12 +272,14 @@ class ThemeXML(object): # Shadow element = self.theme_xml.createElement(u'shadow') element.setAttribute(u'color', shadow_color) + element.setAttribute(u'size', unicode(shadow_pixel)) value = self.theme_xml.createTextNode(shadow) element.appendChild(value) background.appendChild(element) # Outline element = self.theme_xml.createElement(u'outline') element.setAttribute(u'color', outline_color) + element.setAttribute(u'size', unicode(outline_pixel)) value = self.theme_xml.createTextNode(outline) element.appendChild(value) background.appendChild(element) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index ad5fbe65f..dffd1dedf 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -410,13 +410,13 @@ class Ui_AmendThemeDialog(object): self.OptionsLeftLayout.setSpacing(8) self.OptionsLeftLayout.setMargin(0) self.OptionsLeftLayout.setObjectName(u'OptionsLeftLayout') - self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) - self.ShadowGroupBox.setObjectName(u'ShadowGroupBox') - self.verticalLayout = QtGui.QVBoxLayout(self.ShadowGroupBox) + self.OutlineGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) + self.OutlineGroupBox.setObjectName(u'OutlineGroupBox') + self.verticalLayout = QtGui.QVBoxLayout(self.OutlineGroupBox) self.verticalLayout.setSpacing(8) self.verticalLayout.setMargin(8) self.verticalLayout.setObjectName(u'verticalLayout') - self.OutlineWidget = QtGui.QWidget(self.ShadowGroupBox) + self.OutlineWidget = QtGui.QWidget(self.OutlineGroupBox) self.OutlineWidget.setObjectName(u'OutlineWidget') self.OutlineLayout = QtGui.QFormLayout(self.OutlineWidget) self.OutlineLayout.setMargin(0) @@ -425,16 +425,30 @@ class Ui_AmendThemeDialog(object): self.OutlineCheckBox = QtGui.QCheckBox(self.OutlineWidget) self.OutlineCheckBox.setObjectName(u'OutlineCheckBox') self.OutlineLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.OutlineCheckBox) + self.OutlineSpinBox = QtGui.QSpinBox(self.OutlineWidget) + self.OutlineSpinBox.setObjectName("OutlineSpinBox") + self.OutlineSpinBox.setMaximum(10) + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineSpinBox) + self.OutlineSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) + self.OutlineSpinBoxLabel.setObjectName(u'OutlineSpinBoxLabel') + self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineSpinBoxLabel) self.OutlineColorLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineColorLabel.setObjectName(u'OutlineColorLabel') - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.OutlineColorLabel) self.OutlineColorPushButton = QtGui.QPushButton(self.OutlineWidget) self.OutlineColorPushButton.setObjectName(u'OutlineColorPushButton') - self.OutlineLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) + self.OutlineLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.OutlineColorPushButton) self.OutlineEnabledLabel = QtGui.QLabel(self.OutlineWidget) self.OutlineEnabledLabel.setObjectName(u'OutlineEnabledLabel') self.OutlineLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.OutlineEnabledLabel) self.verticalLayout.addWidget(self.OutlineWidget) + self.OptionsLeftLayout.addWidget(self.OutlineGroupBox) + self.ShadowGroupBox = QtGui.QGroupBox(self.OptionsLeftWidget) + self.ShadowGroupBox.setObjectName(u'ShadowGroupBox') + self.verticalLayout = QtGui.QVBoxLayout(self.ShadowGroupBox) + self.verticalLayout.setSpacing(8) + self.verticalLayout.setMargin(8) + self.verticalLayout.setObjectName(u'verticalLayout') self.ShadowWidget = QtGui.QWidget(self.ShadowGroupBox) self.ShadowWidget.setObjectName(u'ShadowWidget') self.ShadowLayout = QtGui.QFormLayout(self.ShadowWidget) @@ -444,12 +458,19 @@ class Ui_AmendThemeDialog(object): self.ShadowCheckBox = QtGui.QCheckBox(self.ShadowWidget) self.ShadowCheckBox.setObjectName(u'ShadowCheckBox') self.ShadowLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.ShadowCheckBox) + self.ShadowSpinBox = QtGui.QSpinBox(self.OutlineWidget) + self.ShadowSpinBox.setObjectName("ShadowSpinBox") + self.ShadowSpinBox.setMaximum(10) + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowSpinBox) + self.ShadowSpinBoxLabel = QtGui.QLabel(self.OutlineWidget) + self.ShadowSpinBoxLabel.setObjectName(u'ShadowSpinBoxLabel') + self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowSpinBoxLabel) self.ShadowColorLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowColorLabel.setObjectName(u'ShadowColorLabel') - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.ShadowColorLabel) self.ShadowColorPushButton = QtGui.QPushButton(self.ShadowWidget) self.ShadowColorPushButton.setObjectName(u'ShadowColorPushButton') - self.ShadowLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) + self.ShadowLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.ShadowColorPushButton) self.ShadowEnabledLabel = QtGui.QLabel(self.ShadowWidget) self.ShadowEnabledLabel.setObjectName(u'ShadowEnabledLabel') self.ShadowLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ShadowEnabledLabel) @@ -640,9 +661,14 @@ class Ui_AmendThemeDialog(object): self.ThemeTabWidget.setTabText( self.ThemeTabWidget.indexOf(self.FontFooterTab), self.trUtf8('Font Footer')) - self.ShadowGroupBox.setTitle(self.trUtf8('Shadow && Outline')) + self.OutlineGroupBox.setTitle(self.trUtf8('Outline')) + self.OutlineSpinBoxLabel.setText(self.trUtf8('Outline Size:')) + self.OutlineSpinBox.setSuffix(self.trUtf8('px')) self.OutlineColorLabel.setText(self.trUtf8('Outline Color:')) self.OutlineEnabledLabel.setText(self.trUtf8('Show Outline:')) + self.ShadowGroupBox.setTitle(self.trUtf8('Shadow')) + self.ShadowSpinBoxLabel.setText(self.trUtf8('Shadow Size:')) + self.ShadowSpinBox.setSuffix(self.trUtf8('px')) self.ShadowColorLabel.setText(self.trUtf8('Shadow Color:')) self.ShadowEnabledLabel.setText(self.trUtf8('Show Shadow:')) self.AlignmentGroupBox.setTitle(self.trUtf8('Alignment')) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index da56ce3c4..a00a25d72 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -121,8 +121,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.onFontFooterHeightSpinBoxChanged) QtCore.QObject.connect(self.OutlineCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) + QtCore.QObject.connect(self.ShadowSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onShadowSpinBoxChanged) QtCore.QObject.connect(self.ShadowCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) + QtCore.QObject.connect(self.OutlineSpinBox, + QtCore.SIGNAL(u'editingFinished()'), + self.onOutlineSpinBoxChanged) QtCore.QObject.connect(self.SlideTransitionCheckedBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckedBoxChanged) @@ -179,7 +185,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign), unicode(self.theme.display_wrapStyle), - unicode(self.theme.display_slideTransition)) + unicode(self.theme.display_slideTransition), + unicode(self.theme.display_shadow_size), + unicode(self.theme.display_outline_size)) theme = new_theme.extract_xml() pretty_theme = new_theme.extract_formatted_xml() if self.thememanager.saveTheme(theme_name, theme, pretty_theme, @@ -434,6 +442,16 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.stateChanging(self.theme) self.previewTheme() + def onOutlineSpinBoxChanged(self): + if self.theme.display_outline_size != self.OutlineSpinBox.value(): + self.theme.display_outline_size = self.OutlineSpinBox.value() + self.previewTheme() + + def onShadowSpinBoxChanged(self): + if self.theme.display_shadow_size != self.ShadowSpinBox.value(): + self.theme.display_shadow_size = self.ShadowSpinBox.value() + self.previewTheme() + def onOutlineColorPushButtonClicked(self): self.theme.display_outline_color = QtGui.QColorDialog.getColor( QtGui.QColor(self.theme.display_outline_color), self).name() @@ -565,6 +583,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.OutlineCheckBox.setChecked(False) self.OutlineColorPushButton.setEnabled(False) + self.OutlineSpinBox.setValue(int(self.theme.display_outline_size)) if self.theme.display_shadow: self.ShadowCheckBox.setChecked(True) @@ -572,6 +591,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): else: self.ShadowCheckBox.setChecked(False) self.ShadowColorPushButton.setEnabled(False) + self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size)) if self.theme.display_slideTransition: self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Checked) diff --git a/version.txt b/version.txt index 061bd0e8f..e8f1665da 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9.0-689 +1.9.0-690