String cleanup: Themes

This commit is contained in:
M2j 2010-06-19 01:18:08 +02:00
parent 873eb59a89
commit b13f9eb74f
4 changed files with 161 additions and 165 deletions

View File

@ -750,158 +750,153 @@ class Ui_AmendThemeDialog(object):
def retranslateUi(self, AmendThemeDialog):
AmendThemeDialog.setWindowTitle(
translate(u'AmendThemeForm', u'Theme Maintenance'))
translate('AmendThemeForm', 'Theme Maintenance'))
self.ThemeNameLabel.setText(
translate(u'AmendThemeForm', u'Theme Name:'))
translate('AmendThemeForm', 'Theme Name:'))
self.BackgroundLabel.setText(
translate(u'AmendThemeForm', u'Background:'))
translate('AmendThemeForm', 'Visibility:'))
self.BackgroundComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Opaque'))
translate('AmendThemeForm', 'Opaque'))
self.BackgroundComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Transparent'))
translate('AmendThemeForm', 'Transparent'))
self.BackgroundTypeLabel.setText(
translate(u'AmendThemeForm', u'Background Type:'))
translate('AmendThemeForm', 'Type:'))
self.BackgroundTypeComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Solid Color'))
translate('AmendThemeForm', 'Solid Color'))
self.BackgroundTypeComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Gradient'))
translate('AmendThemeForm', 'Gradient'))
self.BackgroundTypeComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Image'))
self.Color1Label.setText(translate(u'AmendThemeForm', u'<Color1>'))
self.Color2Label.setText(translate(u'AmendThemeForm', u'<Color2>'))
self.ImageLabel.setText(translate(u'AmendThemeForm', u'Image:'))
self.GradientLabel.setText(translate(u'AmendThemeForm', u'Gradient :'))
translate('AmendThemeForm', 'Image'))
self.Color1Label.setText(u'<Color1>:')
self.Color2Label.setText(u'<Color2>:')
self.ImageLabel.setText(translate('AmendThemeForm', 'Image:'))
self.GradientLabel.setText(translate('AmendThemeForm', 'Gradient:'))
self.GradientComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Horizontal'))
translate('AmendThemeForm', 'Horizontal'))
self.GradientComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Vertical'))
translate('AmendThemeForm', 'Vertical'))
self.GradientComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Circular'))
translate('AmendThemeForm', 'Circular'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.BackgroundTab),
translate(u'AmendThemeForm', u'Background'))
translate('AmendThemeForm', '&Background'))
self.FontMainGroupBox.setTitle(
translate(u'AmendThemeForm', u'Main Font'))
self.FontMainlabel.setText(translate(u'AmendThemeForm', u'Font:'))
translate('AmendThemeForm', 'Main Font'))
self.FontMainlabel.setText(translate('AmendThemeForm', 'Font:'))
self.FontMainColorLabel.setText(
translate(u'AmendThemeForm', u'Font Color:'))
self.FontMainSize.setText(translate(u'AmendThemeForm', u'Size:'))
self.FontMainSizeSpinBox.setSuffix(translate(u'AmendThemeForm', u'pt'))
translate('AmendThemeForm', 'Color:'))
self.FontMainSize.setText(translate('AmendThemeForm', 'Size:'))
self.FontMainSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt'))
self.FontMainWrapIndentationLabel.setText(
translate(u'AmendThemeForm', u'Wrap Indentation'))
translate('AmendThemeForm', 'Wrap indentation:'))
self.FontMainWrapLineAdjustmentLabel.setText(
translate(u'AmendThemeForm', u'Adjust Line Spacing'))
translate('AmendThemeForm', 'Adjust line spacing:'))
self.FontMainWeightComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Normal'))
translate('AmendThemeForm', 'Normal'))
self.FontMainWeightComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Bold'))
translate('AmendThemeForm', 'Bold'))
self.FontMainWeightComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Italics'))
translate('AmendThemeForm', 'Italics'))
self.FontMainWeightComboBox.setItemText(3,
translate(u'AmendThemeForm', u'Bold/Italics'))
translate('AmendThemeForm', 'Bold/Italics'))
self.FontMainWeightLabel.setText(
translate(u'AmendThemeForm', u'Font Weight:'))
translate('AmendThemeForm', 'Style:'))
self.MainLocationGroupBox.setTitle(
translate(u'AmendThemeForm', u'Display Location'))
translate('AmendThemeForm', 'Display Location'))
self.DefaultLocationLabel.setText(
translate(u'AmendThemeForm', u'Use Default Location:'))
translate('AmendThemeForm', 'Use default location:'))
self.FontMainXLabel.setText(
translate(u'AmendThemeForm', u'X Position:'))
translate('AmendThemeForm', 'X position:'))
self.FontMainYLabel.setText(
translate(u'AmendThemeForm', u'Y Position:'))
translate('AmendThemeForm', 'Y position:'))
self.FontMainWidthLabel.setText(
translate(u'AmendThemeForm', u'Width:'))
translate('AmendThemeForm', 'Width:'))
self.FontMainHeightLabel.setText(
translate(u'AmendThemeForm', u'Height:'))
self.FontMainXSpinBox.setSuffix(translate(u'AmendThemeForm', u'px'))
self.FontMainYSpinBox.setSuffix(translate(u'AmendThemeForm', u'px'))
self.FontMainWidthSpinBox.setSuffix(translate(u'AmendThemeForm', u'px'))
self.FontMainHeightSpinBox.setSuffix(
translate(u'AmendThemeForm', u'px'))
translate('AmendThemeForm', 'Height:'))
self.FontMainXSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainYSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.FontMainTab),
translate(u'AmendThemeForm', u'Font Main'))
translate('AmendThemeForm', '&Main Font'))
self.FooterFontGroupBox.setTitle(
translate(u'AmendThemeForm', u'Footer Font'))
self.FontFooterLabel.setText(translate(u'AmendThemeForm', u'Font:'))
translate('AmendThemeForm', 'Footer Font'))
self.FontFooterLabel.setText(translate('AmendThemeForm', 'Font:'))
self.FontFooterColorLabel.setText(
translate(u'AmendThemeForm', u'Font Color:'))
self.FontFooterSizeLabel.setText(translate(u'AmendThemeForm', u'Size:'))
self.FontFooterSizeSpinBox.setSuffix(
translate(u'AmendThemeForm', u'pt'))
translate('AmendThemeForm', 'Color:'))
self.FontFooterSizeLabel.setText(translate('AmendThemeForm', 'Size:'))
self.FontFooterSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt'))
self.FontFooterWeightComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Normal'))
translate('AmendThemeForm', 'Normal'))
self.FontFooterWeightComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Bold'))
translate('AmendThemeForm', 'Bold'))
self.FontFooterWeightComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Italics'))
translate('AmendThemeForm', 'Italics'))
self.FontFooterWeightComboBox.setItemText(3,
translate(u'AmendThemeForm', u'Bold/Italics'))
translate('AmendThemeForm', 'Bold/Italics'))
self.FontFooterWeightLabel.setText(
translate(u'AmendThemeForm', u'Font Weight:'))
translate('AmendThemeForm', 'Style:'))
self.LocationFooterGroupBox.setTitle(
translate(u'AmendThemeForm', u'Display Location'))
translate('AmendThemeForm', 'Display Location'))
self.FontFooterDefaultLabel.setText(
translate(u'AmendThemeForm', u'Use Default Location:'))
translate('AmendThemeForm', 'Use default location:'))
self.FontFooterXLabel.setText(
translate(u'AmendThemeForm', u'X Position:'))
translate('AmendThemeForm', 'X position:'))
self.FontFooterYLabel.setText(
translate(u'AmendThemeForm', u'Y Position:'))
translate('AmendThemeForm', 'Y position:'))
self.FontFooterWidthLabel.setText(
translate(u'AmendThemeForm', u'Width:'))
translate('AmendThemeForm', 'Width:'))
self.FontFooterHeightLabel.setText(
translate(u'AmendThemeForm', u'Height:'))
self.FontFooterXSpinBox.setSuffix(
translate(u'AmendThemeForm', u'px'))
self.FontFooterYSpinBox.setSuffix(
translate(u'AmendThemeForm', u'px'))
self.FontFooterWidthSpinBox.setSuffix(
translate(u'AmendThemeForm', u'px'))
translate('AmendThemeForm', 'Height:'))
self.FontFooterXSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterYSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterHeightSpinBox.setSuffix(
translate(u'AmendThemeForm', u'px'))
translate('AmendThemeForm', 'px'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.FontFooterTab),
translate(u'AmendThemeForm', u'Font Footer'))
self.OutlineGroupBox.setTitle(translate(u'AmendThemeForm', u'Outline'))
translate('AmendThemeForm', '&Footer Font'))
self.OutlineGroupBox.setTitle(translate('AmendThemeForm', 'Outline'))
self.OutlineSpinBoxLabel.setText(
translate(u'AmendThemeForm', u'Outline Size:'))
self.OutlineSpinBox.setSuffix(translate(u'AmendThemeForm', u'px'))
translate('AmendThemeForm', 'Outline size:'))
self.OutlineSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.OutlineColorLabel.setText(
translate(u'AmendThemeForm', u'Outline Color:'))
translate('AmendThemeForm', 'Outline color:'))
self.OutlineEnabledLabel.setText(
translate(u'AmendThemeForm', u'Show Outline:'))
self.ShadowGroupBox.setTitle(translate(u'AmendThemeForm', u'Shadow'))
translate('AmendThemeForm', 'Show outline:'))
self.ShadowGroupBox.setTitle(translate('AmendThemeForm', 'Shadow'))
self.ShadowSpinBoxLabel.setText(
translate(u'AmendThemeForm', u'Shadow Size:'))
self.ShadowSpinBox.setSuffix(translate(u'AmendThemeForm', u'px'))
translate('AmendThemeForm', 'Shadow size:'))
self.ShadowSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.ShadowColorLabel.setText(
translate(u'AmendThemeForm', u'Shadow Color:'))
translate('AmendThemeForm', 'Shadow color:'))
self.ShadowEnabledLabel.setText(
translate(u'AmendThemeForm', u'Show Shadow:'))
translate('AmendThemeForm', 'Show shadow:'))
self.AlignmentGroupBox.setTitle(
translate(u'AmendThemeForm', u'Alignment'))
translate('AmendThemeForm', 'Alignment'))
self.HorizontalLabel.setText(
translate(u'AmendThemeForm', u'Horizontal Align:'))
translate('AmendThemeForm', 'Horizontal align:'))
self.HorizontalComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Left'))
translate('AmendThemeForm', 'Left'))
self.HorizontalComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Right'))
translate('AmendThemeForm', 'Right'))
self.HorizontalComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Center'))
translate('AmendThemeForm', 'Center'))
self.VerticalLabel.setText(
translate(u'AmendThemeForm', u'Vertical Align:'))
translate('AmendThemeForm', 'Vertical align:'))
self.VerticalComboBox.setItemText(0,
translate(u'AmendThemeForm', u'Top'))
translate('AmendThemeForm', 'Top'))
self.VerticalComboBox.setItemText(1,
translate(u'AmendThemeForm', u'Middle'))
translate('AmendThemeForm', 'Middle'))
self.VerticalComboBox.setItemText(2,
translate(u'AmendThemeForm', u'Bottom'))
translate('AmendThemeForm', 'Bottom'))
self.TransitionGroupBox.setTitle(
translate(u'AmendThemeForm', u'Slide Transition'))
translate('AmendThemeForm', 'Slide Transition'))
self.SlideTransitionCheckedBoxLabel.setText(
translate(u'AmendThemeForm', u'Transition Active:'))
translate('AmendThemeForm', 'Transition active:'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.OtherOptionsTab),
translate(u'AmendThemeForm', u'Other Options'))
self.PreviewGroupBox.setTitle(translate(u'AmendThemeForm', u'Preview'))
translate('AmendThemeForm', '&Other Options'))
self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview'))

