AmendTheme naming and missed trailing new line

This commit is contained in:
Jon Tibble 2010-07-27 11:20:20 +01:00
parent 37b2304eeb
commit 41eaa2cd29
3 changed files with 878 additions and 878 deletions

View File

@ -389,4 +389,4 @@ class ServiceItem(object):
"""
Clear's the service item's cache.
"""
self.cache = {}
self.cache = {}

File diff suppressed because it is too large Load Diff

View File

@ -52,102 +52,102 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.setupUi(self)
# define signals
# Buttons
QtCore.QObject.connect(self.Color1PushButton,
QtCore.QObject.connect(self.color1PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
QtCore.QObject.connect(self.Color2PushButton,
QtCore.QObject.connect(self.color2PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor2PushButtonClicked)
QtCore.QObject.connect(self.FontMainColorPushButton,
QtCore.QObject.connect(self.fontMainColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onFontMainColorPushButtonClicked)
QtCore.QObject.connect(self.FontFooterColorPushButton,
QtCore.QObject.connect(self.fontFooterColorPushButton,
QtCore.SIGNAL(u'pressed()'),
self.onFontFooterColorPushButtonClicked)
QtCore.QObject.connect(self.OutlineColorPushButton,
QtCore.QObject.connect(self.outlineColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onOutlineColorPushButtonClicked)
QtCore.QObject.connect(self.ShadowColorPushButton,
QtCore.QObject.connect(self.shadowColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked)
QtCore.QObject.connect(self.ImageToolButton,
QtCore.QObject.connect(self.imageToolButton,
QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked)
# Combo boxes
QtCore.QObject.connect(self.BackgroundComboBox,
QtCore.QObject.connect(self.backgroundComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
QtCore.QObject.connect(self.BackgroundTypeComboBox,
QtCore.QObject.connect(self.backgroundTypeComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.onBackgroundTypeComboBoxSelected)
QtCore.QObject.connect(self.GradientComboBox,
QtCore.QObject.connect(self.gradientComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onGradientComboBoxSelected)
QtCore.QObject.connect(self.FontMainComboBox,
QtCore.QObject.connect(self.fontMainComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontMainComboBoxSelected)
QtCore.QObject.connect(self.FontMainWeightComboBox,
QtCore.QObject.connect(self.fontMainWeightComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.onFontMainWeightComboBoxSelected)
QtCore.QObject.connect(self.FontFooterComboBox,
QtCore.QObject.connect(self.fontFooterComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontFooterComboBoxSelected)
QtCore.QObject.connect(self.FontFooterWeightComboBox,
QtCore.QObject.connect(self.fontFooterWeightComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.onFontFooterWeightComboBoxSelected)
QtCore.QObject.connect(self.HorizontalComboBox,
QtCore.QObject.connect(self.horizontalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected)
QtCore.QObject.connect(self.VerticalComboBox,
QtCore.QObject.connect(self.verticalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
# Spin boxes
QtCore.QObject.connect(self.FontMainSizeSpinBox,
QtCore.QObject.connect(self.fontMainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterSizeSpinBox,
QtCore.QObject.connect(self.fontFooterSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontMainXSpinBox,
QtCore.QObject.connect(self.fontMainXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged)
QtCore.QObject.connect(self.FontMainYSpinBox,
QtCore.QObject.connect(self.fontMainYSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged)
QtCore.QObject.connect(self.FontMainWidthSpinBox,
QtCore.QObject.connect(self.fontMainWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontMainHeightSpinBox,
QtCore.QObject.connect(self.fontMainHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainHeightSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineAdjustmentSpinBox,
QtCore.QObject.connect(self.fontMainLineAdjustmentSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineAdjustmentSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
QtCore.QObject.connect(self.fontMainLineSpacingSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterXSpinBox,
QtCore.QObject.connect(self.fontFooterXSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterXSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterYSpinBox,
QtCore.QObject.connect(self.fontFooterYSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterYSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterWidthSpinBox,
QtCore.QObject.connect(self.fontFooterWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterHeightSpinBox,
QtCore.QObject.connect(self.fontFooterHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterHeightSpinBoxChanged)
QtCore.QObject.connect(self.ShadowSpinBox,
QtCore.QObject.connect(self.shadowSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onShadowSpinBoxChanged)
QtCore.QObject.connect(self.OutlineSpinBox,
QtCore.QObject.connect(self.outlineSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onOutlineSpinBoxChanged)
# CheckBoxes
QtCore.QObject.connect(self.FontMainDefaultCheckBox,
QtCore.QObject.connect(self.fontMainDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontMainDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
QtCore.QObject.connect(self.fontFooterDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontFooterDefaultCheckBoxChanged)
QtCore.QObject.connect(self.OutlineCheckBox,
QtCore.QObject.connect(self.outlineCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
QtCore.QObject.connect(self.ShadowCheckBox,
QtCore.QObject.connect(self.shadowCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
QtCore.QObject.connect(self.SlideTransitionCheckBox,
QtCore.QObject.connect(self.slideTransitionCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onSlideTransitionCheckBoxChanged)
def accept(self):
new_theme = ThemeXML()
theme_name = unicode(self.ThemeNameEdit.text())
theme_name = unicode(self.themeNameEdit.text())
new_theme.new_document(theme_name)
save_from = None
save_to = None
@ -225,7 +225,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
translate('OpenLP.AmendThemeForm', 'Select Image'), u'',
images_filter)
if filename:
self.ImageLineEdit.setText(filename)
self.imageLineEdit.setText(filename)
self.theme.background_filename = filename
self.previewTheme()
@ -233,7 +233,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
#Main Font Tab
#
def onFontMainComboBoxSelected(self):
self.theme.font_main_name = self.FontMainComboBox.currentFont().family()
self.theme.font_main_name = self.fontMainComboBox.currentFont().family()
self.previewTheme()
def onFontMainWeightComboBoxSelected(self, value):
@ -256,13 +256,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.font_main_color), self)
if new_color.isValid():
self.theme.font_main_color = new_color.name()
self.FontMainColorPushButton.setStyleSheet(
self.fontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_main_color))
self.previewTheme()
def onFontMainSizeSpinBoxChanged(self):
if self.theme.font_main_proportion != self.FontMainSizeSpinBox.value():
self.theme.font_main_proportion = self.FontMainSizeSpinBox.value()
if self.theme.font_main_proportion != self.fontMainSizeSpinBox.value():
self.theme.font_main_proportion = self.fontMainSizeSpinBox.value()
self.previewTheme()
def onFontMainDefaultCheckBoxChanged(self, value):
@ -277,49 +277,49 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.font_main_y = u'10'
self.theme.font_main_width = u'1024'
self.theme.font_main_height = u'730'
self.FontMainXSpinBox.setValue(self.theme.font_main_x)
self.FontMainYSpinBox.setValue(self.theme.font_main_y)
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.FontMainHeightSpinBox.setValue(self.theme.font_main_height)
self.FontMainLineAdjustmentSpinBox.setValue(
self.fontMainXSpinBox.setValue(self.theme.font_main_x)
self.fontMainYSpinBox.setValue(self.theme.font_main_y)
self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.fontMainHeightSpinBox.setValue(self.theme.font_main_height)
self.fontMainLineAdjustmentSpinBox.setValue(
self.theme.font_main_line_adjustment)
self.FontMainLineSpacingSpinBox.setValue(
self.fontMainLineSpacingSpinBox.setValue(
self.theme.font_main_indentation)
self.stateChanging(self.theme)
self.previewTheme()
def onFontMainXSpinBoxChanged(self):
if self.theme.font_main_x != self.FontMainXSpinBox.value():
self.theme.font_main_x = self.FontMainXSpinBox.value()
if self.theme.font_main_x != self.fontMainXSpinBox.value():
self.theme.font_main_x = self.fontMainXSpinBox.value()
self.previewTheme()
def onFontMainYSpinBoxChanged(self):
if self.theme.font_main_y != self.FontMainYSpinBox.value():
self.theme.font_main_y = self.FontMainYSpinBox.value()
if self.theme.font_main_y != self.fontMainYSpinBox.value():
self.theme.font_main_y = self.fontMainYSpinBox.value()
self.previewTheme()
def onFontMainWidthSpinBoxChanged(self):
if self.theme.font_main_width != self.FontMainWidthSpinBox.value():
self.theme.font_main_width = self.FontMainWidthSpinBox.value()
if self.theme.font_main_width != self.fontMainWidthSpinBox.value():
self.theme.font_main_width = self.fontMainWidthSpinBox.value()
self.previewTheme()
def onFontMainLineAdjustmentSpinBoxChanged(self):
if self.theme.font_main_line_adjustment != \
self.FontMainLineAdjustmentSpinBox.value():
self.fontMainLineAdjustmentSpinBox.value():
self.theme.font_main_line_adjustment = \
self.FontMainLineAdjustmentSpinBox.value()
self.fontMainLineAdjustmentSpinBox.value()
self.previewTheme()
def onFontMainLineSpacingSpinBoxChanged(self):
if self.theme.font_main_indentation != \
self.FontMainLineSpacingSpinBox.value():
self.fontMainLineSpacingSpinBox.value():
self.theme.font_main_indentation = \
self.FontMainLineSpacingSpinBox.value()
self.fontMainLineSpacingSpinBox.value()
self.previewTheme()
def onFontMainHeightSpinBoxChanged(self):
if self.theme.font_main_height != self.FontMainHeightSpinBox.value():
self.theme.font_main_height = self.FontMainHeightSpinBox.value()
if self.theme.font_main_height != self.fontMainHeightSpinBox.value():
self.theme.font_main_height = self.fontMainHeightSpinBox.value()
self.previewTheme()
#
@ -327,7 +327,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
#
def onFontFooterComboBoxSelected(self):
self.theme.font_footer_name = \
self.FontFooterComboBox.currentFont().family()
self.fontFooterComboBox.currentFont().family()
self.previewTheme()
def onFontFooterWeightComboBoxSelected(self, value):
@ -350,15 +350,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.font_footer_color), self)
if new_color.isValid():
self.theme.font_footer_color = new_color.name()
self.FontFooterColorPushButton.setStyleSheet(
self.fontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_footer_color))
self.previewTheme()
def onFontFooterSizeSpinBoxChanged(self):
if self.theme.font_footer_proportion != \
self.FontFooterSizeSpinBox.value():
self.fontFooterSizeSpinBox.value():
self.theme.font_footer_proportion = \
self.FontFooterSizeSpinBox.value()
self.fontFooterSizeSpinBox.value()
self.previewTheme()
def onFontFooterDefaultCheckBoxChanged(self, value):
@ -373,41 +373,41 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.font_footer_y = u'730'
self.theme.font_footer_width = u'1024'
self.theme.font_footer_height = u'38'
self.FontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.FontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.FontFooterHeightSpinBox.setValue(
self.fontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.fontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.fontFooterHeightSpinBox.setValue(
self.theme.font_footer_height)
self.stateChanging(self.theme)
self.previewTheme()
def onFontFooterXSpinBoxChanged(self):
if self.theme.font_footer_x != self.FontFooterXSpinBox.value():
self.theme.font_footer_x = self.FontFooterXSpinBox.value()
if self.theme.font_footer_x != self.fontFooterXSpinBox.value():
self.theme.font_footer_x = self.fontFooterXSpinBox.value()
self.previewTheme()
def onFontFooterYSpinBoxChanged(self):
if self.theme.font_footer_y != self.FontFooterYSpinBox.value():
self.theme.font_footer_y = self.FontFooterYSpinBox.value()
if self.theme.font_footer_y != self.fontFooterYSpinBox.value():
self.theme.font_footer_y = self.fontFooterYSpinBox.value()
self.previewTheme()
def onFontFooterWidthSpinBoxChanged(self):
if self.theme.font_footer_width != self.FontFooterWidthSpinBox.value():
self.theme.font_footer_width = self.FontFooterWidthSpinBox.value()
if self.theme.font_footer_width != self.fontFooterWidthSpinBox.value():
self.theme.font_footer_width = self.fontFooterWidthSpinBox.value()
self.previewTheme()
def onFontFooterHeightSpinBoxChanged(self):
if self.theme.font_footer_height != \
self.FontFooterHeightSpinBox.value():
self.fontFooterHeightSpinBox.value():
self.theme.font_footer_height = \
self.FontFooterHeightSpinBox.value()
self.fontFooterHeightSpinBox.value()
self.previewTheme()
#
#Background Tab
#
def onGradientComboBoxSelected(self, currentIndex):
self.setBackground(self.BackgroundTypeComboBox.currentIndex(),
self.setBackground(self.backgroundTypeComboBox.currentIndex(),
currentIndex)
def onBackgroundComboBoxSelected(self, currentIndex):
@ -419,14 +419,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onBackgroundTypeComboBoxSelected(self, currentIndex):
self.setBackground(currentIndex, self.GradientComboBox.currentIndex())
self.setBackground(currentIndex, self.gradientComboBox.currentIndex())
def setBackground(self, background, gradient):
if background == 0: # Solid
self.theme.background_type = u'solid'
if self.theme.background_color is None:
self.theme.background_color = u'#000000'
self.ImageLineEdit.setText(u'')
self.imageLineEdit.setText(u'')
elif background == 1: # Gradient
self.theme.background_type = u'gradient'
if gradient == 0: # Horizontal
@ -439,7 +439,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.theme.background_startColor = u'#000000'
if self.theme.background_endColor is None:
self.theme.background_endColor = u'#ff0000'
self.ImageLineEdit.setText(u'')
self.imageLineEdit.setText(u'')
else:
self.theme.background_type = u'image'
self.stateChanging(self.theme)
@ -451,14 +451,14 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.background_color), self)
if new_color.isValid():
self.theme.background_color = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' %
self.color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_color))
else:
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_startColor), self)
if new_color.isValid():
self.theme.background_startColor = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' %
self.color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_startColor))
self.previewTheme()
@ -467,7 +467,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.background_endColor), self)
if new_color.isValid():
self.theme.background_endColor = new_color.name()
self.Color2PushButton.setStyleSheet(u'background-color: %s' %
self.color2PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_endColor))
self.previewTheme()
@ -483,13 +483,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onOutlineSpinBoxChanged(self):
if self.theme.display_outline_size != self.OutlineSpinBox.value():
self.theme.display_outline_size = self.OutlineSpinBox.value()
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()
if self.theme.display_shadow_size != self.shadowSpinBox.value():
self.theme.display_shadow_size = self.shadowSpinBox.value()
self.previewTheme()
def onOutlineColorPushButtonClicked(self):
@ -497,7 +497,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.display_outline_color), self)
if new_color.isValid():
self.theme.display_outline_color = new_color.name()
self.OutlineColorPushButton.setStyleSheet(u'background-color: %s' %
self.outlineColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_outline_color))
self.previewTheme()
@ -522,7 +522,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtGui.QColor(self.theme.display_shadow_color), self)
if new_color.isValid():
self.theme.display_shadow_color = new_color.name()
self.ShadowColorPushButton.setStyleSheet(u'background-color: %s' %
self.shadowColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_shadow_color))
self.previewTheme()
@ -541,194 +541,194 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
#
def paintUi(self, theme):
self.stateChanging(theme)
self.ThemeNameEdit.setText(self.theme.theme_name)
self.themeNameEdit.setText(self.theme.theme_name)
# Background Tab
if self.theme.background_mode == u'opaque':
self.BackgroundComboBox.setCurrentIndex(0)
self.backgroundComboBox.setCurrentIndex(0)
else:
self.BackgroundComboBox.setCurrentIndex(1)
self.ImageLineEdit.setText(u'')
self.backgroundComboBox.setCurrentIndex(1)
self.imageLineEdit.setText(u'')
if theme.background_type == u'solid':
self.BackgroundTypeComboBox.setCurrentIndex(0)
self.backgroundTypeComboBox.setCurrentIndex(0)
elif theme.background_type == u'gradient':
self.BackgroundTypeComboBox.setCurrentIndex(1)
self.backgroundTypeComboBox.setCurrentIndex(1)
else:
self.BackgroundTypeComboBox.setCurrentIndex(2)
self.ImageLineEdit.setText(self.theme.background_filename)
self.backgroundTypeComboBox.setCurrentIndex(2)
self.imageLineEdit.setText(self.theme.background_filename)
if self.theme.background_direction == u'horizontal':
self.GradientComboBox.setCurrentIndex(0)
self.gradientComboBox.setCurrentIndex(0)
elif self.theme.background_direction == u'vertical':
self.GradientComboBox.setCurrentIndex(1)
self.gradientComboBox.setCurrentIndex(1)
else:
self.GradientComboBox.setCurrentIndex(2)
self.gradientComboBox.setCurrentIndex(2)
# Font Main Tab
self.FontMainComboBox.setCurrentFont(
self.fontMainComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_main_name))
self.FontMainSizeSpinBox.setValue(self.theme.font_main_proportion)
self.fontMainSizeSpinBox.setValue(self.theme.font_main_proportion)
if not self.theme.font_main_italics and \
self.theme.font_main_weight == u'Normal':
self.FontMainWeightComboBox.setCurrentIndex(0)
self.fontMainWeightComboBox.setCurrentIndex(0)
elif not self.theme.font_main_italics and \
self.theme.font_main_weight == u'Bold':
self.FontMainWeightComboBox.setCurrentIndex(1)
self.fontMainWeightComboBox.setCurrentIndex(1)
elif self.theme.font_main_italics and \
self.theme.font_main_weight == u'Normal':
self.FontMainWeightComboBox.setCurrentIndex(2)
self.fontMainWeightComboBox.setCurrentIndex(2)
else:
self.FontMainWeightComboBox.setCurrentIndex(3)
self.FontMainLineSpacingSpinBox.setValue(
self.fontMainWeightComboBox.setCurrentIndex(3)
self.fontMainLineSpacingSpinBox.setValue(
self.theme.font_main_indentation)
self.FontMainXSpinBox.setValue(self.theme.font_main_x)
self.FontMainYSpinBox.setValue(self.theme.font_main_y)
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.FontMainHeightSpinBox.setValue(self.theme.font_main_height)
self.fontMainXSpinBox.setValue(self.theme.font_main_x)
self.fontMainYSpinBox.setValue(self.theme.font_main_y)
self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.fontMainHeightSpinBox.setValue(self.theme.font_main_height)
# Font Footer Tab
self.FontFooterComboBox.setCurrentFont(
self.fontFooterComboBox.setCurrentFont(
QtGui.QFont(self.theme.font_footer_name))
self.FontFooterSizeSpinBox.setValue(
self.fontFooterSizeSpinBox.setValue(
self.theme.font_footer_proportion)
if not self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Normal':
self.FontFooterWeightComboBox.setCurrentIndex(0)
self.fontFooterWeightComboBox.setCurrentIndex(0)
elif not self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Bold':
self.FontFooterWeightComboBox.setCurrentIndex(1)
self.fontFooterWeightComboBox.setCurrentIndex(1)
elif self.theme.font_footer_italics and \
self.theme.font_footer_weight == u'Normal':
self.FontFooterWeightComboBox.setCurrentIndex(2)
self.fontFooterWeightComboBox.setCurrentIndex(2)
else:
self.FontFooterWeightComboBox.setCurrentIndex(3)
self.FontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.FontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.FontFooterHeightSpinBox.setValue(self.theme.font_footer_height)
self.FontMainColorPushButton.setStyleSheet(
self.fontFooterWeightComboBox.setCurrentIndex(3)
self.fontFooterXSpinBox.setValue(self.theme.font_footer_x)
self.fontFooterYSpinBox.setValue(self.theme.font_footer_y)
self.fontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
self.fontFooterHeightSpinBox.setValue(self.theme.font_footer_height)
self.fontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet(
self.fontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.font_footer_color))
if not self.theme.font_main_override:
self.FontMainDefaultCheckBox.setChecked(True)
self.fontMainDefaultCheckBox.setChecked(True)
else:
self.FontMainDefaultCheckBox.setChecked(False)
self.fontMainDefaultCheckBox.setChecked(False)
if not self.theme.font_footer_override:
self.FontFooterDefaultCheckBox.setChecked(True)
self.fontFooterDefaultCheckBox.setChecked(True)
else:
self.FontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet(
self.fontFooterDefaultCheckBox.setChecked(False)
self.outlineColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet(
self.shadowColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.display_shadow_color))
if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True)
self.OutlineColorPushButton.setEnabled(True)
self.outlineCheckBox.setChecked(True)
self.outlineColorPushButton.setEnabled(True)
else:
self.OutlineCheckBox.setChecked(False)
self.OutlineColorPushButton.setEnabled(False)
self.OutlineSpinBox.setValue(int(self.theme.display_outline_size))
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)
self.ShadowColorPushButton.setEnabled(True)
self.shadowCheckBox.setChecked(True)
self.shadowColorPushButton.setEnabled(True)
else:
self.ShadowCheckBox.setChecked(False)
self.ShadowColorPushButton.setEnabled(False)
self.ShadowSpinBox.setValue(int(self.theme.display_shadow_size))
self.shadowCheckBox.setChecked(False)
self.shadowColorPushButton.setEnabled(False)
self.shadowSpinBox.setValue(int(self.theme.display_shadow_size))
if self.theme.display_slideTransition:
self.SlideTransitionCheckBox.setCheckState(QtCore.Qt.Checked)
self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Checked)
else:
self.SlideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.HorizontalComboBox.setCurrentIndex(
self.slideTransitionCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.horizontalComboBox.setCurrentIndex(
self.theme.display_horizontalAlign)
self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
self.verticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
def stateChanging(self, theme):
if theme.background_mode == u'transparent':
self.Color1Label.setVisible(False)
self.Color1PushButton.setVisible(False)
self.Color2Label.setVisible(False)
self.Color2PushButton.setVisible(False)
self.ImageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False)
self.BackgroundTypeComboBox.setVisible(False)
self.BackgroundTypeLabel.setVisible(False)
self.color1Label.setVisible(False)
self.color1PushButton.setVisible(False)
self.color2Label.setVisible(False)
self.color2PushButton.setVisible(False)
self.imageLabel.setVisible(False)
self.imageLineEdit.setVisible(False)
self.imageFilenameWidget.setVisible(False)
self.gradientLabel.setVisible(False)
self.gradientComboBox.setVisible(False)
self.backgroundTypeComboBox.setVisible(False)
self.backgroundTypeLabel.setVisible(False)
else:
self.BackgroundTypeComboBox.setVisible(True)
self.BackgroundTypeLabel.setVisible(True)
self.backgroundTypeComboBox.setVisible(True)
self.backgroundTypeLabel.setVisible(True)
if theme.background_type == u'solid':
self.Color1PushButton.setStyleSheet(
self.color1PushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.background_color))
self.Color1Label.setText(
self.color1Label.setText(
translate('OpenLP.AmendThemeForm', 'Color:'))
self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True)
self.Color2Label.setVisible(False)
self.Color2PushButton.setVisible(False)
self.ImageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False)
self.color1Label.setVisible(True)
self.color1PushButton.setVisible(True)
self.color2Label.setVisible(False)
self.color2PushButton.setVisible(False)
self.imageLabel.setVisible(False)
self.imageLineEdit.setVisible(False)
self.imageFilenameWidget.setVisible(False)
self.gradientLabel.setVisible(False)
self.gradientComboBox.setVisible(False)
elif theme.background_type == u'gradient':
self.Color1PushButton.setStyleSheet(u'background-color: %s' \
self.color1PushButton.setStyleSheet(u'background-color: %s' \
% unicode(theme.background_startColor))
self.Color2PushButton.setStyleSheet(u'background-color: %s' \
self.color2PushButton.setStyleSheet(u'background-color: %s' \
% unicode(theme.background_endColor))
self.Color1Label.setText(
self.color1Label.setText(
translate('OpenLP.AmendThemeForm', 'First color:'))
self.Color2Label.setText(
self.color2Label.setText(
translate('OpenLP.AmendThemeForm', 'Second color:'))
self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True)
self.Color2Label.setVisible(True)
self.Color2PushButton.setVisible(True)
self.ImageLabel.setVisible(False)
self.ImageLineEdit.setVisible(False)
self.ImageFilenameWidget.setVisible(False)
self.GradientLabel.setVisible(True)
self.GradientComboBox.setVisible(True)
self.color1Label.setVisible(True)
self.color1PushButton.setVisible(True)
self.color2Label.setVisible(True)
self.color2PushButton.setVisible(True)
self.imageLabel.setVisible(False)
self.imageLineEdit.setVisible(False)
self.imageFilenameWidget.setVisible(False)
self.gradientLabel.setVisible(True)
self.gradientComboBox.setVisible(True)
else: # must be image
self.Color1Label.setVisible(False)
self.Color1PushButton.setVisible(False)
self.Color2Label.setVisible(False)
self.Color2PushButton.setVisible(False)
self.ImageLabel.setVisible(True)
self.ImageLineEdit.setVisible(True)
self.ImageFilenameWidget.setVisible(True)
self.GradientLabel.setVisible(False)
self.GradientComboBox.setVisible(False)
self.color1Label.setVisible(False)
self.color1PushButton.setVisible(False)
self.color2Label.setVisible(False)
self.color2PushButton.setVisible(False)
self.imageLabel.setVisible(True)
self.imageLineEdit.setVisible(True)
self.imageFilenameWidget.setVisible(True)
self.gradientLabel.setVisible(False)
self.gradientComboBox.setVisible(False)
if not theme.font_main_override:
self.FontMainXSpinBox.setEnabled(False)
self.FontMainYSpinBox.setEnabled(False)
self.FontMainWidthSpinBox.setEnabled(False)
self.FontMainHeightSpinBox.setEnabled(False)
self.fontMainXSpinBox.setEnabled(False)
self.fontMainYSpinBox.setEnabled(False)
self.fontMainWidthSpinBox.setEnabled(False)
self.fontMainHeightSpinBox.setEnabled(False)
else:
self.FontMainXSpinBox.setEnabled(True)
self.FontMainYSpinBox.setEnabled(True)
self.FontMainWidthSpinBox.setEnabled(True)
self.FontMainHeightSpinBox.setEnabled(True)
self.fontMainXSpinBox.setEnabled(True)
self.fontMainYSpinBox.setEnabled(True)
self.fontMainWidthSpinBox.setEnabled(True)
self.fontMainHeightSpinBox.setEnabled(True)
if not theme.font_footer_override:
self.FontFooterXSpinBox.setEnabled(False)
self.FontFooterYSpinBox.setEnabled(False)
self.FontFooterWidthSpinBox.setEnabled(False)
self.FontFooterHeightSpinBox.setEnabled(False)
self.fontFooterXSpinBox.setEnabled(False)
self.fontFooterYSpinBox.setEnabled(False)
self.fontFooterWidthSpinBox.setEnabled(False)
self.fontFooterHeightSpinBox.setEnabled(False)
else:
self.FontFooterXSpinBox.setEnabled(True)
self.FontFooterYSpinBox.setEnabled(True)
self.FontFooterWidthSpinBox.setEnabled(True)
self.FontFooterHeightSpinBox.setEnabled(True)
self.fontFooterXSpinBox.setEnabled(True)
self.fontFooterYSpinBox.setEnabled(True)
self.fontFooterWidthSpinBox.setEnabled(True)
self.fontFooterHeightSpinBox.setEnabled(True)
if self.theme.display_outline:
self.OutlineColorPushButton.setEnabled(True)
self.outlineColorPushButton.setEnabled(True)
else:
self.OutlineColorPushButton.setEnabled(False)
self.outlineColorPushButton.setEnabled(False)
if self.theme.display_shadow:
self.ShadowColorPushButton.setEnabled(True)
self.shadowColorPushButton.setEnabled(True)
else:
self.ShadowColorPushButton.setEnabled(False)
self.shadowColorPushButton.setEnabled(False)
def previewTheme(self):
if self.allowPreview:
@ -742,15 +742,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# pixels top/bottom
line_height += 2 * int(self.theme.display_outline_size)
page_length = \
((self.FontMainHeightSpinBox.value()) / line_height )
((self.fontMainHeightSpinBox.value()) / line_height )
log.debug(u'Page Length area height %s, metrics %s, lines %s' %
(self.FontMainHeightSpinBox.value(), metrics.height(),
(self.fontMainHeightSpinBox.value(), metrics.height(),
page_length))
page_length_text = unicode(
translate('OpenLP.AmendThemeForm', 'Slide height is %s rows.'))
self.FontMainLinesPageLabel.setText(page_length_text % page_length)
self.fontMainLinesPageLabel.setText(page_length_text % page_length)
frame = self.thememanager.generateImage(self.theme)
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
self.themePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
def _getThemeMetrics(self):
main_weight = 50
@ -765,5 +765,5 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
# Validate that the screen width is big enough to display the text
if self.theme.font_main_width < metrics.maxWidth() * 2 + 64:
self.theme.font_main_width = metrics.maxWidth() * 2 + 64
self.FontMainWidthSpinBox.setValue(self.theme.font_main_width)
self.fontMainWidthSpinBox.setValue(self.theme.font_main_width)
return metrics