Cleanup QMessageBoxes using defaults

This commit is contained in:
Jon Tibble 2010-07-31 03:06:44 +01:00
parent 8eb7fd4c30
commit c9edfb9508
12 changed files with 32 additions and 74 deletions

View File

@ -498,8 +498,7 @@ class ServiceManager(QtGui.QWidget):
'Your service is unsaved, do you want to save ' 'Your service is unsaved, do you want to save '
'those changes before creating a new one?'), 'those changes before creating a new one?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save) QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.onSaveService() self.onSaveService()
@ -656,8 +655,7 @@ class ServiceManager(QtGui.QWidget):
'Your current service is unsaved, do you want to ' 'Your current service is unsaved, do you want to '
'save the changes before opening a new one?'), 'save the changes before opening a new one?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Discard | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save) QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.onSaveService() self.onSaveService()
@ -802,7 +800,6 @@ class ServiceManager(QtGui.QWidget):
``item`` ``item``
Service Item to be added Service Item to be added
""" """
sitem = self.findServiceItem()[0] sitem = self.findServiceItem()[0]
item.render() item.render()
@ -847,10 +844,7 @@ class ServiceManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
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'))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getServiceItem(self): def getServiceItem(self):
""" """
@ -883,10 +877,7 @@ class ServiceManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
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'))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def remoteEdit(self): def remoteEdit(self):
""" """

View File

@ -235,8 +235,7 @@ class ThemeManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'), translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'), 'You are unable to delete the default theme.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else: else:
for plugin in self.parent.plugin_manager.plugins: for plugin in self.parent.plugin_manager.plugins:
if plugin.usesTheme(theme): if plugin.usesTheme(theme):

View File

@ -129,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Bible Location'), 'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your ' 'You need to specify a file to import your '
'Bible from.'), 'Bible from.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus() self.OSISLocationEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
@ -140,8 +139,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Books File'), 'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of ' 'You need to specify a file with books of '
'the Bible to use in the import.'), 'the Bible to use in the import.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus() self.BooksLocationEdit.setFocus()
return False return False
elif self.field(u'csv_versefile').toString() == u'': elif self.field(u'csv_versefile').toString() == u'':
@ -150,8 +148,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Verse File'), 'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible ' 'You need to specify a file of Bible '
'verses to import.'), 'verses to import.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus() self.CsvVerseLocationEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == \ elif self.field(u'source_format').toInt()[0] == \
@ -162,8 +159,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid OpenSong Bible'), 'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible ' 'You need to specify an OpenSong Bible '
'file to import.'), 'file to import.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus() self.OpenSongFileEdit.setFocus()
return False return False
return True return True
@ -178,8 +174,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Empty Version Name'), 'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your ' 'You need to specify a version name for your '
'Bible.'), 'Bible.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
elif license_copyright == u'': elif license_copyright == u'':
@ -189,8 +184,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible! ' 'You need to set a copyright for your Bible! '
'Bibles in the Public Domain need to be marked as ' 'Bibles in the Public Domain need to be marked as '
'such.'), 'such.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus() self.CopyrightEdit.setFocus()
return False return False
elif self.manager.exists(license_version): elif self.manager.exists(license_version):
@ -199,8 +193,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Bible Exists'), 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists! Please import ' 'This Bible already exists! Please import '
'a different Bible or first delete the existing one.'), 'a different Bible or first delete the existing one.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
return True return True

View File

@ -387,10 +387,7 @@ class BibleMediaItem(MediaManagerItem):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.MediaItem', 'No Book Found'), translate('BiblesPlugin.MediaItem', 'No Book Found'),
translate('BiblesPlugin.MediaItem', translate('BiblesPlugin.MediaItem',
'No matching book could be found in this Bible.'), 'No matching book could be found in this Bible.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok
)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
self.initialiseBible( self.initialiseBible(

View File

@ -151,8 +151,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
valid, message = self._validate() valid, message = self._validate()
if not valid: if not valid:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('CustomPlugin.EditCustomForm', 'Error'), message, translate('CustomPlugin.EditCustomForm', 'Error'), message)
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False return False
sxml = CustomXMLBuilder() sxml = CustomXMLBuilder()
sxml.new_document() sxml.new_document()

View File

@ -188,8 +188,7 @@ class PresentationMediaItem(MediaManagerItem):
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'File Exists'), 'File Exists'),
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'), 'A presentation with that filename already exists.'))
QtGui.QMessageBox.Ok)
continue continue
controller_name = self.findControllerByType(filename) controller_name = self.findControllerByType(filename)
if controller_name: if controller_name:
@ -213,8 +212,7 @@ class PresentationMediaItem(MediaManagerItem):
self, translate('PresentationPlugin.MediaItem', self, translate('PresentationPlugin.MediaItem',
'Unsupported File'), 'Unsupported File'),
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'This type of presentation is not supported'), 'This type of presentation is not supported'))
QtGui.QMessageBox.Ok)
continue continue
item_name = QtGui.QListWidgetItem(filename) item_name = QtGui.QListWidgetItem(filename)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))

View File

