forked from openlp/openlp
Add Outline and Shadow size options and make editable
This commit is contained in:
parent
43a99451a3
commit
a7833f900f
@ -43,8 +43,8 @@ class Renderer(object):
|
||||
self._rect = None
|
||||
self._debug = 0
|
||||
self._right_margin = 64 # the amount of right indent
|
||||
self._display_shadow_size_footer = 3
|
||||
_display_outline_size = 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,10 +426,11 @@ class Renderer(object):
|
||||
if footer:
|
||||
align = 0
|
||||
display_shadow_size = self._display_shadow_size_footer
|
||||
display_outline_size = self._display_outline_size_footer
|
||||
else:
|
||||
align = self._theme.display_horizontalAlign
|
||||
display_shadow_size = int(self._theme.display_shadow_size)
|
||||
_display_outline_size = int(self._theme.display_outline_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
|
||||
@ -440,9 +441,9 @@ class Renderer(object):
|
||||
h += display_shadow_size
|
||||
if self._theme.display_outline:
|
||||
# pixels either side
|
||||
w += 2 * _display_outline_size
|
||||
w += 2 * display_outline_size
|
||||
# pixels top/bottom
|
||||
h += 2 * _display_outline_size
|
||||
h += 2 * display_outline_size
|
||||
if align == 0: # left align
|
||||
rightextent = x + w
|
||||
# shift right from last line's rh edge
|
||||
@ -468,32 +469,32 @@ class Renderer(object):
|
||||
draw=True, color = self._theme.display_shadow_color)
|
||||
if self._theme.display_outline:
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x + _display_outline_size, 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 + _display_outline_size), draw=True,
|
||||
(x, y + display_outline_size), draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x, y - _display_outline_size), draw=True,
|
||||
(x, y - display_outline_size), draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x - _display_outline_size, y), draw=True,
|
||||
(x - display_outline_size, y), draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
if _display_outline_size > 1:
|
||||
if display_outline_size > 1:
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x + _display_outline_size, y + _display_outline_size),
|
||||
(x + display_outline_size, y + display_outline_size),
|
||||
draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x - _display_outline_size, y + _display_outline_size),
|
||||
(x - display_outline_size, y + display_outline_size),
|
||||
draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x + _display_outline_size, y - _display_outline_size),
|
||||
(x + display_outline_size, y - display_outline_size),
|
||||
draw=True,
|
||||
color = self._theme.display_outline_color)
|
||||
self._get_extent_and_render(line, footer,
|
||||
(x - _display_outline_size, y - _display_outline_size),
|
||||
(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),
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user