View File

@ -210,7 +210,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onImageToolButtonClicked(self):
filename = QtGui.QFileDialog.getOpenFileName(
self, translate(u'AmendThemeForm', u'Open file'))
self, translate('AmendThemeForm', 'Open File'))
if filename:
self.ImageLineEdit.setText(filename)
self.theme.background_filename = filename
@ -647,7 +647,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.Color1PushButton.setStyleSheet(
u'background-color: %s' % unicode(theme.background_color))
self.Color1Label.setText(
translate(u'AmendThemeForm', u'Background Color:'))
translate('AmendThemeForm', 'Color:'))
self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True)
self.Color2Label.setVisible(False)
@ -663,9 +663,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.Color2PushButton.setStyleSheet(u'background-color: %s' \
% unicode(theme.background_endColor))
self.Color1Label.setText(
translate(u'AmendThemeForm', u'First Color:'))
translate('AmendThemeForm', 'First color:'))
self.Color2Label.setText(
translate(u'AmendThemeForm', u'Second Color:'))
translate('AmendThemeForm', 'Second color:'))
self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True)
self.Color2Label.setVisible(True)
@ -734,7 +734,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
(self.FontMainHeightSpinBox.value(), metrics.height(),
page_length))
page_length_text = unicode(
translate(u'AmendThemeForm', u'Slide Height is %s rows'))
translate('AmendThemeForm', 'Slide height is %s rows.'))
self.FontMainLinesPageLabel.setText(page_length_text % page_length)
frame = self.thememanager.generateImage(self.theme)
self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))

