forked from openlp/openlp
Refactor in existing error framework
This commit is contained in:
parent
2c958d04cd
commit
284402b7b2
@ -28,7 +28,7 @@ The :mod:`ui` module provides the core user interface for OpenLP
|
|||||||
"""
|
"""
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate, Receiver
|
||||||
|
|
||||||
class HideMode(object):
|
class HideMode(object):
|
||||||
"""
|
"""
|
||||||
@ -52,17 +52,21 @@ class HideMode(object):
|
|||||||
Screen = 3
|
Screen = 3
|
||||||
|
|
||||||
|
|
||||||
def criticalErrorMessageBox(parent, message, question=False):
|
def criticalErrorMessageBox(title=None, message=None, parent=None,
|
||||||
|
question=False):
|
||||||
"""
|
"""
|
||||||
Provides a standard critical message box for errors that OpenLP displays
|
Provides a standard critical message box for errors that OpenLP displays
|
||||||
to users.
|
to users.
|
||||||
|
|
||||||
``parent``
|
``title``
|
||||||
The parent UI element to attach the dialog to.
|
The title for the message box.
|
||||||
|
|
||||||
``message``
|
``message``
|
||||||
The message to display to the user.
|
The message to display to the user.
|
||||||
|
|
||||||
|
``parent``
|
||||||
|
The parent UI element to attach the dialog to.
|
||||||
|
|
||||||
``question``
|
``question``
|
||||||
Should this message box question the user.
|
Should this message box question the user.
|
||||||
"""
|
"""
|
||||||
@ -71,7 +75,9 @@ def criticalErrorMessageBox(parent, message, question=False):
|
|||||||
return QtGui.QMessageBox.critical(parent, error, message,
|
return QtGui.QMessageBox.critical(parent, error, message,
|
||||||
QtGui.QMessageBox.StandardButtons(
|
QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||||
return QtGui.QMessageBox.critical(parent, error, message)
|
data = {u'message': message}
|
||||||
|
data[u'title'] = title if title else error
|
||||||
|
return Receiver.send_message(u'openlp_error_message', data)
|
||||||
|
|
||||||
from themeform import ThemeForm
|
from themeform import ThemeForm
|
||||||
from filerenameform import FileRenameForm
|
from filerenameform import FileRenameForm
|
||||||
|
@ -34,6 +34,7 @@ import cPickle
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, DisplayTags
|
from openlp.core.lib import SettingsTab, translate, DisplayTags
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
|
|
||||||
class DisplayTagTab(SettingsTab):
|
class DisplayTagTab(SettingsTab):
|
||||||
'''
|
'''
|
||||||
@ -275,12 +276,10 @@ class DisplayTagTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
for html in DisplayTags.get_html_tags():
|
for html in DisplayTags.get_html_tags():
|
||||||
if self._strip(html[u'start tag']) == u'n':
|
if self._strip(html[u'start tag']) == u'n':
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.DisplayTagTab', 'Update Error'),
|
translate('OpenLP.DisplayTagTab', 'Update Error'),
|
||||||
translate('OpenLP.DisplayTagTab',
|
translate('OpenLP.DisplayTagTab',
|
||||||
'Tag "n" already defined.'),
|
'Tag "n" already defined.'))
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
|
|
||||||
QtGui.QMessageBox.Ok)
|
|
||||||
return
|
return
|
||||||
# Add new tag to list
|
# Add new tag to list
|
||||||
tag = {u'desc': u'New Item', u'start tag': u'{n}',
|
tag = {u'desc': u'New Item', u'start tag': u'{n}',
|
||||||
@ -318,12 +317,10 @@ class DisplayTagTab(SettingsTab):
|
|||||||
for linenumber, html1 in enumerate(html_expands):
|
for linenumber, html1 in enumerate(html_expands):
|
||||||
if self._strip(html1[u'start tag']) == tag and \
|
if self._strip(html1[u'start tag']) == tag and \
|
||||||
linenumber != self.selected:
|
linenumber != self.selected:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.DisplayTagTab', 'Update Error'),
|
translate('OpenLP.DisplayTagTab', 'Update Error'),
|
||||||
unicode(translate('OpenLP.DisplayTagTab',
|
unicode(translate('OpenLP.DisplayTagTab',
|
||||||
'Tag %s already defined.')) % tag,
|
'Tag %s already defined.')) % tag)
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
|
|
||||||
QtGui.QMessageBox.Ok)
|
|
||||||
return
|
return
|
||||||
html[u'desc'] = unicode(self.descriptionLineEdit.text())
|
html[u'desc'] = unicode(self.descriptionLineEdit.text())
|
||||||
html[u'start html'] = unicode(self.startTagLineEdit.text())
|
html[u'start html'] = unicode(self.startTagLineEdit.text())
|
||||||
|
@ -487,8 +487,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
for file in zip.namelist():
|
for file in zip.namelist():
|
||||||
ucsfile = file_is_unicode(file)
|
ucsfile = file_is_unicode(file)
|
||||||
if not ucsfile:
|
if not ucsfile:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ServiceManager',
|
message=translate('OpenLP.ServiceManager',
|
||||||
'File is not a valid service.\n'
|
'File is not a valid service.\n'
|
||||||
'The content encoding is not UTF-8.'))
|
'The content encoding is not UTF-8.'))
|
||||||
continue
|
continue
|
||||||
@ -521,7 +521,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
log.exception(u'Failed to remove osd file')
|
log.exception(u'Failed to remove osd file')
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self, translate('OpenLP.ServiceManager',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('OpenLP.ServiceManager',
|
||||||
'File is not a valid service.'))
|
'File is not a valid service.'))
|
||||||
log.exception(u'File contains no service data')
|
log.exception(u'File contains no service data')
|
||||||
except (IOError, NameError):
|
except (IOError, NameError):
|
||||||
@ -1002,7 +1003,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.mainwindow.previewController.addServiceManagerItem(
|
self.mainwindow.previewController.addServiceManagerItem(
|
||||||
self.serviceItems[item][u'service_item'], count)
|
self.serviceItems[item][u'service_item'], count)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||||
translate('OpenLP.ServiceManager', 'Your item cannot be '
|
translate('OpenLP.ServiceManager', 'Your item cannot be '
|
||||||
'displayed as there is no handler to display it'))
|
'displayed as there is no handler to display it'))
|
||||||
@ -1036,7 +1037,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems[item][u'service_item'], 0)
|
self.serviceItems[item][u'service_item'], 0)
|
||||||
self.mainwindow.liveController.PreviewListWidget.setFocus()
|
self.mainwindow.liveController.PreviewListWidget.setFocus()
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||||
translate('OpenLP.ServiceManager', 'Your item cannot be '
|
translate('OpenLP.ServiceManager', 'Your item cannot be '
|
||||||
'displayed as the plugin required to display it is missing '
|
'displayed as the plugin required to display it is missing '
|
||||||
|
@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
|
from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
|
||||||
Receiver
|
Receiver
|
||||||
|
from openlp.core.ui import criticalErrorMessage
|
||||||
from openlp.core.utils import get_images_filter
|
from openlp.core.utils import get_images_filter
|
||||||
from themewizard import Ui_ThemeWizard
|
from themewizard import Ui_ThemeWizard
|
||||||
|
|
||||||
@ -567,20 +568,16 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
self.theme.theme_name = \
|
self.theme.theme_name = \
|
||||||
unicode(self.field(u'name').toString())
|
unicode(self.field(u'name').toString())
|
||||||
if not self.theme.theme_name:
|
if not self.theme.theme_name:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
||||||
translate('OpenLP.ThemeForm',
|
translate('OpenLP.ThemeForm',
|
||||||
'There is no name for this theme. Please enter one.'),
|
'There is no name for this theme. Please enter one.'))
|
||||||
(QtGui.QMessageBox.Ok),
|
|
||||||
QtGui.QMessageBox.Ok)
|
|
||||||
return
|
return
|
||||||
if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
|
if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
||||||
translate('OpenLP.ThemeForm',
|
translate('OpenLP.ThemeForm',
|
||||||
'Invalid theme name. Please enter one.'),
|
'Invalid theme name. Please enter one.'))
|
||||||
(QtGui.QMessageBox.Ok),
|
|
||||||
QtGui.QMessageBox.Ok)
|
|
||||||
return
|
return
|
||||||
saveFrom = None
|
saveFrom = None
|
||||||
saveTo = None
|
saveTo = None
|
||||||
|
@ -359,7 +359,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
criticalErrorMessageBox(self, translate('OpenLP.ThemeManager',
|
criticalErrorMessageBox(message=translate('OpenLP.ThemeManager',
|
||||||
'You have not selected a theme.'))
|
'You have not selected a theme.'))
|
||||||
return
|
return
|
||||||
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
|
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
@ -386,7 +386,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
'Your theme has been successfully exported.'))
|
'Your theme has been successfully exported.'))
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
log.exception(u'Export Theme Failed')
|
log.exception(u'Export Theme Failed')
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ThemeManager', 'Theme Export Failed'),
|
translate('OpenLP.ThemeManager', 'Theme Export Failed'),
|
||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'Your theme could not be exported due to an error.'))
|
'Your theme could not be exported due to an error.'))
|
||||||
@ -496,9 +496,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
for file in zip.namelist():
|
for file in zip.namelist():
|
||||||
ucsfile = file_is_unicode(file)
|
ucsfile = file_is_unicode(file)
|
||||||
if not ucsfile:
|
if not ucsfile:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('OpenLP.ThemeManager', 'File is not a valid '
|
message=translate('OpenLP.ThemeManager',
|
||||||
'theme.\nThe content encoding is not UTF-8.'))
|
'File is not a valid theme.\n'
|
||||||
|
'The content encoding is not UTF-8.'))
|
||||||
continue
|
continue
|
||||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
||||||
theme_dir = None
|
theme_dir = None
|
||||||
@ -533,19 +534,17 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme = self._createThemeFromXml(filexml, self.path)
|
theme = self._createThemeFromXml(filexml, self.path)
|
||||||
self.generateAndSaveImage(dir, themename, theme)
|
self.generateAndSaveImage(dir, themename, theme)
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||||
'Validation Error'),
|
translate('OpenLP.ThemeManager',
|
||||||
u'message':translate('OpenLP.ThemeManager',
|
'File is not a valid theme.'))
|
||||||
'File is not a valid theme.')})
|
|
||||||
log.exception(u'Theme file does not contain XML data %s' %
|
log.exception(u'Theme file does not contain XML data %s' %
|
||||||
filename)
|
filename)
|
||||||
except (IOError, NameError):
|
except (IOError, NameError):
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||||
'Validation Error'),
|
translate('OpenLP.ThemeManager',
|
||||||
u'message':translate('OpenLP.ThemeManager',
|
'File is not a valid theme.'))
|
||||||
'File is not a valid theme.')})
|
|
||||||
log.exception(u'Importing theme from zip failed %s' % filename)
|
log.exception(u'Importing theme from zip failed %s' % filename)
|
||||||
finally:
|
finally:
|
||||||
if zip:
|
if zip:
|
||||||
@ -578,11 +577,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
theme_dir = os.path.join(self.path, themeName)
|
theme_dir = os.path.join(self.path, themeName)
|
||||||
if os.path.exists(theme_dir):
|
if os.path.exists(theme_dir):
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager', 'Validation Error'),
|
||||||
'Validation Error'),
|
translate('OpenLP.ThemeManager',
|
||||||
u'message':translate('OpenLP.ThemeManager',
|
'A theme with this name already exists.'))
|
||||||
'A theme with this name already exists.')})
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -696,19 +694,19 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
return False
|
return False
|
||||||
# should be the same unless default
|
# should be the same unless default
|
||||||
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
|
||||||
criticalErrorMessageBox(self, translate('OpenLP.ThemeManager',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('OpenLP.ThemeManager',
|
||||||
'You are unable to delete the default theme.'))
|
'You are unable to delete the default theme.'))
|
||||||
return False
|
return False
|
||||||
# check for use in the system else where.
|
# check for use in the system else where.
|
||||||
if testPlugin:
|
if testPlugin:
|
||||||
for plugin in self.mainwindow.pluginManager.plugins:
|
for plugin in self.mainwindow.pluginManager.plugins:
|
||||||
if plugin.usesTheme(theme):
|
if plugin.usesTheme(theme):
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(translate('OpenLP.ThemeManager',
|
||||||
u'title': translate('OpenLP.ThemeManager',
|
|
||||||
'Validation Error'),
|
'Validation Error'),
|
||||||
u'message': unicode(translate('OpenLP.ThemeManager',
|
unicode(translate('OpenLP.ThemeManager',
|
||||||
'Theme %s is used in the %s plugin.')) % \
|
'Theme %s is used in the %s plugin.')) % \
|
||||||
(theme, plugin.name)})
|
(theme, plugin.name))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||||
from openlp.core.lib.db import delete_database
|
from openlp.core.lib.db import delete_database
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.core.ui.wizard import OpenLPWizard
|
from openlp.core.ui.wizard import OpenLPWizard
|
||||||
from openlp.core.utils import AppLocation, string_is_unicode
|
from openlp.core.utils import AppLocation, string_is_unicode
|
||||||
from openlp.plugins.bibles.lib.manager import BibleFormat
|
from openlp.plugins.bibles.lib.manager import BibleFormat
|
||||||
@ -468,7 +469,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
||||||
if not self.field(u'osis_location').toString():
|
if not self.field(u'osis_location').toString():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Invalid Bible Location'),
|
'Invalid Bible Location'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -478,7 +479,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
||||||
if not self.field(u'csv_booksfile').toString():
|
if not self.field(u'csv_booksfile').toString():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Invalid Books File'),
|
'Invalid Books File'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -487,7 +488,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.csvBooksEdit.setFocus()
|
self.csvBooksEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field(u'csv_versefile').toString():
|
elif not self.field(u'csv_versefile').toString():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Invalid Verse File'),
|
'Invalid Verse File'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -498,7 +499,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.field(u'source_format').toInt()[0] == \
|
elif self.field(u'source_format').toInt()[0] == \
|
||||||
BibleFormat.OpenSong:
|
BibleFormat.OpenSong:
|
||||||
if not self.field(u'opensong_file').toString():
|
if not self.field(u'opensong_file').toString():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Invalid OpenSong Bible'),
|
'Invalid OpenSong Bible'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -508,7 +509,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
||||||
if not self.field(u'openlp1_location').toString():
|
if not self.field(u'openlp1_location').toString():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Invalid Bible Location'),
|
'Invalid Bible Location'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -522,7 +523,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
license_copyright = \
|
license_copyright = \
|
||||||
unicode(self.field(u'license_copyright').toString())
|
unicode(self.field(u'license_copyright').toString())
|
||||||
if not license_version:
|
if not license_version:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Empty Version Name'),
|
'Empty Version Name'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -530,7 +531,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not license_copyright:
|
elif not license_copyright:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Empty Copyright'),
|
'Empty Copyright'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -539,7 +540,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.copyrightEdit.setFocus()
|
self.copyrightEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.manager.exists(license_version):
|
elif self.manager.exists(license_version):
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'This Bible already exists. Please import '
|
'This Bible already exists. Please import '
|
||||||
|
@ -35,6 +35,7 @@ from sqlalchemy.orm.exc import UnmappedClassError
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.db import BaseModel, init_db, Manager
|
from openlp.core.lib.db import BaseModel, init_db, Manager
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -354,12 +355,11 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
verse_list.extend(verses)
|
verse_list.extend(verses)
|
||||||
else:
|
else:
|
||||||
log.debug(u'OpenLP failed to find book %s', book)
|
log.debug(u'OpenLP failed to find book %s', book)
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('BiblesPlugin', 'No Book Found'),
|
translate('BiblesPlugin', 'No Book Found'),
|
||||||
u'message': translate('BiblesPlugin', 'No matching book '
|
translate('BiblesPlugin', 'No matching book '
|
||||||
'could be found in this Bible. Check that you have '
|
'could be found in this Bible. Check that you have '
|
||||||
'spelled the name of the book correctly.')
|
'spelled the name of the book correctly.'))
|
||||||
})
|
|
||||||
return verse_list
|
return verse_list
|
||||||
|
|
||||||
def verse_search(self, text):
|
def verse_search(self, text):
|
||||||
|
@ -38,6 +38,7 @@ from HTMLParser import HTMLParseError
|
|||||||
from BeautifulSoup import BeautifulSoup, NavigableString
|
from BeautifulSoup import BeautifulSoup, NavigableString
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.core.utils import AppLocation, get_web_page
|
from openlp.core.utils import AppLocation, get_web_page
|
||||||
from openlp.plugins.bibles.lib import SearchResults
|
from openlp.plugins.bibles.lib import SearchResults
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
||||||
@ -429,12 +430,11 @@ class HTTPBible(BibleDB):
|
|||||||
if not db_book:
|
if not db_book:
|
||||||
book_details = HTTPBooks.get_book(book)
|
book_details = HTTPBooks.get_book(book)
|
||||||
if not book_details:
|
if not book_details:
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('BiblesPlugin', 'No Book Found'),
|
translate('BiblesPlugin', 'No Book Found'),
|
||||||
u'message': translate('BiblesPlugin', 'No matching '
|
translate('BiblesPlugin', 'No matching '
|
||||||
'book could be found in this Bible. Check that you '
|
'book could be found in this Bible. Check that you '
|
||||||
'have spelled the name of the book correctly.')
|
'have spelled the name of the book correctly.'))
|
||||||
})
|
|
||||||
return []
|
return []
|
||||||
db_book = self.create_book(book_details[u'name'],
|
db_book = self.create_book(book_details[u'name'],
|
||||||
book_details[u'abbreviation'],
|
book_details[u'abbreviation'],
|
||||||
@ -540,17 +540,15 @@ def send_error_message(error_type):
|
|||||||
The type of error that occured for the issue.
|
The type of error that occured for the issue.
|
||||||
"""
|
"""
|
||||||
if error_type == u'download':
|
if error_type == u'download':
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
|
translate('BiblePlugin.HTTPBible', 'Download Error'),
|
||||||
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
'problem downloading your verse selection. Please check your '
|
'problem downloading your verse selection. Please check your '
|
||||||
'Internet connection, and if this error continues to occur '
|
'Internet connection, and if this error continues to occur '
|
||||||
'please consider reporting a bug.')
|
'please consider reporting a bug.'))
|
||||||
})
|
|
||||||
elif error_type == u'parse':
|
elif error_type == u'parse':
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
|
translate('BiblePlugin.HTTPBible', 'Parse Error'),
|
||||||
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
'problem extracting your verse selection. If this error continues '
|
'problem extracting your verse selection. If this error continues '
|
||||||
'to occur please consider reporting a bug.')
|
'to occur please consider reporting a bug.'))
|
||||||
})
|
|
||||||
|
@ -389,11 +389,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
|
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
|
||||||
if verse_count == 0:
|
if verse_count == 0:
|
||||||
self.advancedSearchButton.setEnabled(False)
|
self.advancedSearchButton.setEnabled(False)
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem',
|
||||||
u'title': translate('BiblePlugin.MediaItem', 'Error'),
|
'Bible not fully loaded'))
|
||||||
u'message': translate('BiblePlugin.MediaItem',
|
|
||||||
'Bible not fully loaded')
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
self.advancedSearchButton.setEnabled(True)
|
self.advancedSearchButton.setEnabled(True)
|
||||||
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
|
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
|
||||||
@ -534,11 +531,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if item_second_bible and second_bible or not item_second_bible and \
|
if item_second_bible and second_bible or not item_second_bible and \
|
||||||
not second_bible:
|
not second_bible:
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
elif criticalErrorMessageBox(self,
|
elif criticalErrorMessageBox(
|
||||||
translate('BiblePlugin.MediaItem', 'You cannot combine single '
|
message=translate('BiblePlugin.MediaItem',
|
||||||
'and second bible verses. Do you want to delete your search '
|
'You cannot combine single and second bible verses. Do you '
|
||||||
'results and start a new search?'),
|
'want to delete your search results and start a new search?'),
|
||||||
True) == QtGui.QMessageBox.Yes:
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
else:
|
else:
|
||||||
@ -582,11 +579,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if item_second_bible and second_bible or not item_second_bible and \
|
if item_second_bible and second_bible or not item_second_bible and \
|
||||||
not second_bible:
|
not second_bible:
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
elif criticalErrorMessageBox(self,
|
elif criticalErrorMessageBox(
|
||||||
translate('BiblePlugin.MediaItem', 'You cannot combine single '
|
message=translate('BiblePlugin.MediaItem',
|
||||||
'and second bible verses. Do you want to delete your search '
|
'You cannot combine single and second bible verses. Do you '
|
||||||
'results and start a new search?'),
|
'want to delete your search results and start a new search?'),
|
||||||
True) == QtGui.QMessageBox.Yes:
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
elif self.search_results:
|
elif self.search_results:
|
||||||
|
@ -152,7 +152,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
"""
|
"""
|
||||||
valid, message = self._validate()
|
valid, message = self._validate()
|
||||||
if not valid:
|
if not valid:
|
||||||
criticalErrorMessageBox(self, message)
|
criticalErrorMessageBox(message=message)
|
||||||
return False
|
return False
|
||||||
sxml = CustomXMLBuilder()
|
sxml = CustomXMLBuilder()
|
||||||
sxml.new_document()
|
sxml.new_document()
|
||||||
|
@ -31,7 +31,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
||||||
Receiver, check_directory_exists
|
check_directory_exists
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.core.utils import AppLocation, get_images_filter
|
from openlp.core.utils import AppLocation, get_images_filter
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -164,7 +165,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
items.remove(item)
|
items.remove(item)
|
||||||
# We cannot continue, as all images do not exist.
|
# We cannot continue, as all images do not exist.
|
||||||
if not items:
|
if not items:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||||
unicode(translate('ImagePlugin.MediaItem',
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
'The following image(s) no longer exist: %s')) %
|
'The following image(s) no longer exist: %s')) %
|
||||||
@ -208,12 +209,11 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.parent.liveController.display.directImage(name, filename)
|
self.parent.liveController.display.directImage(name, filename)
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(
|
||||||
u'title': translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem', 'Live Background Error'),
|
||||||
'Live Background Error'),
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
u'message': unicode(translate('ImagePlugin.MediaItem',
|
|
||||||
'There was a problem replacing your background, '
|
'There was a problem replacing your background, '
|
||||||
'the image file "%s" no longer exists.')) % filename})
|
'the image file "%s" no longer exists.')) % filename)
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onPreviewClick(self):
|
||||||
MediaManagerItem.onPreviewClick(self)
|
MediaManagerItem.onPreviewClick(self)
|
@ -30,8 +30,8 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
ItemCapabilities, SettingsManager, translate, check_item_selected
|
||||||
Receiver
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -106,12 +106,11 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.parent.liveController.display.video(filename, 0, True)
|
self.parent.liveController.display.video(filename, 0, True)
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
criticalErrorMessageBox(translate('MediaPlugin.MediaItem',
|
||||||
u'title': translate('MediaPlugin.MediaItem',
|
|
||||||
'Live Background Error'),
|
'Live Background Error'),
|
||||||
u'message': unicode(translate('MediaPlugin.MediaItem',
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
'There was a problem replacing your background, '
|
'There was a problem replacing your background, '
|
||||||
'the media file "%s" no longer exists.')) % filename})
|
'the media file "%s" no longer exists.')) % filename)
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
||||||
if item is None:
|
if item is None:
|
||||||
@ -131,9 +130,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
QtGui.QMessageBox.critical(
|
criticalErrorMessageBox(
|
||||||
self, translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem', 'Missing Media File'),
|
||||||
'Missing Media File'),
|
|
||||||
unicode(translate('MediaPlugin.MediaItem',
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
'The file %s no longer exists.')) % filename)
|
'The file %s no longer exists.')) % filename)
|
||||||
return False
|
return False
|
||||||
|
@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
|
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -180,7 +181,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
filename = os.path.split(unicode(file))[1]
|
filename = os.path.split(unicode(file))[1]
|
||||||
if titles.count(filename) > 0:
|
if titles.count(filename) > 0:
|
||||||
if not initialLoad:
|
if not initialLoad:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'File Exists'),
|
'File Exists'),
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
@ -204,7 +205,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if initialLoad:
|
if initialLoad:
|
||||||
icon = build_icon(u':/general/general_delete.png')
|
icon = build_icon(u':/general/general_delete.png')
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(
|
criticalErrorMessageBox(
|
||||||
self, translate('PresentationPlugin.MediaItem',
|
self, translate('PresentationPlugin.MediaItem',
|
||||||
'Unsupported File'),
|
'Unsupported File'),
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
@ -275,8 +276,8 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
QtGui.QMessageBox.critical(
|
criticalErrorMessageBox(
|
||||||
self, translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'Missing Presentation'),
|
'Missing Presentation'),
|
||||||
unicode(translate('PresentationPlugin.MediaItem',
|
unicode(translate('PresentationPlugin.MediaItem',
|
||||||
'The Presentation %s no longer exists.')) % filename)
|
'The Presentation %s no longer exists.')) % filename)
|
||||||
|
@ -80,21 +80,21 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if not self.firstNameEdit.text():
|
if not self.firstNameEdit.text():
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.AuthorsForm',
|
criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
|
||||||
'You need to type in the first name of the author.'))
|
'You need to type in the first name of the author.'))
|
||||||
self.firstNameEdit.setFocus()
|
self.firstNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.lastNameEdit.text():
|
elif not self.lastNameEdit.text():
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.AuthorsForm',
|
criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
|
||||||
'You need to type in the last name of the author.'))
|
'You need to type in the last name of the author.'))
|
||||||
self.lastNameEdit.setFocus()
|
self.lastNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.displayEdit.text():
|
elif not self.displayEdit.text():
|
||||||
if criticalErrorMessageBox(self,
|
if criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.AuthorsForm',
|
message=translate('SongsPlugin.AuthorsForm',
|
||||||
'You have not set a display name for the '
|
'You have not set a display name for the '
|
||||||
'author, combine the first and last names?'),
|
'author, combine the first and last names?'),
|
||||||
True) == QtGui.QMessageBox.Yes:
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.displayEdit.setText(self.firstNameEdit.text() + \
|
self.displayEdit.setText(self.firstNameEdit.text() + \
|
||||||
u' ' + self.lastNameEdit.text())
|
u' ' + self.lastNameEdit.text())
|
||||||
return QtGui.QDialog.accept(self)
|
return QtGui.QDialog.accept(self)
|
||||||
|
@ -347,9 +347,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
author = self.manager.get_object(Author, item_id)
|
author = self.manager.get_object(Author, item_id)
|
||||||
if self.authorsListView.findItems(unicode(author.display_name),
|
if self.authorsListView.findItems(unicode(author.display_name),
|
||||||
QtCore.Qt.MatchExactly):
|
QtCore.Qt.MatchExactly):
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.EditSongForm', 'This author is '
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'already in the list.'))
|
'This author is already in the list.'))
|
||||||
else:
|
else:
|
||||||
author_item = QtGui.QListWidgetItem(unicode(
|
author_item = QtGui.QListWidgetItem(unicode(
|
||||||
author.display_name))
|
author.display_name))
|
||||||
@ -400,9 +400,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
topic = self.manager.get_object(Topic, item_id)
|
topic = self.manager.get_object(Topic, item_id)
|
||||||
if self.topicsListView.findItems(unicode(topic.name),
|
if self.topicsListView.findItems(unicode(topic.name),
|
||||||
QtCore.Qt.MatchExactly):
|
QtCore.Qt.MatchExactly):
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.EditSongForm', 'This topic is '
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'already in the list.'))
|
'This topic is already in the list.'))
|
||||||
else:
|
else:
|
||||||
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
|
||||||
topic_item.setData(QtCore.Qt.UserRole,
|
topic_item.setData(QtCore.Qt.UserRole,
|
||||||
@ -532,19 +532,22 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
if len(self.titleEdit.displayText()) == 0:
|
if len(self.titleEdit.displayText()) == 0:
|
||||||
self.songTabWidget.setCurrentIndex(0)
|
self.songTabWidget.setCurrentIndex(0)
|
||||||
self.titleEdit.setFocus()
|
self.titleEdit.setFocus()
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.EditSongForm',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'You need to type in a song title.'))
|
'You need to type in a song title.'))
|
||||||
return False
|
return False
|
||||||
if self.verseListWidget.rowCount() == 0:
|
if self.verseListWidget.rowCount() == 0:
|
||||||
self.songTabWidget.setCurrentIndex(0)
|
self.songTabWidget.setCurrentIndex(0)
|
||||||
self.verseListWidget.setFocus()
|
self.verseListWidget.setFocus()
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.EditSongForm',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'You need to type in at least one verse.'))
|
'You need to type in at least one verse.'))
|
||||||
return False
|
return False
|
||||||
if self.authorsListView.count() == 0:
|
if self.authorsListView.count() == 0:
|
||||||
self.songTabWidget.setCurrentIndex(1)
|
self.songTabWidget.setCurrentIndex(1)
|
||||||
self.authorsListView.setFocus()
|
self.authorsListView.setFocus()
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.EditSongForm',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'You need to have an author for this song.'))
|
'You need to have an author for this song.'))
|
||||||
return False
|
return False
|
||||||
if self.song.verse_order:
|
if self.song.verse_order:
|
||||||
@ -571,8 +574,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
valid = verses.pop(0)
|
valid = verses.pop(0)
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
valid = valid + u', ' + verse
|
valid = valid + u', ' + verse
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
unicode(translate('SongsPlugin.EditSongForm',
|
message=unicode(translate('SongsPlugin.EditSongForm',
|
||||||
'The verse order is invalid. There is no verse '
|
'The verse order is invalid. There is no verse '
|
||||||
'corresponding to %s. Valid entries are %s.')) % \
|
'corresponding to %s. Valid entries are %s.')) % \
|
||||||
(order_names[count], valid))
|
(order_names[count], valid))
|
||||||
|
@ -168,7 +168,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
else:
|
else:
|
||||||
value = self.getVerse()[0].split(u'\n')[1]
|
value = self.getVerse()[0].split(u'\n')[1]
|
||||||
if len(value) == 0:
|
if len(value) == 0:
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.EditSongForm',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('SongsPlugin.EditSongForm',
|
||||||
'You need to type some text in to the verse.'))
|
'You need to type some text in to the verse.'))
|
||||||
return False
|
return False
|
||||||
QtGui.QDialog.accept(self)
|
QtGui.QDialog.accept(self)
|
||||||
|
@ -50,7 +50,8 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if not self.nameEdit.text():
|
if not self.nameEdit.text():
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.SongBookForm',
|
criticalErrorMessageBox(
|
||||||
|
message=translate('SongsPlugin.SongBookForm',
|
||||||
'You need to type in a name for the book.'))
|
'You need to type in a name for the book.'))
|
||||||
self.nameEdit.setFocus()
|
self.nameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
|
@ -32,6 +32,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||||
|
from openlp.core.ui import criticalErrorMessageBox
|
||||||
from openlp.core.ui.wizard import OpenLPWizard
|
from openlp.core.ui.wizard import OpenLPWizard
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat
|
from openlp.plugins.songs.lib.importer import SongFormat
|
||||||
|
|
||||||
@ -325,7 +326,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
source_format = self.formatComboBox.currentIndex()
|
source_format = self.formatComboBox.currentIndex()
|
||||||
if source_format == SongFormat.OpenLP2:
|
if source_format == SongFormat.OpenLP2:
|
||||||
if self.openLP2FilenameEdit.text().isEmpty():
|
if self.openLP2FilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No OpenLP 2.0 Song Database Selected'),
|
'No OpenLP 2.0 Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -335,7 +336,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLP1:
|
elif source_format == SongFormat.OpenLP1:
|
||||||
if self.openLP1FilenameEdit.text().isEmpty():
|
if self.openLP1FilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No openlp.org 1.x Song Database Selected'),
|
'No openlp.org 1.x Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -345,7 +346,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLyrics:
|
elif source_format == SongFormat.OpenLyrics:
|
||||||
if self.openLyricsFileListWidget.count() == 0:
|
if self.openLyricsFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No OpenLyrics Files Selected'),
|
'No OpenLyrics Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -355,7 +356,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenSong:
|
elif source_format == SongFormat.OpenSong:
|
||||||
if self.openSongFileListWidget.count() == 0:
|
if self.openSongFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No OpenSong Files Selected'),
|
'No OpenSong Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -365,7 +366,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.WordsOfWorship:
|
elif source_format == SongFormat.WordsOfWorship:
|
||||||
if self.wordsOfWorshipFileListWidget.count() == 0:
|
if self.wordsOfWorshipFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Words of Worship Files Selected'),
|
'No Words of Worship Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -375,7 +376,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.CCLI:
|
elif source_format == SongFormat.CCLI:
|
||||||
if self.ccliFileListWidget.count() == 0:
|
if self.ccliFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No CCLI Files Selected'),
|
'No CCLI Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -385,7 +386,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongsOfFellowship:
|
elif source_format == SongFormat.SongsOfFellowship:
|
||||||
if self.songsOfFellowshipFileListWidget.count() == 0:
|
if self.songsOfFellowshipFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Songs of Fellowship File Selected'),
|
'No Songs of Fellowship File Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -395,7 +396,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.Generic:
|
elif source_format == SongFormat.Generic:
|
||||||
if self.genericFileListWidget.count() == 0:
|
if self.genericFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Document/Presentation Selected'),
|
'No Document/Presentation Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -405,7 +406,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.EasyWorship:
|
elif source_format == SongFormat.EasyWorship:
|
||||||
if self.ewFilenameEdit.text().isEmpty():
|
if self.ewFilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No EasyWorship Song Database Selected'),
|
'No EasyWorship Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
@ -415,7 +416,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongBeamer:
|
elif source_format == SongFormat.SongBeamer:
|
||||||
if self.songBeamerFileListWidget.count() == 0:
|
if self.songBeamerFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No SongBeamer File Selected'),
|
'No SongBeamer File Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
|
@ -91,15 +91,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if item_id != -1:
|
if item_id != -1:
|
||||||
item = self.manager.get_object(item_class, item_id)
|
item = self.manager.get_object(item_class, item_id)
|
||||||
if item and len(item.songs) == 0:
|
if item and len(item.songs) == 0:
|
||||||
if QtGui.QMessageBox.warning(self, dlg_title, del_text,
|
if criticalErrorMessageBox(title=dlg_title, message=del_text,
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
|
|
||||||
self.manager.delete_object(item_class, item.id)
|
self.manager.delete_object(item_class, item.id)
|
||||||
reset_func()
|
reset_func()
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(self, dlg_title, err_text)
|
criticalErrorMessageBox(dlg_title, err_text)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(self, dlg_title, sel_text)
|
criticalErrorMessageBox(dlg_title, sel_text)
|
||||||
|
|
||||||
def resetAuthors(self):
|
def resetAuthors(self):
|
||||||
"""
|
"""
|
||||||
@ -233,12 +232,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if self.manager.save_object(author):
|
if self.manager.save_object(author):
|
||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not add your author.'))
|
'Could not add your author.'))
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'This author already exists.'))
|
'This author already exists.'))
|
||||||
|
|
||||||
def onTopicAddButtonClick(self):
|
def onTopicAddButtonClick(self):
|
||||||
@ -248,12 +247,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if self.manager.save_object(topic):
|
if self.manager.save_object(topic):
|
||||||
self.resetTopics()
|
self.resetTopics()
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not add your topic.'))
|
'Could not add your topic.'))
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'This topic already exists.'))
|
'This topic already exists.'))
|
||||||
|
|
||||||
def onBookAddButtonClick(self):
|
def onBookAddButtonClick(self):
|
||||||
@ -264,12 +263,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if self.manager.save_object(book):
|
if self.manager.save_object(book):
|
||||||
self.resetBooks()
|
self.resetBooks()
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not add your book.'))
|
'Could not add your book.'))
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'This book already exists.'))
|
'This book already exists.'))
|
||||||
|
|
||||||
def onAuthorEditButtonClick(self):
|
def onAuthorEditButtonClick(self):
|
||||||
@ -296,15 +295,15 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif criticalErrorMessageBox(self,
|
elif criticalErrorMessageBox(message=unicode(translate(
|
||||||
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
'SongsPlugin.SongMaintenanceForm', 'The author %s already '
|
||||||
'The author %s already exists. Would you like to make songs'
|
'exists. Would you like to make songs with author %s use '
|
||||||
' with author %s use the existing author %s?')) %
|
'the existing author %s?')) % (author.display_name,
|
||||||
(author.display_name, temp_display_name,
|
temp_display_name, author.display_name),
|
||||||
author.display_name), True) == QtGui.QMessageBox.Yes:
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeAuthors(author)
|
self.mergeAuthors(author)
|
||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
@ -314,8 +313,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
author.first_name = temp_first_name
|
author.first_name = temp_first_name
|
||||||
author.last_name = temp_last_name
|
author.last_name = temp_last_name
|
||||||
author.display_name = temp_display_name
|
author.display_name = temp_display_name
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not save your modified author, because the '
|
'Could not save your modified author, because the '
|
||||||
'author already exists.'))
|
'author already exists.'))
|
||||||
|
|
||||||
@ -332,21 +331,22 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if self.manager.save_object(topic):
|
if self.manager.save_object(topic):
|
||||||
self.resetTopics()
|
self.resetTopics()
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif criticalErrorMessageBox(self,
|
elif criticalErrorMessageBox(
|
||||||
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
message=unicode(translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'The topic %s already exists. Would you like to make songs '
|
'The topic %s already exists. Would you like to make songs '
|
||||||
'with topic %s use the existing topic %s?')) % (topic.name,
|
'with topic %s use the existing topic %s?')) % (topic.name,
|
||||||
temp_name, topic.name), True) == QtGui.QMessageBox.Yes:
|
temp_name, topic.name),
|
||||||
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeTopics(topic)
|
self.mergeTopics(topic)
|
||||||
self.resetTopics()
|
self.resetTopics()
|
||||||
else:
|
else:
|
||||||
# We restore the topics's old name.
|
# We restore the topics's old name.
|
||||||
topic.name = temp_name
|
topic.name = temp_name
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not save your modified topic, because it '
|
'Could not save your modified topic, because it '
|
||||||
'already exists.'))
|
'already exists.'))
|
||||||
|
|
||||||
@ -369,14 +369,15 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
if self.manager.save_object(book):
|
if self.manager.save_object(book):
|
||||||
self.resetBooks()
|
self.resetBooks()
|
||||||
else:
|
else:
|
||||||
criticalErrorMessageBox(self,
|
criticalErrorMessageBox(
|
||||||
translate('SongsPlugin.SongMaintenanceForm',
|
message=translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif criticalErrorMessageBox(self,
|
elif criticalErrorMessageBox(
|
||||||
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
message=unicode(translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'The book %s already exists. Would you like to make songs '
|
'The book %s already exists. Would you like to make songs '
|
||||||
'with book %s use the existing book %s?')) % (book.name,
|
'with book %s use the existing book %s?')) % (book.name,
|
||||||
temp_name, book.name), True) == QtGui.QMessageBox.Yes:
|
temp_name, book.name),
|
||||||
|
question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.mergeBooks(book)
|
self.mergeBooks(book)
|
||||||
self.resetBooks()
|
self.resetBooks()
|
||||||
else:
|
else:
|
||||||
|
@ -49,7 +49,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if not self.nameEdit.text():
|
if not self.nameEdit.text():
|
||||||
criticalErrorMessageBox(self, translate('SongsPlugin.TopicsForm',
|
criticalErrorMessageBox(message=translate('SongsPlugin.TopicsForm',
|
||||||
'You need to type in a topic name.'))
|
'You need to type in a topic name.'))
|
||||||
self.nameEdit.setFocus()
|
self.nameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user