forked from openlp/openlp
Theme handling cleanups
This commit is contained in:
parent
0e064c9928
commit
ad36b2e83f
@ -214,7 +214,7 @@ class RenderManager(object):
|
||||
if self.force_page:
|
||||
verse = verse + verse + verse
|
||||
else:
|
||||
self.image_manager.del_image(self.theme_data.theme_name)
|
||||
self.image_manager.del_image(theme_data.theme_name)
|
||||
footer = []
|
||||
footer.append(u'Arky Arky (Unknown)' )
|
||||
footer.append(u'Public Domain')
|
||||
|
@ -53,7 +53,5 @@ class Ui_FileRenameDialog(object):
|
||||
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog)
|
||||
|
||||
def retranslateUi(self, FileRenameDialog):
|
||||
FileRenameDialog.setWindowTitle(translate('OpenLP.FileRenameForm',
|
||||
'File Rename'))
|
||||
self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm',
|
||||
'New File Name:'))
|
||||
|
@ -28,6 +28,8 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from filerenamedialog import Ui_FileRenameDialog
|
||||
|
||||
from openlp.core.lib import translate
|
||||
|
||||
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
||||
"""
|
||||
The exception dialog
|
||||
@ -39,3 +41,15 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
|
||||
self.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
|
||||
self.reject)
|
||||
|
||||
def exec_(self, copy=False):
|
||||
"""
|
||||
Run the Dialog with correct heading.
|
||||
"""
|
||||
if copy:
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm',
|
||||
'File Copy'))
|
||||
else:
|
||||
self.setWindowTitle(translate('OpenLP.FileRenameForm',
|
||||
'File Rename'))
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
@ -224,11 +224,11 @@ class ThemeManager(QtGui.QWidget):
|
||||
Renames an existing theme to a new name
|
||||
"""
|
||||
action = unicode(translate('OpenLP.ThemeManager', 'Rename'))
|
||||
if self._validate_theme_action(action):
|
||||
if self._validate_theme_action(action, False):
|
||||
item = self.themeListWidget.currentItem()
|
||||
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
||||
self.saveThemeName = u''
|
||||
self.saveThemeName = oldThemeName
|
||||
if self.fileRenameForm.exec_():
|
||||
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
|
||||
oldThemeData = self.getThemeData(oldThemeName)
|
||||
@ -243,7 +243,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
||||
self.saveThemeName = u''
|
||||
if self.fileRenameForm.exec_():
|
||||
if self.fileRenameForm.exec_(True):
|
||||
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
|
||||
themeData = self.getThemeData(oldThemeName)
|
||||
self.cloneThemeData(themeData, newThemeName)
|
||||
@ -636,7 +636,6 @@ class ThemeManager(QtGui.QWidget):
|
||||
plugin.renameTheme(self.saveThemeName, name)
|
||||
if unicode(self.serviceComboBox.currentText()) == name:
|
||||
editedServiceTheme = True
|
||||
self.deleteTheme(self.saveThemeName)
|
||||
if result == QtGui.QMessageBox.Yes:
|
||||
# Save the theme, overwriting the existing theme if necessary.
|
||||
if imageTo and self.oldBackgroundImage and \
|
||||
@ -751,7 +750,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
theme.extend_image_filename(path)
|
||||
return theme
|
||||
|
||||
def _validate_theme_action(self, action):
|
||||
def _validate_theme_action(self, action, testPlugin=True):
|
||||
"""
|
||||
Check to see if theme has been selected and the destructive action
|
||||
is allowed.
|
||||
@ -781,14 +780,15 @@ class ThemeManager(QtGui.QWidget):
|
||||
translate('OpenLP.ThemeManager',
|
||||
'You are unable to delete the default theme.'))
|
||||
else:
|
||||
for plugin in self.parent.pluginManager.plugins:
|
||||
if plugin.usesTheme(theme):
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeManager', 'Error'),
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'Theme %s is used in the %s plugin.')) % \
|
||||
(theme, plugin.name))
|
||||
return False
|
||||
if testPlugin:
|
||||
for plugin in self.parent.pluginManager.plugins:
|
||||
if plugin.usesTheme(theme):
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeManager', 'Error'),
|
||||
unicode(translate('OpenLP.ThemeManager',
|
||||
'Theme %s is used in the %s plugin.')) % \
|
||||
(theme, plugin.name))
|
||||
return False
|
||||
if unicode(self.serviceComboBox.currentText()) == theme:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeManager', 'Error'),
|
||||
|
Loading…
Reference in New Issue
Block a user