View File

@ -54,25 +54,25 @@ class ThemeManager(QtGui.QWidget):
self.amendThemeForm = AmendThemeForm(self)
self.Toolbar = OpenLPToolbar(self)
self.Toolbar.addToolbarButton(
translate(u'ThemeManager', u'New Theme'), u':/themes/theme_new.png',
translate(u'ThemeManager', u'Create a new theme'), self.onAddTheme)
translate('ThemeManager', 'New Theme'), u':/themes/theme_new.png',
translate('ThemeManager', 'Create a new theme.'), self.onAddTheme)
self.Toolbar.addToolbarButton(
translate(u'ThemeManager', u'Edit Theme'),
translate('ThemeManager', 'Edit Theme'),
u':/themes/theme_edit.png',
translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme)
translate('ThemeManager', 'Edit a theme.'), self.onEditTheme)
self.Toolbar.addToolbarButton(
translate(u'ThemeManager', u'Delete Theme'),
translate('ThemeManager', 'Delete Theme'),
u':/general/general_delete.png',
translate(u'ThemeManager', u'Delete a theme'), self.onDeleteTheme)
translate('ThemeManager', 'Delete a theme.'), self.onDeleteTheme)
self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(
translate(u'ThemeManager', u'Import Theme'),
translate('ThemeManager', 'Import Theme'),
u':/general/general_import.png',
translate(u'ThemeManager', u'Import a theme'), self.onImportTheme)
translate('ThemeManager', 'Import a theme.'), self.onImportTheme)
self.Toolbar.addToolbarButton(
translate(u'ThemeManager', u'Export Theme'),
translate('ThemeManager', 'Export Theme'),
u':/general/general_export.png',
translate(u'ThemeManager', u'Export a theme'), self.onExportTheme)
translate('ThemeManager', 'Export a theme.'), self.onExportTheme)
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
self.Layout.addWidget(self.Toolbar)
self.ThemeListWidget = QtGui.QListWidget(self)
@ -83,23 +83,23 @@ class ThemeManager(QtGui.QWidget):
self.ThemeListWidget.addAction(
context_menu_action(self.ThemeListWidget,
u':/themes/theme_edit.png',
translate(u'ThemeManager', u'Edit a theme'), self.onEditTheme))
translate('ThemeManager', '&Edit Theme'), self.onEditTheme))
self.ThemeListWidget.addAction(
context_menu_separator(self.ThemeListWidget))
self.ThemeListWidget.addAction(
context_menu_action(self.ThemeListWidget,
u':/general/general_delete.png',
translate(u'ThemeManager', u'Delete theme'),
translate('ThemeManager', '&Delete Theme'),
self.onDeleteTheme))
self.ThemeListWidget.addAction(
context_menu_action(self.ThemeListWidget,
u':/general/general_export.png',
translate(u'ThemeManager', u'Make Global'),
translate('ThemeManager', 'Set As &Global Default'),
self.changeGlobalFromScreen))
self.ThemeListWidget.addAction(
context_menu_action(self.ThemeListWidget,
u':/general/general_export.png',
translate(u'ThemeManager', u'Export theme'),
translate('ThemeManager', 'E&xport Theme'),
self.onExportTheme))
self.ThemeListWidget.addAction(
context_menu_separator(self.ThemeListWidget))
@ -136,7 +136,7 @@ class ThemeManager(QtGui.QWidget):
self.ThemeListWidget.item(count).setText(newName)
#Set the new name
if themeName == newName:
name = unicode(translate(u'ThemeManager', u'%s (default)')) % \
name = unicode(translate('ThemeManager', '%s (default)')) % \
newName
self.ThemeListWidget.item(count).setText(name)
@ -158,7 +158,7 @@ class ThemeManager(QtGui.QWidget):
if count == selected_row:
self.global_theme = unicode(
self.ThemeListWidget.item(count).text())
name = unicode(translate(u'ThemeManager', u'%s (default)')) % \
name = unicode(translate('ThemeManager', '%s (default)')) % \
self.global_theme
self.ThemeListWidget.item(count).setText(name)
QtCore.QSettings().setValue(
@ -203,26 +203,26 @@ class ThemeManager(QtGui.QWidget):
theme = unicode(item.text())
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(
self, translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager',
u'You are unable to delete the default theme.'),
QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'),
translate('ThemeManager',
'You are unable to delete the default theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else:
for plugin in self.parent.plugin_manager.plugins:
if not plugin.can_delete_theme(theme):
QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager',
u'Theme %s is use in %s plugin' % (theme,
plugin.name)))
translate('ThemeManager', 'Error'),
unicode(translate('ThemeManager',
'Theme %s is use in %s plugin.')) % \
(theme, plugin.name))
return
if unicode(self.parent.ServiceManagerContents.ThemeComboBox \
.currentText()) == theme:
QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager',
u'Theme %s is use by Service Manager' % theme))
translate('ThemeManager', 'Error'),
unicode(translate('ThemeManager',
'Theme %s is use by the service manager.')) % theme)
return
self.themelist.remove(theme)
th = theme + u'.png'
@ -249,12 +249,12 @@ class ThemeManager(QtGui.QWidget):
item = self.ThemeListWidget.currentItem()
if item is None:
QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'You have not selected a theme.'))
translate('ThemeManager', 'Error'),
translate('ThemeManager', 'You have not selected a theme.'))
return
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
path = QtGui.QFileDialog.getExistingDirectory(self,
unicode(translate(u'ThemeManager', u'Save Theme - (%s)')) % theme,
unicode(translate('ThemeManager', 'Save Theme - (%s)')) % theme,
SettingsManager.get_last_dir(self.settingsSection, 1))
path = unicode(path)
if path:
@ -270,15 +270,15 @@ class ThemeManager(QtGui.QWidget):
os.path.join(source, name).encode(u'utf-8'),
os.path.join(theme, name).encode(u'utf-8'))
QtGui.QMessageBox.information(self,
translate(u'ThemeManager', u'Theme Exported'),
translate(u'ThemeManager',
u'Your theme has been successfully exported.'))
translate('ThemeManager', 'Theme Exported'),
translate('ThemeManager',
'Your theme has been successfully exported.'))
except (IOError, OSError):
log.exception(u'Export Theme Failed')
QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Theme Export Failed'),
translate(u'ThemeManager',
u'Your theme could not be exported due to an error.'))
translate('ThemeManager', 'Theme Export Failed'),
translate('ThemeManager',
'Your theme could not be exported due to an error.'))
finally:
if zip:
zip.close()
@ -289,9 +289,10 @@ class ThemeManager(QtGui.QWidget):
attempting to extract OpenLP themes from those files. This process
will load both OpenLP version 1 and version 2 themes.
"""
files = QtGui.QFileDialog.getOpenFileNames(
self, translate(u'ThemeManager', u'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection), u'Theme (*.*)')
files = QtGui.QFileDialog.getOpenFileNames(self,
translate('ThemeManager', 'Select Theme Import File'),
SettingsManager.get_last_dir(self.settingsSection),
translate('ThemeManager', 'Theme (*.*)'))
log.info(u'New Themes %s', unicode(files))
if files:
for file in files:
@ -318,8 +319,8 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(theme):
textName = os.path.splitext(name)[0]
if textName == self.global_theme:
name = unicode(translate(u'ThemeManager',
u'%s (default)')) % textName
name = unicode(translate('ThemeManager',
'%s (default)')) % textName
else:
name = textName
thumb = os.path.join(self.thumbPath, u'%s.png' % textName)
@ -394,9 +395,9 @@ class ThemeManager(QtGui.QWidget):
ucsfile = file.decode(u'utf-8')
except UnicodeDecodeError:
QtGui.QMessageBox.critical(
self, translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'File is not a valid '
u'theme.\nThe content encoding is not UTF-8.'))
self, translate('ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.\n'
'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' % \
file.decode(u'utf-8', u'replace'))
continue
@ -432,15 +433,15 @@ class ThemeManager(QtGui.QWidget):
if filexml:
self.generateAndSaveImage(dir, themename, filexml)
else:
QtGui.QMessageBox.critical(
self, translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'File is not a valid theme.'))
QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.'))
log.exception(u'Theme file dosen\'t contain XML data %s' %
filename)
except (IOError, NameError):
QtGui.QMessageBox.critical(
self, translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'File is not a valid theme.'))
QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.'))
log.exception(u'Importing theme from zip file failed %s' % filename)
finally:
if zip:
@ -526,11 +527,11 @@ class ThemeManager(QtGui.QWidget):
result = QtGui.QMessageBox.Yes
if self.saveThemeName != name:
if os.path.exists(theme_file):
result = QtGui.QMessageBox.question(
self, translate(u'ThemeManager', u'Theme Exists'),
translate(u'ThemeManager',
u'A theme with this name already exists, '
u'would you like to overwrite it?'),
result = QtGui.QMessageBox.question(self,
translate('ThemeManager', 'Theme Exists'),
translate('ThemeManager',
'A theme with this name already exists. '
'Would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if result == QtGui.QMessageBox.Yes:
@ -598,7 +599,7 @@ class ThemeManager(QtGui.QWidget):
"""
log.debug(u'base theme created')
newtheme = ThemeXML()
newtheme.new_document(unicode(translate(u'ThemeManager', u'New Theme')))
newtheme.new_document(unicode(translate('ThemeManager', 'New Theme')))
newtheme.add_background_solid(unicode(u'#000000'))
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'),
unicode(30), u'False')

