From c9edfb95085aeb457098cb068898e7e73eb0cbbe Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 31 Jul 2010 03:06:44 +0100 Subject: [PATCH] Cleanup QMessageBoxes using defaults --- openlp/core/ui/servicemanager.py | 17 ++++----------- openlp/core/ui/thememanager.py | 3 +-- .../plugins/bibles/forms/importwizardform.py | 21 +++++++------------ openlp/plugins/bibles/lib/mediaitem.py | 5 +---- openlp/plugins/custom/forms/editcustomform.py | 3 +-- openlp/plugins/presentations/lib/mediaitem.py | 6 ++---- openlp/plugins/songs/forms/authorsform.py | 6 ++---- openlp/plugins/songs/forms/editsongform.py | 6 ++---- openlp/plugins/songs/forms/songbookform.py | 3 +-- openlp/plugins/songs/forms/songimportform.py | 12 ++++------- openlp/plugins/songs/forms/topicsform.py | 3 +-- openlp/plugins/songs/songsplugin.py | 21 ++++++------------- 12 files changed, 32 insertions(+), 74 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9c4e4f0f5..49f7607d5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -498,8 +498,7 @@ class ServiceManager(QtGui.QWidget): 'Your service is unsaved, do you want to save ' 'those changes before creating a new one?'), QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Cancel | - QtGui.QMessageBox.Save), + QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save), QtGui.QMessageBox.Save) if ret == QtGui.QMessageBox.Save: self.onSaveService() @@ -656,8 +655,7 @@ class ServiceManager(QtGui.QWidget): 'Your current service is unsaved, do you want to ' 'save the changes before opening a new one?'), QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Discard | - QtGui.QMessageBox.Save), + QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save), QtGui.QMessageBox.Save) if ret == QtGui.QMessageBox.Save: self.onSaveService() @@ -802,7 +800,6 @@ class ServiceManager(QtGui.QWidget): ``item`` Service Item to be added - """ sitem = self.findServiceItem()[0] item.render() @@ -847,10 +844,7 @@ class ServiceManager(QtGui.QWidget): QtGui.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager', 'Your item cannot be ' - 'displayed as there is no handler to display it'), - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok) + 'displayed as there is no handler to display it')) def getServiceItem(self): """ @@ -883,10 +877,7 @@ class ServiceManager(QtGui.QWidget): QtGui.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager', 'Your item cannot be ' - 'displayed as there is no handler to display it'), - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok) + 'displayed as there is no handler to display it')) def remoteEdit(self): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 760d8b059..d48926606 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -235,8 +235,7 @@ class ThemeManager(QtGui.QWidget): QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeManager', 'Error'), translate('OpenLP.ThemeManager', - 'You are unable to delete the default theme.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'You are unable to delete the default theme.')) else: for plugin in self.parent.plugin_manager.plugins: if plugin.usesTheme(theme): diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py index c955847c6..67f3756dc 100644 --- a/openlp/plugins/bibles/forms/importwizardform.py +++ b/openlp/plugins/bibles/forms/importwizardform.py @@ -129,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Invalid Bible Location'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file to import your ' - 'Bible from.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'Bible from.')) self.OSISLocationEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: @@ -140,8 +139,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Invalid Books File'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file with books of ' - 'the Bible to use in the import.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'the Bible to use in the import.')) self.BooksLocationEdit.setFocus() return False elif self.field(u'csv_versefile').toString() == u'': @@ -150,8 +148,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Invalid Verse File'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file of Bible ' - 'verses to import.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'verses to import.')) self.CsvVerseLocationEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == \ @@ -162,8 +159,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Invalid OpenSong Bible'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify an OpenSong Bible ' - 'file to import.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'file to import.')) self.OpenSongFileEdit.setFocus() return False return True @@ -178,8 +174,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Empty Version Name'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify a version name for your ' - 'Bible.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'Bible.')) self.VersionNameEdit.setFocus() return False elif license_copyright == u'': @@ -189,8 +184,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible! ' 'Bibles in the Public Domain need to be marked as ' - 'such.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'such.')) self.CopyrightEdit.setFocus() return False elif self.manager.exists(license_version): @@ -199,8 +193,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): 'Bible Exists'), translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists! Please import ' - 'a different Bible or first delete the existing one.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'a different Bible or first delete the existing one.')) self.VersionNameEdit.setFocus() return False return True diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index bc9c6d1c5..1c5243af4 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -387,10 +387,7 @@ class BibleMediaItem(MediaManagerItem): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.MediaItem', 'No Book Found'), translate('BiblesPlugin.MediaItem', - 'No matching book could be found in this Bible.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok - ) + 'No matching book could be found in this Bible.')) def onAdvancedVersionComboBox(self): self.initialiseBible( diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index a94e6fefa..910fe65e7 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -151,8 +151,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): valid, message = self._validate() if not valid: QtGui.QMessageBox.critical(self, - translate('CustomPlugin.EditCustomForm', 'Error'), message, - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + translate('CustomPlugin.EditCustomForm', 'Error'), message) return False sxml = CustomXMLBuilder() sxml.new_document() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 10f6b41e2..001aeac4d 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -188,8 +188,7 @@ class PresentationMediaItem(MediaManagerItem): translate('PresentationPlugin.MediaItem', 'File Exists'), translate('PresentationPlugin.MediaItem', - 'A presentation with that filename already exists.'), - QtGui.QMessageBox.Ok) + 'A presentation with that filename already exists.')) continue controller_name = self.findControllerByType(filename) if controller_name: @@ -213,8 +212,7 @@ class PresentationMediaItem(MediaManagerItem): self, translate('PresentationPlugin.MediaItem', 'Unsupported File'), translate('PresentationPlugin.MediaItem', - 'This type of presentation is not supported'), - QtGui.QMessageBox.Ok) + 'This type of presentation is not supported')) continue item_name = QtGui.QListWidgetItem(filename) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 5787d8de1..c7d1b0396 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -82,16 +82,14 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): QtGui.QMessageBox.critical( self, translate('SongsPlugin.AuthorsForm', 'Error'), translate('SongsPlugin.AuthorsForm', - 'You need to type in the first name of the author.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + '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.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'You need to type in the last name of the author.')) self.LastNameEdit.setFocus() return False elif not self.DisplayEdit.text(): diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 3e12b552b..1567fa62e 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -331,8 +331,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): translate('SongsPlugin.EditSongForm', 'You have not selected ' 'a valid author. Either select an author from the list, ' 'or type in a new author and click the "Add Author to ' - 'Song" button to add the new author.'), - QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok) + 'Song" button to add the new author.')) def onAuthorsListViewPressed(self): if self.AuthorsListView.count() > 1: @@ -389,8 +388,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): translate('SongsPlugin.EditSongForm', 'You have not selected ' 'a valid topic. Either select a topic from the list, or ' 'type in a new topic and click the "Add Topic to Song" ' - 'button to add the new topic.'), - QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok) + 'button to add the new topic.')) def onTopicListViewPressed(self): self.TopicRemoveButton.setEnabled(True) diff --git a/openlp/plugins/songs/forms/songbookform.py b/openlp/plugins/songs/forms/songbookform.py index 30c9f0fd1..bdec26dfe 100644 --- a/openlp/plugins/songs/forms/songbookform.py +++ b/openlp/plugins/songs/forms/songbookform.py @@ -52,8 +52,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog): QtGui.QMessageBox.critical( self, translate('SongsPlugin.SongBookForm', 'Error'), translate('SongsPlugin.SongBookForm', - 'You need to type in a name for the book.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'You need to type in a name for the book.')) self.NameEdit.setFocus() return False else: diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 879f6ce72..9524e8981 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -109,8 +109,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): 'No OpenLyrics Files Selected'), translate('SongsPlugin.ImportWizardForm', 'You need to add at least one OpenLyrics ' - 'song file to import from.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'song file to import from.')) self.OpenLyricsAddButton.setFocus() return False elif source_format == SongFormat.OpenSong: @@ -120,8 +119,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): 'No OpenSong Files Selected'), translate('SongsPlugin.ImportWizardForm', 'You need to add at least one OpenSong ' - 'song file to import from.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'song file to import from.')) self.OpenSongAddButton.setFocus() return False elif source_format == SongFormat.CCLI: @@ -131,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): 'No CCLI Files Selected'), translate('SongsPlugin.ImportWizardForm', 'You need to add at least one CCLI file ' - 'to import from.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'to import from.')) self.CCLIAddButton.setFocus() return False elif source_format == SongFormat.CSV: @@ -141,8 +138,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): translate('SongsPlugin.ImportWizardForm', 'No CSV File Selected'), translate('SongsPlugin.ImportWizardForm', - 'You need to specify a CSV file to import from.'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'You need to specify a CSV file to import from.')) self.CSVFilenameEdit.setFocus() return False return True diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index 79c160083..a618dd9db 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -51,8 +51,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): QtGui.QMessageBox.critical( self, translate('SongsPlugin.TopicsForm', 'Error'), translate('SongsPlugin.TopicsForm', - 'You need to type in a topic name!'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + 'You need to type in a topic name!')) self.NameEdit.setFocus() return False else: diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index ff285a18c..c09e7a1bb 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -198,15 +198,11 @@ class SongsPlugin(Plugin): except: log.exception('Could not import SoF file') QtGui.QMessageBox.critical(None, - translate('SongsPlugin', - 'Import Error'), - translate('SongsPlugin', - 'Error importing Songs of ' + translate('SongsPlugin', 'Import Error'), + translate('SongsPlugin', 'Error importing Songs of ' 'Fellowship file.\nOpenOffice.org must be installed' ' and you must be using an unedited copy of the RTF' - ' included with the Songs of Fellowship Music Editions'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok) + ' included with the Songs of Fellowship Music Editions')) Receiver.send_message(u'songs_load_list') def onImportOpenSongItemClick(self): @@ -221,12 +217,8 @@ class SongsPlugin(Plugin): except: log.exception('Could not import OpenSong file') QtGui.QMessageBox.critical(None, - translate('SongsPlugin', - 'Import Error'), - translate('SongsPlugin', - 'Error importing OpenSong file'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok) + translate('SongsPlugin', 'Import Error'), + translate('SongsPlugin', 'Error importing OpenSong file')) Receiver.send_message(u'songs_load_list') def onImportOpenLPSongItemClick(self): @@ -250,8 +242,7 @@ class SongsPlugin(Plugin): def onImportOooItemClick(self): filenames = QtGui.QFileDialog.getOpenFileNames( - None, translate('SongsPlugin', - 'Open documents or presentations'), + None, translate('SongsPlugin', 'Open documents or presentations'), '', u'All Files(*.*)') oooimport = OooImport(self.manager) oooimport.import_docs(filenames)