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