View File

@ -37,7 +37,7 @@ class ThemesTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'ThemesTab')
self.tabTitleVisible = translate(u'ThemesTab', u'Themes')
self.tabTitleVisible = translate('ThemesTab', 'Themes')
self.ThemesTabLayout = QtGui.QHBoxLayout(self)
self.ThemesTabLayout.setSpacing(8)
self.ThemesTabLayout.setMargin(8)
@ -106,26 +106,26 @@ class ThemesTab(SettingsTab):
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
def retranslateUi(self):
self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
self.GlobalGroupBox.setTitle(translate('ThemesTab', 'Global Theme'))
self.LevelGroupBox.setTitle(translate('ThemesTab', 'Theme Level'))
self.SongLevelRadioButton.setText(
translate(u'ThemesTab', u'Song level'))
translate('ThemesTab', 'S&ong Level'))
self.SongLevelLabel.setText(
translate(u'ThemesTab', u'Use the theme from each song '
u'in the database. If a song doesn\'t have a theme associated with '
u'it, then use the service\'s theme. If the service doesn\'t have '
u'a theme, then use the global theme.'))
translate('ThemesTab', 'Use the theme from each song '
'in the database. If a song doesn\'t have a theme associated with '
'it, then use the service\'s theme. If the service doesn\'t have '
'a theme, then use the global theme.'))
self.ServiceLevelRadioButton.setText(
translate(u'ThemesTab', u'Service level'))
translate('ThemesTab', '&Service Level'))
self.ServiceLevelLabel.setText(
translate(u'ThemesTab', u'Use the theme from the service, '
u'overriding any of the individual songs\' themes. If the '
u'service doesn\'t have a theme, then use the global theme.'))
translate('ThemesTab', 'Use the theme from the service, '
'overriding any of the individual songs\' themes. If the '
'service doesn\'t have a theme, then use the global theme.'))
self.GlobalLevelRadioButton.setText(
translate(u'ThemesTab', u'Global level'))
translate('ThemesTab', '&Global Level'))
self.GlobalLevelLabel.setText(
translate(u'ThemesTab', u'Use the global theme, overriding any '
u'themes associated with either the service or the songs.'))
translate('ThemesTab', 'Use the global theme, overriding any '
'themes associated with either the service or the songs.'))
def load(self):
settings = QtCore.QSettings()