@ -82,16 +82,14 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', 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.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.FirstNameEdit.setFocus() self.FirstNameEdit.setFocus()
return False return False
elif not self.LastNameEdit.text(): elif not self.LastNameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', 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.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.LastNameEdit.setFocus() self.LastNameEdit.setFocus()
return False return False
elif not self.DisplayEdit.text(): elif not self.DisplayEdit.text():

View File

@ -331,8 +331,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
translate('SongsPlugin.EditSongForm', 'You have not selected ' translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid author. Either select an author from the list, ' 'a valid author. Either select an author from the list, '
'or type in a new author and click the "Add Author to ' 'or type in a new author and click the "Add Author to '
'Song" button to add the new author.'), 'Song" button to add the new author.'))
QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)
def onAuthorsListViewPressed(self): def onAuthorsListViewPressed(self):
if self.AuthorsListView.count() > 1: if self.AuthorsListView.count() > 1:
@ -389,8 +388,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
translate('SongsPlugin.EditSongForm', 'You have not selected ' translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid topic. Either select a topic from the list, or ' 'a valid topic. Either select a topic from the list, or '
'type in a new topic and click the "Add Topic to Song" ' 'type in a new topic and click the "Add Topic to Song" '
'button to add the new topic.'), 'button to add the new topic.'))
QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)
def onTopicListViewPressed(self): def onTopicListViewPressed(self):
self.TopicRemoveButton.setEnabled(True) self.TopicRemoveButton.setEnabled(True)

View File

@ -52,8 +52,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.SongBookForm', 'Error'), self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm', translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.'), 'You need to type in a name for the book.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus() self.NameEdit.setFocus()
return False return False
else: else:

View File

@ -109,8 +109,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No OpenLyrics Files Selected'), 'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenLyrics ' 'You need to add at least one OpenLyrics '
'song file to import from.'), 'song file to import from.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenLyricsAddButton.setFocus() self.OpenLyricsAddButton.setFocus()
return False return False
elif source_format == SongFormat.OpenSong: elif source_format == SongFormat.OpenSong:
@ -120,8 +119,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No OpenSong Files Selected'), 'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenSong ' 'You need to add at least one OpenSong '
'song file to import from.'), 'song file to import from.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongAddButton.setFocus() self.OpenSongAddButton.setFocus()
return False return False
elif source_format == SongFormat.CCLI: elif source_format == SongFormat.CCLI:
@ -131,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No CCLI Files Selected'), 'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one CCLI file ' 'You need to add at least one CCLI file '
'to import from.'), 'to import from.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CCLIAddButton.setFocus() self.CCLIAddButton.setFocus()
return False return False
elif source_format == SongFormat.CSV: elif source_format == SongFormat.CSV:
@ -141,8 +138,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No CSV File Selected'), 'No CSV File Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to specify a CSV file to import from.'), 'You need to specify a CSV file to import from.'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CSVFilenameEdit.setFocus() self.CSVFilenameEdit.setFocus()
return False return False
return True return True

View File

@ -51,8 +51,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.TopicsForm', 'Error'), self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm', translate('SongsPlugin.TopicsForm',
'You need to type in a topic name!'), 'You need to type in a topic name!'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus() self.NameEdit.setFocus()
return False return False
else: else:

View File

@ -198,15 +198,11 @@ class SongsPlugin(Plugin):
except: except:
log.exception('Could not import SoF file') log.exception('Could not import SoF file')
QtGui.QMessageBox.critical(None, QtGui.QMessageBox.critical(None,
translate('SongsPlugin', translate('SongsPlugin', 'Import Error'),
'Import Error'), translate('SongsPlugin', 'Error importing Songs of '
translate('SongsPlugin',
'Error importing Songs of '
'Fellowship file.\nOpenOffice.org must be installed' 'Fellowship file.\nOpenOffice.org must be installed'
' and you must be using an unedited copy of the RTF' ' and you must be using an unedited copy of the RTF'
' included with the Songs of Fellowship Music Editions'), ' included with the Songs of Fellowship Music Editions'))
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
Receiver.send_message(u'songs_load_list') Receiver.send_message(u'songs_load_list')
def onImportOpenSongItemClick(self): def onImportOpenSongItemClick(self):
@ -221,12 +217,8 @@ class SongsPlugin(Plugin):
except: except:
log.exception('Could not import OpenSong file') log.exception('Could not import OpenSong file')
QtGui.QMessageBox.critical(None, QtGui.QMessageBox.critical(None,
translate('SongsPlugin', translate('SongsPlugin', 'Import Error'),
'Import Error'), translate('SongsPlugin', 'Error importing OpenSong file'))
translate('SongsPlugin',
'Error importing OpenSong file'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
Receiver.send_message(u'songs_load_list') Receiver.send_message(u'songs_load_list')
def onImportOpenLPSongItemClick(self): def onImportOpenLPSongItemClick(self):
@ -250,8 +242,7 @@ class SongsPlugin(Plugin):
def onImportOooItemClick(self): def onImportOooItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames( filenames = QtGui.QFileDialog.getOpenFileNames(
None, translate('SongsPlugin', None, translate('SongsPlugin', 'Open documents or presentations'),
'Open documents or presentations'),
'', u'All Files(*.*)') '', u'All Files(*.*)')
oooimport = OooImport(self.manager) oooimport = OooImport(self.manager)
oooimport.import_docs(filenames) oooimport.import_docs(filenames)