Fix up theme bugs

This commit is contained in:
Tim Bentley 2010-03-26 20:48:46 +00:00
parent 92e90b91e5
commit 35255c250e
2 changed files with 6 additions and 14 deletions

View File

@ -466,8 +466,7 @@ class Renderer(object):
tlcorner=(x + display_shadow_size, y + display_shadow_size), tlcorner=(x + display_shadow_size, y + display_shadow_size),
draw=True, color = self._theme.display_shadow_color) draw=True, color = self._theme.display_shadow_color)
self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=True, self._get_extent_and_render(line, footer, tlcorner=(x, y), draw=True,
outline_size=display_outline_size, outline_size=display_outline_size)
outline_color=self._theme.display_outline_color)
y += h y += h
if linenum == 0: if linenum == 0:
self._first_line_right_extent = rightextent self._first_line_right_extent = rightextent
@ -505,7 +504,7 @@ class Renderer(object):
self.mainFont.setPixelSize(self._theme.font_main_proportion) self.mainFont.setPixelSize(self._theme.font_main_proportion)
def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False, def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
color=None, outline_size=0, outline_color=None): color=None, outline_size=0):
""" """
Find bounding box of text - as render_single_line. If draw is set, Find bounding box of text - as render_single_line. If draw is set,
actually draw the text to the current DC as well return width and actually draw the text to the current DC as well return width and
@ -544,7 +543,7 @@ class Renderer(object):
else: else:
pen = QtGui.QColor(color) pen = QtGui.QColor(color)
x, y = tlcorner x, y = tlcorner
if self._theme.display_outline: if self._theme.display_outline and outline_size != 0:
path = QtGui.QPainterPath() path = QtGui.QPainterPath()
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line) path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
self.painter.setBrush(self.painter.pen().brush()) self.painter.setBrush(self.painter.pen().brush())
@ -555,7 +554,7 @@ class Renderer(object):
self.painter.drawText(x, y + metrics.ascent(), line) self.painter.drawText(x, y + metrics.ascent(), line)
if self._theme.display_slideTransition: if self._theme.display_slideTransition:
# Print 2nd image with 70% weight # Print 2nd image with 70% weight
if self._theme.display_outline: if self._theme.display_outline and outline_size != 0:
path = QtGui.QPainterPath() path = QtGui.QPainterPath()
path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line) path.addText(QtCore.QPointF(x, y + metrics.ascent()), font, line)
self.painter2.setBrush(self.painter2.pen().brush()) self.painter2.setBrush(self.painter2.pen().brush())

View File

@ -393,6 +393,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_type = u'solid' self.theme.background_type = u'solid'
if self.theme.background_color is None : if self.theme.background_color is None :
self.theme.background_color = u'#000000' self.theme.background_color = u'#000000'
self.ImageLineEdit.setText(u'')
elif background == 1: # Gradient elif background == 1: # Gradient
self.theme.background_type = u'gradient' self.theme.background_type = u'gradient'
if gradient == 0: # Horizontal if gradient == 0: # Horizontal
@ -405,6 +406,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_startColor = u'#000000' self.theme.background_startColor = u'#000000'
if self.theme.background_endColor is None : if self.theme.background_endColor is None :
self.theme.background_endColor = u'#ff0000' self.theme.background_endColor = u'#ff0000'
self.ImageLineEdit.setText(u'')
else: else:
self.theme.background_type = u'image' self.theme.background_type = u'image'
self.stateChanging(self.theme) self.stateChanging(self.theme)
@ -422,7 +424,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.Color1PushButton.setStyleSheet( self.Color1PushButton.setStyleSheet(
u'background-color: %s' % \ u'background-color: %s' % \
unicode(self.theme.background_startColor)) unicode(self.theme.background_startColor))
self.previewTheme() self.previewTheme()
def onColor2PushButtonClicked(self): def onColor2PushButtonClicked(self):
@ -561,22 +562,18 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
u'background-color: %s' % unicode(theme.font_main_color)) u'background-color: %s' % unicode(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet( self.FontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_footer_color)) u'background-color: %s' % unicode(theme.font_footer_color))
if not self.theme.font_main_override: if not self.theme.font_main_override:
self.FontMainDefaultCheckBox.setChecked(True) self.FontMainDefaultCheckBox.setChecked(True)
else: else:
self.FontMainDefaultCheckBox.setChecked(False) self.FontMainDefaultCheckBox.setChecked(False)
if not self.theme.font_footer_override: if not self.theme.font_footer_override:
self.FontFooterDefaultCheckBox.setChecked(True) self.FontFooterDefaultCheckBox.setChecked(True)
else: else:
self.FontFooterDefaultCheckBox.setChecked(False) self.FontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet( self.OutlineColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_outline_color)) u'background-color: %s' % unicode(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet( self.ShadowColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_shadow_color)) u'background-color: %s' % unicode(theme.display_shadow_color))
if self.theme.display_outline: if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True) self.OutlineCheckBox.setChecked(True)
self.OutlineColorPushButton.setEnabled(True) self.OutlineColorPushButton.setEnabled(True)
@ -584,7 +581,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.OutlineCheckBox.setChecked(False) self.OutlineCheckBox.setChecked(False)
self.OutlineColorPushButton.setEnabled(False) self.OutlineColorPushButton.setEnabled(False)
self.OutlineSpinBox.setValue(int(self.theme.display_outline_size)) self.OutlineSpinBox.setValue(int(self.theme.display_outline_size))
if self.theme.display_shadow: if self.theme.display_shadow:
self.ShadowCheckBox.setChecked(True) self.ShadowCheckBox.setChecked(True)
self.ShadowColorPushButton.setEnabled(True) self.ShadowColorPushButton.setEnabled(True)
@ -592,12 +588,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.ShadowCheckBox.setChecked(False) self.ShadowCheckBox.setChecked(False)
self.ShadowColorPushButton.setEnabled(False) self.ShadowColorPushButton.setEnabled(False)
self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size)) self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size))
if self.theme.display_slideTransition: if self.theme.display_slideTransition:
self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Checked) self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Checked)
else: else:
self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Unchecked) self.SlideTransitionCheckedBox.setCheckState(QtCore.Qt.Unchecked)
self.HorizontalComboBox.setCurrentIndex( self.HorizontalComboBox.setCurrentIndex(
self.theme.display_horizontalAlign) self.theme.display_horizontalAlign)
self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign) self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
@ -657,7 +651,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.ImageFilenameWidget.setVisible(True) self.ImageFilenameWidget.setVisible(True)
self.GradientLabel.setVisible(False) self.GradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False) self.GradientComboBox.setVisible(False)
if not theme.font_main_override: if not theme.font_main_override:
self.FontMainXSpinBox.setEnabled(False) self.FontMainXSpinBox.setEnabled(False)
self.FontMainYSpinBox.setEnabled(False) self.FontMainYSpinBox.setEnabled(False)