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 '
'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):
"""

View File

@ -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):

View File

@ -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

View File

@ -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(

View File

@ -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()

View File

@ -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))

View File

@ -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():

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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)