openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #05599
[Merge] lp:~meths/openlp/testing into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/testing into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~meths/openlp/testing/+merge/46390
Refactor error messages. Although there is a small coding benefit to this the bigger benefit is to allow smaller/deduplicated translation files.
--
https://code.launchpad.net/~meths/openlp/testing/+merge/46390
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2011-01-10 10:21:39 +0000
+++ openlp/core/ui/__init__.py 2011-01-15 19:49:35 +0000
@@ -26,6 +26,9 @@
"""
The :mod:`ui` module provides the core user interface for OpenLP
"""
+from PyQt4 import QtGui
+
+from openlp.core.lib import translate, Receiver
class HideMode(object):
"""
@@ -48,6 +51,34 @@
Theme = 2
Screen = 3
+
+def criticalErrorMessageBox(title=None, message=None, parent=None,
+ question=False):
+ """
+ Provides a standard critical message box for errors that OpenLP displays
+ to users.
+
+ ``title``
+ The title for the message box.
+
+ ``message``
+ The message to display to the user.
+
+ ``parent``
+ The parent UI element to attach the dialog to.
+
+ ``question``
+ Should this message box question the user.
+ """
+ error = translate('OpenLP.Ui', 'Error')
+ if question:
+ return QtGui.QMessageBox.critical(parent, error, message,
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
+ 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 filerenameform import FileRenameForm
from maindisplay import MainDisplay
@@ -68,6 +99,6 @@
from servicemanager import ServiceManager
from thememanager import ThemeManager
-__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
- 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
- 'MediaDockManager', 'ServiceItemEditForm']
+__all__ = ['criticalErrorMessageBox', 'SplashScreen', 'AboutForm',
+ 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager',
+ 'ThemeManager', 'MediaDockManager', 'ServiceItemEditForm']
=== modified file 'openlp/core/ui/displaytagtab.py'
--- openlp/core/ui/displaytagtab.py 2011-01-10 19:07:09 +0000
+++ openlp/core/ui/displaytagtab.py 2011-01-15 19:49:35 +0000
@@ -34,6 +34,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, DisplayTags
+from openlp.core.ui import criticalErrorMessageBox
class DisplayTagTab(SettingsTab):
'''
@@ -275,12 +276,10 @@
"""
for html in DisplayTags.get_html_tags():
if self._strip(html[u'start tag']) == u'n':
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.DisplayTagTab', 'Update Error'),
translate('OpenLP.DisplayTagTab',
- 'Tag "n" already defined.'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
- QtGui.QMessageBox.Ok)
+ 'Tag "n" already defined.'))
return
# Add new tag to list
tag = {u'desc': u'New Item', u'start tag': u'{n}',
@@ -318,12 +317,10 @@
for linenumber, html1 in enumerate(html_expands):
if self._strip(html1[u'start tag']) == tag and \
linenumber != self.selected:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.DisplayTagTab', 'Update Error'),
unicode(translate('OpenLP.DisplayTagTab',
- 'Tag %s already defined.')) % tag,
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
- QtGui.QMessageBox.Ok)
+ 'Tag %s already defined.')) % tag)
return
html[u'desc'] = unicode(self.descriptionLineEdit.text())
html[u'start html'] = unicode(self.startTagLineEdit.text())
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-01-14 18:58:47 +0000
+++ openlp/core/ui/servicemanager.py 2011-01-15 19:49:35 +0000
@@ -36,9 +36,15 @@
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
ThemeLevel
+<<<<<<< TREE
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
split_filename
+=======
+from openlp.core.ui import criticalErrorMessageBox, ServiceNoteForm, \
+ ServiceItemEditForm
+from openlp.core.utils import AppLocation, file_is_unicode, split_filename
+>>>>>>> MERGE-SOURCE
class ServiceManagerList(QtGui.QTreeWidget):
"""
@@ -483,11 +489,10 @@
for file in zip.namelist():
ucsfile = file_is_unicode(file)
if not ucsfile:
- QtGui.QMessageBox.critical(
- self, translate('OpenLP.ServiceManager', 'Error'),
- translate('OpenLP.ServiceManager',
- 'File is not a valid service.\n'
- 'The content encoding is not UTF-8.'))
+ criticalErrorMessageBox(
+ message=translate('OpenLP.ServiceManager',
+ 'File is not a valid service.\n'
+ 'The content encoding is not UTF-8.'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
filePath = os.path.join(self.servicePath,
@@ -514,10 +519,9 @@
serviceItem.name.lower(), serviceItem)
delete_file(p_file)
else:
- QtGui.QMessageBox.critical(
- self, translate('OpenLP.ServiceManager', 'Error'),
- translate('OpenLP.ServiceManager',
- 'File is not a valid service.'))
+ criticalErrorMessageBox(
+ message=translate('OpenLP.ServiceManager',
+ 'File is not a valid service.'))
log.exception(u'File contains no service data')
except (IOError, NameError):
log.exception(u'Problem loading a service file')
@@ -993,7 +997,7 @@
self.mainwindow.previewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
else:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Your item cannot be '
'displayed as there is no handler to display it'))
@@ -1027,11 +1031,11 @@
self.serviceItems[item][u'service_item'], 0)
self.mainwindow.liveController.PreviewListWidget.setFocus()
else:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Your item cannot be '
- 'displayed as the plugin required to display it is missing '
- 'or inactive'))
+ 'displayed as the plugin required to display it is missing '
+ 'or inactive'))
def remoteEdit(self):
"""
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2011-01-10 16:59:45 +0000
+++ openlp/core/ui/themeform.py 2011-01-15 19:49:35 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
Receiver
+from openlp.core.ui import criticalErrorMessageBox
from openlp.core.utils import get_images_filter
from themewizard import Ui_ThemeWizard
@@ -567,20 +568,16 @@
self.theme.theme_name = \
unicode(self.field(u'name').toString())
if not self.theme.theme_name:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
translate('OpenLP.ThemeForm',
- 'There is no name for this theme. Please enter one.'),
- (QtGui.QMessageBox.Ok),
- QtGui.QMessageBox.Ok)
+ 'There is no name for this theme. Please enter one.'))
return
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',
- 'Invalid theme name. Please enter one.'),
- (QtGui.QMessageBox.Ok),
- QtGui.QMessageBox.Ok)
+ 'Invalid theme name. Please enter one.'))
return
saveFrom = None
saveTo = None
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2011-01-15 12:28:49 +0000
+++ openlp/core/ui/thememanager.py 2011-01-15 19:49:35 +0000
@@ -32,7 +32,7 @@
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
-from openlp.core.ui import FileRenameForm, ThemeForm
+from openlp.core.ui import criticalErrorMessageBox, FileRenameForm, ThemeForm
from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
@@ -359,9 +359,7 @@
"""
item = self.themeListWidget.currentItem()
if item is None:
- QtGui.QMessageBox.critical(self,
- translate('OpenLP.ThemeManager', 'Error'),
- translate('OpenLP.ThemeManager',
+ criticalErrorMessageBox(message=translate('OpenLP.ThemeManager',
'You have not selected a theme.'))
return
theme = unicode(item.data(QtCore.Qt.UserRole).toString())
@@ -388,10 +386,10 @@
'Your theme has been successfully exported.'))
except (IOError, OSError):
log.exception(u'Export Theme Failed')
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('OpenLP.ThemeManager', 'Theme Export Failed'),
translate('OpenLP.ThemeManager',
- 'Your theme could not be exported due to an error.'))
+ 'Your theme could not be exported due to an error.'))
finally:
if zip:
zip.close()
@@ -498,11 +496,10 @@
for file in zip.namelist():
ucsfile = file_is_unicode(file)
if not ucsfile:
- QtGui.QMessageBox.critical(
- self, translate('OpenLP.ThemeManager', 'Error'),
- translate('OpenLP.ThemeManager',
- 'File is not a valid theme.\n'
- 'The content encoding is not UTF-8.'))
+ criticalErrorMessageBox(
+ message=translate('OpenLP.ThemeManager',
+ 'File is not a valid theme.\n'
+ 'The content encoding is not UTF-8.'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
theme_dir = None
@@ -534,19 +531,17 @@
theme = self._createThemeFromXml(filexml, self.path)
self.generateAndSaveImage(dir, themename, theme)
else:
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('OpenLP.ThemeManager',
- 'Validation Error'),
- u'message':translate('OpenLP.ThemeManager',
- 'File is not a valid theme.')})
+ criticalErrorMessageBox(
+ translate('OpenLP.ThemeManager', 'Validation Error'),
+ translate('OpenLP.ThemeManager',
+ 'File is not a valid theme.'))
log.exception(u'Theme file does not contain XML data %s' %
filename)
except (IOError, NameError):
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('OpenLP.ThemeManager',
- 'Validation Error'),
- u'message':translate('OpenLP.ThemeManager',
- 'File is not a valid theme.')})
+ criticalErrorMessageBox(
+ translate('OpenLP.ThemeManager', 'Validation Error'),
+ translate('OpenLP.ThemeManager',
+ 'File is not a valid theme.'))
log.exception(u'Importing theme from zip failed %s' % filename)
finally:
if zip:
@@ -563,11 +558,10 @@
"""
theme_dir = os.path.join(self.path, themeName)
if os.path.exists(theme_dir):
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('OpenLP.ThemeManager',
- 'Validation Error'),
- u'message':translate('OpenLP.ThemeManager',
- 'A theme with this name already exists.')})
+ criticalErrorMessageBox(
+ translate('OpenLP.ThemeManager', 'Validation Error'),
+ translate('OpenLP.ThemeManager',
+ 'A theme with this name already exists.'))
return False
return True
@@ -694,21 +688,19 @@
return False
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
- QtGui.QMessageBox.critical(self,
- translate('OpenLP.ThemeManager', 'Error'),
- translate('OpenLP.ThemeManager',
- 'You are unable to delete the default theme.'))
+ criticalErrorMessageBox(
+ message=translate('OpenLP.ThemeManager',
+ 'You are unable to delete the default theme.'))
return False
# check for use in the system else where.
if testPlugin:
for plugin in self.mainwindow.pluginManager.plugins:
if plugin.usesTheme(theme):
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('OpenLP.ThemeManager',
+ criticalErrorMessageBox(translate('OpenLP.ThemeManager',
'Validation Error'),
- u'message': unicode(translate('OpenLP.ThemeManager',
+ unicode(translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \
- (theme, plugin.name)})
+ (theme, plugin.name))
return False
return True
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2011-01-15 19:49:35 +0000
@@ -35,6 +35,7 @@
from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.lib.db import delete_database
+from openlp.core.ui import criticalErrorMessageBox
from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat
@@ -468,7 +469,7 @@
elif self.currentPage() == self.selectPage:
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if not self.field(u'osis_location').toString():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
@@ -478,7 +479,7 @@
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if not self.field(u'csv_booksfile').toString():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm',
@@ -487,7 +488,7 @@
self.csvBooksEdit.setFocus()
return False
elif not self.field(u'csv_versefile').toString():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm',
@@ -498,7 +499,7 @@
elif self.field(u'source_format').toInt()[0] == \
BibleFormat.OpenSong:
if not self.field(u'opensong_file').toString():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm',
@@ -508,7 +509,7 @@
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
if not self.field(u'openlp1_location').toString():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
@@ -522,7 +523,7 @@
license_copyright = \
unicode(self.field(u'license_copyright').toString())
if not license_version:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm',
@@ -530,7 +531,7 @@
self.versionNameEdit.setFocus()
return False
elif not license_copyright:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm',
'Empty Copyright'),
translate('BiblesPlugin.ImportWizardForm',
@@ -539,7 +540,7 @@
self.copyrightEdit.setFocus()
return False
elif self.manager.exists(license_version):
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists. Please import '
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2011-01-06 20:48:22 +0000
+++ openlp/plugins/bibles/lib/db.py 2011-01-15 19:49:35 +0000
@@ -33,8 +33,9 @@
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
-from openlp.core.lib import Receiver, translate
+from openlp.core.lib import translate
from openlp.core.lib.db import BaseModel, init_db, Manager
+from openlp.core.ui import criticalErrorMessageBox
log = logging.getLogger(__name__)
@@ -354,12 +355,11 @@
verse_list.extend(verses)
else:
log.debug(u'OpenLP failed to find book %s', book)
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('BiblesPlugin', 'No Book Found'),
- u'message': translate('BiblesPlugin', 'No matching book '
+ criticalErrorMessageBox(
+ translate('BiblesPlugin', 'No Book Found'),
+ translate('BiblesPlugin', 'No matching book '
'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
def verse_search(self, text):
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/bibles/lib/http.py 2011-01-15 19:49:35 +0000
@@ -38,6 +38,7 @@
from BeautifulSoup import BeautifulSoup, NavigableString
from openlp.core.lib import Receiver, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.core.utils import AppLocation, get_web_page
from openlp.plugins.bibles.lib import SearchResults
from openlp.plugins.bibles.lib.db import BibleDB, Book
@@ -429,12 +430,11 @@
if not db_book:
book_details = HTTPBooks.get_book(book)
if not book_details:
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('BiblesPlugin', 'No Book Found'),
- u'message': translate('BiblesPlugin', 'No matching '
+ criticalErrorMessageBox(
+ translate('BiblesPlugin', 'No Book Found'),
+ translate('BiblesPlugin', 'No matching '
'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 []
db_book = self.create_book(book_details[u'name'],
book_details[u'abbreviation'],
@@ -540,17 +540,15 @@
The type of error that occured for the issue.
"""
if error_type == u'download':
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
- u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ criticalErrorMessageBox(
+ translate('BiblePlugin.HTTPBible', 'Download Error'),
+ translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
- 'please consider reporting a bug.')
- })
+ 'please consider reporting a bug.'))
elif error_type == u'parse':
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
- u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ criticalErrorMessageBox(
+ translate('BiblePlugin.HTTPBible', 'Parse Error'),
+ translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error continues '
- 'to occur please consider reporting a bug.')
- })
+ 'to occur please consider reporting a bug.'))
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2011-01-15 12:14:24 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2011-01-15 19:49:35 +0000
@@ -30,6 +30,7 @@
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
ItemCapabilities, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib import get_reference_match
@@ -389,11 +390,8 @@
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
if verse_count == 0:
self.advancedSearchButton.setEnabled(False)
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('BiblePlugin.MediaItem', 'Error'),
- u'message': translate('BiblePlugin.MediaItem',
- 'Bible not fully loaded')
- })
+ criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem',
+ 'Bible not fully loaded'))
else:
self.advancedSearchButton.setEnabled(True)
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
@@ -534,13 +532,11 @@
if item_second_bible and second_bible or not item_second_bible and \
not second_bible:
self.displayResults(bible, second_bible)
- elif QtGui.QMessageBox.critical(self,
- translate('BiblePlugin.MediaItem', 'Error'),
- translate('BiblePlugin.MediaItem', 'You cannot combine single '
- 'and second bible verses. Do you want to delete your search '
- 'results and start a new search?'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
- QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
+ elif criticalErrorMessageBox(
+ message=translate('BiblePlugin.MediaItem',
+ 'You cannot combine single and second bible verses. Do you '
+ 'want to delete your search results and start a new search?'),
+ question=True) == QtGui.QMessageBox.Yes:
self.listView.clear()
self.displayResults(bible, second_bible)
else:
@@ -584,13 +580,11 @@
if item_second_bible and second_bible or not item_second_bible and \
not second_bible:
self.displayResults(bible, second_bible)
- elif QtGui.QMessageBox.critical(self,
- translate('BiblePlugin.MediaItem', 'Error'),
- translate('BiblePlugin.MediaItem', 'You cannot combine single '
- 'and second bible verses. Do you want to delete your search '
- 'results and start a new search?'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
- QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
+ elif criticalErrorMessageBox(
+ message=translate('BiblePlugin.MediaItem',
+ 'You cannot combine single and second bible verses. Do you '
+ 'want to delete your search results and start a new search?'),
+ question=True) == QtGui.QMessageBox.Yes:
self.listView.clear()
self.displayResults(bible, second_bible)
elif self.search_results:
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2010-12-26 11:04:47 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2011-01-15 19:49:35 +0000
@@ -29,6 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
from editcustomdialog import Ui_CustomEditDialog
@@ -151,8 +152,7 @@
"""
valid, message = self._validate()
if not valid:
- QtGui.QMessageBox.critical(self,
- translate('CustomPlugin.EditCustomForm', 'Error'), message)
+ criticalErrorMessageBox(message=message)
return False
sxml = CustomXMLBuilder()
sxml.new_document()
@@ -265,4 +265,4 @@
if self.slideListView.count() == 0:
return False, translate('CustomPlugin.EditCustomForm',
'You need to add at least one slide')
- return True, u''
\ No newline at end of file
+ return True, u''
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2011-01-14 18:58:47 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2011-01-15 19:49:35 +0000
@@ -31,8 +31,14 @@
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \
+<<<<<<< TREE
Receiver, check_directory_exists
from openlp.core.utils import AppLocation, delete_file, get_images_filter
+=======
+ check_directory_exists
+from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.utils import AppLocation, get_images_filter
+>>>>>>> MERGE-SOURCE
log = logging.getLogger(__name__)
@@ -160,7 +166,7 @@
items.remove(item)
# We cannot continue, as all images do not exist.
if not items:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
unicode(translate('ImagePlugin.MediaItem',
'The following image(s) no longer exist: %s')) %
@@ -204,12 +210,11 @@
self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
else:
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('ImagePlugin.MediaItem',
- 'Live Background Error'),
- u'message': unicode(translate('ImagePlugin.MediaItem',
+ criticalErrorMessageBox(
+ translate('ImagePlugin.MediaItem', 'Live Background Error'),
+ unicode(translate('ImagePlugin.MediaItem',
'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):
MediaManagerItem.onPreviewClick(self)
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2011-01-06 23:47:28 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2011-01-15 19:49:35 +0000
@@ -30,8 +30,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
- ItemCapabilities, SettingsManager, translate, check_item_selected, \
- Receiver
+ ItemCapabilities, SettingsManager, translate, check_item_selected
+from openlp.core.ui import criticalErrorMessageBox
log = logging.getLogger(__name__)
@@ -106,12 +106,11 @@
self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
else:
- Receiver.send_message(u'openlp_error_message', {
- u'title': translate('MediaPlugin.MediaItem',
+ criticalErrorMessageBox(translate('MediaPlugin.MediaItem',
'Live Background Error'),
- u'message': unicode(translate('MediaPlugin.MediaItem',
+ unicode(translate('MediaPlugin.MediaItem',
'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):
if item is None:
@@ -131,9 +130,8 @@
return True
else:
# File is no longer present
- QtGui.QMessageBox.critical(
- self, translate('MediaPlugin.MediaItem',
- 'Missing Media File'),
+ criticalErrorMessageBox(
+ translate('MediaPlugin.MediaItem', 'Missing Media File'),
unicode(translate('MediaPlugin.MediaItem',
'The file %s no longer exists.')) % filename)
return False
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2011-01-09 15:37:45 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2011-01-15 19:49:35 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__)
@@ -180,7 +181,7 @@
filename = os.path.split(unicode(file))[1]
if titles.count(filename) > 0:
if not initialLoad:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('PresentationPlugin.MediaItem',
'File Exists'),
translate('PresentationPlugin.MediaItem',
@@ -204,7 +205,7 @@
if initialLoad:
icon = build_icon(u':/general/general_delete.png')
else:
- QtGui.QMessageBox.critical(
+ criticalErrorMessageBox(
self, translate('PresentationPlugin.MediaItem',
'Unsupported File'),
translate('PresentationPlugin.MediaItem',
@@ -275,8 +276,8 @@
return True
else:
# File is no longer present
- QtGui.QMessageBox.critical(
- self, translate('PresentationPlugin.MediaItem',
+ criticalErrorMessageBox(
+ translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate('PresentationPlugin.MediaItem',
'The Presentation %s no longer exists.')) % filename)
=== modified file 'openlp/plugins/songs/forms/authorsform.py'
--- openlp/plugins/songs/forms/authorsform.py 2011-01-04 21:06:50 +0000
+++ openlp/plugins/songs/forms/authorsform.py 2011-01-15 19:49:35 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtGui, QtCore
from openlp.core.lib import translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
@@ -79,28 +80,21 @@
def accept(self):
if not self.firstNameEdit.text():
- QtGui.QMessageBox.critical(
- self, translate('SongsPlugin.AuthorsForm', 'Error'),
- translate('SongsPlugin.AuthorsForm',
- 'You need to type in the first name of the author.'))
+ criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
+ 'You need to type in the first name of the author.'))
self.firstNameEdit.setFocus()
return False
elif not self.lastNameEdit.text():
- QtGui.QMessageBox.critical(
- self, translate('SongsPlugin.AuthorsForm', 'Error'),
- translate('SongsPlugin.AuthorsForm',
- 'You need to type in the last name of the author.'))
+ criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
+ 'You need to type in the last name of the author.'))
self.lastNameEdit.setFocus()
return False
elif not self.displayEdit.text():
- if QtGui.QMessageBox.critical(
- self, translate('SongsPlugin.AuthorsForm', 'Error'),
- translate('SongsPlugin.AuthorsForm',
- 'You have not set a display name for the '
- 'author, combine the first and last names?'),
- QtGui.QMessageBox.StandardButtons(
- QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
- ) == QtGui.QMessageBox.Yes:
+ if criticalErrorMessageBox(
+ message=translate('SongsPlugin.AuthorsForm',
+ 'You have not set a display name for the '
+ 'author, combine the first and last names?'),
+ question=True) == QtGui.QMessageBox.Yes:
self.displayEdit.setText(self.firstNameEdit.text() + \
u' ' + self.lastNameEdit.text())
return QtGui.QDialog.accept(self)
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2011-01-14 21:37:32 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2011-01-15 19:49:35 +0000
@@ -30,6 +30,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.forms import EditVerseForm
from openlp.plugins.songs.lib import SongXML, VerseType
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
@@ -346,10 +347,9 @@
author = self.manager.get_object(Author, item_id)
if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly):
- QtGui.QMessageBox.warning(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- translate('SongsPlugin.EditSongForm', 'This author is '
- 'already in the list.'))
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
+ 'This author is already in the list.'))
else:
author_item = QtGui.QListWidgetItem(unicode(
author.display_name))
@@ -400,10 +400,9 @@
topic = self.manager.get_object(Topic, item_id)
if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly):
- QtGui.QMessageBox.warning(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- translate('SongsPlugin.EditSongForm', 'This topic is '
- 'already in the list.'))
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
+ 'This topic is already in the list.'))
else:
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole,
@@ -533,25 +532,22 @@
if len(self.titleEdit.displayText()) == 0:
self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setFocus()
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- translate('SongsPlugin.EditSongForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
'You need to type in a song title.'))
return False
if self.verseListWidget.rowCount() == 0:
self.songTabWidget.setCurrentIndex(0)
self.verseListWidget.setFocus()
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- translate('SongsPlugin.EditSongForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
'You need to type in at least one verse.'))
return False
if self.authorsListView.count() == 0:
self.songTabWidget.setCurrentIndex(1)
self.authorsListView.setFocus()
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.EditSongForm', 'Warning'),
- translate('SongsPlugin.EditSongForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
'You need to have an author for this song.'))
return False
if self.song.verse_order:
@@ -578,9 +574,8 @@
valid = verses.pop(0)
for verse in verses:
valid = valid + u', ' + verse
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- unicode(translate('SongsPlugin.EditSongForm',
+ criticalErrorMessageBox(
+ message=unicode(translate('SongsPlugin.EditSongForm',
'The verse order is invalid. There is no verse '
'corresponding to %s. Valid entries are %s.')) % \
(order_names[count], valid))
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2011-01-04 21:06:50 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2011-01-15 19:49:35 +0000
@@ -29,6 +29,7 @@
from PyQt4 import QtCore, QtGui
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.lib import VerseType, translate
from editversedialog import Ui_EditVerseDialog
@@ -167,9 +168,8 @@
else:
value = self.getVerse()[0].split(u'\n')[1]
if len(value) == 0:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.EditSongForm', 'Error'),
- translate('SongsPlugin.EditSongForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.'))
return False
QtGui.QDialog.accept(self)
=== modified file 'openlp/plugins/songs/forms/songbookform.py'
--- openlp/plugins/songs/forms/songbookform.py 2011-01-04 21:06:50 +0000
+++ openlp/plugins/songs/forms/songbookform.py 2011-01-15 19:49:35 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtGui
from openlp.core.lib import translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.forms.songbookdialog import Ui_SongBookDialog
class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
@@ -49,10 +50,9 @@
def accept(self):
if not self.nameEdit.text():
- QtGui.QMessageBox.critical(
- self, translate('SongsPlugin.SongBookForm', 'Error'),
- translate('SongsPlugin.SongBookForm',
- 'You need to type in a name for the book.'))
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongBookForm',
+ 'You need to type in a name for the book.'))
self.nameEdit.setFocus()
return False
else:
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2011-01-15 19:49:35 +0000
@@ -32,6 +32,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.core.ui.wizard import OpenLPWizard
from openlp.plugins.songs.lib.importer import SongFormat
@@ -325,7 +326,7 @@
source_format = self.formatComboBox.currentIndex()
if source_format == SongFormat.OpenLP2:
if self.openLP2FilenameEdit.text().isEmpty():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No OpenLP 2.0 Song Database Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -335,7 +336,7 @@
return False
elif source_format == SongFormat.OpenLP1:
if self.openLP1FilenameEdit.text().isEmpty():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No openlp.org 1.x Song Database Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -345,7 +346,7 @@
return False
elif source_format == SongFormat.OpenLyrics:
if self.openLyricsFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -355,7 +356,7 @@
return False
elif source_format == SongFormat.OpenSong:
if self.openSongFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -365,7 +366,7 @@
return False
elif source_format == SongFormat.WordsOfWorship:
if self.wordsOfWorshipFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No Words of Worship Files Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -375,7 +376,7 @@
return False
elif source_format == SongFormat.CCLI:
if self.ccliFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -385,7 +386,7 @@
return False
elif source_format == SongFormat.SongsOfFellowship:
if self.songsOfFellowshipFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No Songs of Fellowship File Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -395,7 +396,7 @@
return False
elif source_format == SongFormat.Generic:
if self.genericFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No Document/Presentation Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -405,7 +406,7 @@
return False
elif source_format == SongFormat.EasyWorship:
if self.ewFilenameEdit.text().isEmpty():
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No EasyWorship Song Database Selected'),
translate('SongsPlugin.ImportWizardForm',
@@ -415,7 +416,7 @@
return False
elif source_format == SongFormat.SongBeamer:
if self.songBeamerFileListWidget.count() == 0:
- QtGui.QMessageBox.critical(self,
+ criticalErrorMessageBox(
translate('SongsPlugin.ImportWizardForm',
'No SongBeamer File Selected'),
translate('SongsPlugin.ImportWizardForm',
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2011-01-05 17:17:22 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2011-01-15 19:49:35 +0000
@@ -23,15 +23,19 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
+import logging
from PyQt4 import QtGui, QtCore
from sqlalchemy.sql import and_
from openlp.core.lib import Receiver, translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
from songmaintenancedialog import Ui_SongMaintenanceDialog
+log = logging.getLogger(__name__)
+
class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Class documentation goes here.
@@ -87,15 +91,14 @@
if item_id != -1:
item = self.manager.get_object(item_class, item_id)
if item and len(item.songs) == 0:
- if QtGui.QMessageBox.warning(self, dlg_title, del_text,
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
- QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
+ if criticalErrorMessageBox(title=dlg_title, message=del_text,
+ question=True) == QtGui.QMessageBox.Yes:
self.manager.delete_object(item_class, item.id)
reset_func()
else:
- QtGui.QMessageBox.critical(self, dlg_title, err_text)
+ criticalErrorMessageBox(dlg_title, err_text)
else:
- QtGui.QMessageBox.critical(self, dlg_title, sel_text)
+ criticalErrorMessageBox(dlg_title, sel_text)
def resetAuthors(self):
"""
@@ -229,14 +232,12 @@
if self.manager.save_object(author):
self.resetAuthors()
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your author.'))
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'This author already exists.'))
def onTopicAddButtonClick(self):
@@ -246,14 +247,12 @@
if self.manager.save_object(topic):
self.resetTopics()
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your topic.'))
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'This topic already exists.'))
def onBookAddButtonClick(self):
@@ -264,14 +263,12 @@
if self.manager.save_object(book):
self.resetBooks()
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your book.'))
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'This book already exists.'))
def onAuthorEditButtonClick(self):
@@ -298,20 +295,15 @@
self.resetAuthors()
Receiver.send_message(u'songs_load_list')
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm',
- 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.'))
- elif QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- unicode(translate('SongsPlugin.SongMaintenanceForm',
- 'The author %s already exists. Would you like to make songs'
- ' with author %s use the existing author %s?')) %
- (author.display_name, temp_display_name,
- author.display_name), QtGui.QMessageBox.StandardButtons(
- QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
- QtGui.QMessageBox.Yes:
+ elif criticalErrorMessageBox(message=unicode(translate(
+ 'SongsPlugin.SongMaintenanceForm', 'The author %s already '
+ 'exists. Would you like to make songs with author %s use '
+ 'the existing author %s?')) % (author.display_name,
+ temp_display_name, author.display_name),
+ question=True) == QtGui.QMessageBox.Yes:
self.mergeAuthors(author)
self.resetAuthors()
Receiver.send_message(u'songs_load_list')
@@ -321,9 +313,8 @@
author.first_name = temp_first_name
author.last_name = temp_last_name
author.display_name = temp_display_name
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your modified author, because the '
'author already exists.'))
@@ -340,27 +331,22 @@
if self.manager.save_object(topic):
self.resetTopics()
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm',
- 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.'))
- elif QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- unicode(translate('SongsPlugin.SongMaintenanceForm',
+ elif criticalErrorMessageBox(
+ message=unicode(translate('SongsPlugin.SongMaintenanceForm',
'The topic %s already exists. Would you like to make songs '
'with topic %s use the existing topic %s?')) % (topic.name,
- temp_name, topic.name), QtGui.QMessageBox.StandardButtons(
- QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
- QtGui.QMessageBox.Yes:
+ temp_name, topic.name),
+ question=True) == QtGui.QMessageBox.Yes:
self.mergeTopics(topic)
self.resetTopics()
else:
# We restore the topics's old name.
topic.name = temp_name
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your modified topic, because it '
'already exists.'))
@@ -383,19 +369,15 @@
if self.manager.save_object(book):
self.resetBooks()
else:
- QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm',
- 'Error'),
- translate('SongsPlugin.SongMaintenanceForm',
+ criticalErrorMessageBox(
+ message=translate('SongsPlugin.SongMaintenanceForm',
'Could not save your changes.'))
- elif QtGui.QMessageBox.critical(self,
- translate('SongsPlugin.SongMaintenanceForm', 'Error'),
- unicode(translate('SongsPlugin.SongMaintenanceForm',
+ elif criticalErrorMessageBox(
+ message=unicode(translate('SongsPlugin.SongMaintenanceForm',
'The book %s already exists. Would you like to make songs '
'with book %s use the existing book %s?')) % (book.name,
- temp_name, book.name), QtGui.QMessageBox.StandardButtons(
- QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
- QtGui.QMessageBox.Yes:
+ temp_name, book.name),
+ question=True) == QtGui.QMessageBox.Yes:
self.mergeBooks(book)
self.resetBooks()
else:
=== modified file 'openlp/plugins/songs/forms/topicsform.py'
--- openlp/plugins/songs/forms/topicsform.py 2011-01-04 21:06:50 +0000
+++ openlp/plugins/songs/forms/topicsform.py 2011-01-15 19:49:35 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtGui
from openlp.core.lib import translate
+from openlp.core.ui import criticalErrorMessageBox
from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog
class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
@@ -48,10 +49,8 @@
def accept(self):
if not self.nameEdit.text():
- QtGui.QMessageBox.critical(
- self, translate('SongsPlugin.TopicsForm', 'Error'),
- translate('SongsPlugin.TopicsForm',
- 'You need to type in a topic name.'))
+ criticalErrorMessageBox(message=translate('SongsPlugin.TopicsForm',
+ 'You need to type in a topic name.'))
self.nameEdit.setFocus()
return False
else:
Follow ups