Mon, 30 Aug 2010 19:03:34 +0200
Streamlined the use of QMessageBox.
--- a/E5Gui/E5ToolBarDialog.py Mon Aug 30 15:28:21 2010 +0200 +++ b/E5Gui/E5ToolBarDialog.py Mon Aug 30 19:03:34 2010 +0200 @@ -129,9 +129,7 @@ QMessageBox.critical(self, self.trUtf8("New Toolbar"), self.trUtf8("""A toolbar with the name <b>{0}</b> already exists.""")\ - .format(name), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + .format(name)) return tbItem = E5ToolBarItem(None, [], False) @@ -190,9 +188,7 @@ QMessageBox.critical(self, self.trUtf8("Rename Toolbar"), self.trUtf8("""A toolbar with the name <b>{0}</b> already exists.""")\ - .format(newName), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + .format(newName)) return index = self.toolbarComboBox.currentIndex() self.toolbarComboBox.setItemText(index, newName)
--- a/Helpviewer/HelpBrowserWV.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Helpviewer/HelpBrowserWV.py Mon Aug 30 19:03:34 2010 +0200 @@ -481,9 +481,7 @@ QMessageBox.critical(None, self.trUtf8("Web Browser"), self.trUtf8("""<p>The file <b>{0}</b> does not exist.</p>""")\ - .format(name.toLocalFile()), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(name.toLocalFile())) return if name.toLocalFile().endswith(".pdf") or \
--- a/Helpviewer/HelpWindow.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Helpviewer/HelpWindow.py Mon Aug 30 19:03:34 2010 +0200 @@ -2053,10 +2053,10 @@ """ web pages you have opened.</p>""") res = QMessageBox.question(self, "", txt, QMessageBox.StandardButtons(\ - QMessageBox.Cancel | \ - QMessageBox.Ok), - QMessageBox.Ok) - if res == QMessageBox.Ok: + QMessageBox.Yes | \ + QMessageBox.No), + QMessageBox.No) + if res == QMessageBox.Yes: settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) self.pathCombo.setInsertPolicy(QComboBox.NoInsert) self.privacyLabel.setPixmap(
--- a/Helpviewer/History/HistoryMenu.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Helpviewer/History/HistoryMenu.py Mon Aug 30 19:03:34 2010 +0200 @@ -173,7 +173,7 @@ treeIndex = self.__treeModel.mapFromSource(historyIndex) treeIndexParent = treeIndex.parent() - soureRow = self.sourceModel().mapToSource(treeIndexParent).row() + sourceRow = self.sourceModel().mapToSource(treeIndexParent).row() bumpedItems = self.bumpedRows() if bumpedItems <= self.MOVEDROWS and \ bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)):
--- a/Helpviewer/QtHelpDocumentationDialog.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Helpviewer/QtHelpDocumentationDialog.py Mon Aug 30 19:03:34 2010 +0200 @@ -110,11 +110,12 @@ self.trUtf8("""Some documents currently opened reference the """ """documentation you are attempting to remove. """ """Removing the documentation will close those """ - """documents."""), + """documents. Remove anyway?"""), QMessageBox.StandardButtons(\ - QMessageBox.Cancel | \ - QMessageBox.Ok)) - if res == QMessageBox.Cancel: + QMessageBox.Yes | \ + QMessageBox.No), + QMessageBox.No) + if res == QMessageBox.No: return self.__unregisteredDocs.append(ns) for id in openedDocs:
--- a/PluginManager/PluginUninstallDialog.py Mon Aug 30 15:28:21 2010 +0200 +++ b/PluginManager/PluginUninstallDialog.py Mon Aug 30 19:03:34 2010 +0200 @@ -90,9 +90,7 @@ QMessageBox.critical(None, self.trUtf8("Plugin Uninstallation"), self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" - """ Aborting...</p>""").format(pluginName), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """ Aborting...</p>""").format(pluginName)) return False if not pluginDirectory in sys.path: @@ -102,9 +100,7 @@ QMessageBox.critical(None, self.trUtf8("Plugin Uninstallation"), self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" - """ Aborting...</p>""").format(pluginName), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """ Aborting...</p>""").format(pluginName)) return False package = getattr(module, "packageName") @@ -143,18 +139,14 @@ self.trUtf8("Plugin Uninstallation"), self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" """ removed. Aborting...</p>""" - """<p>Reason: {1}</p>""").format(packageDir, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {1}</p>""").format(packageDir, str(err))) return False QMessageBox.information(None, self.trUtf8("Plugin Uninstallation"), self.trUtf8("""<p>The plugin <b>{0}</b> was uninstalled successfully""" """ from {1}.</p>""")\ - .format(pluginName, pluginDirectory), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(pluginName, pluginDirectory)) return True class PluginUninstallDialog(QDialog):
--- a/Project/CreateDialogCodeDialog.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Project/CreateDialogCodeDialog.py Mon Aug 30 19:03:34 2010 +0200 @@ -88,9 +88,7 @@ QMessageBox.critical(None, self.trUtf8("Create Dialog Code"), self.trUtf8("""The file <b>{0}</b> exists but does not contain""" - """ any classes.""").format(self.srcFile), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + """ any classes.""").format(self.srcFile)) self.okButton.setEnabled(self.classNameCombo.count() > 0) @@ -117,9 +115,7 @@ QMessageBox.critical(self, self.trUtf8("uic error"), self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>{1}</p>""").format(self.formFile, str(err))) return "" def __className(self): @@ -135,9 +131,7 @@ QMessageBox.critical(self, self.trUtf8("uic error"), self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>{1}</p>""").format(self.formFile, str(err))) return "" def __signatures(self): @@ -266,9 +260,7 @@ QMessageBox.critical(self, self.trUtf8("uic error"), self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>{1}</p>""").format(self.formFile, str(err))) def __generateCode(self): """ @@ -311,9 +303,7 @@ self.trUtf8("Code Generation"), self.trUtf8("""<p>Could not open the code template file "{0}".</p>""" """<p>Reason: {1}</p>""")\ - .format(tmplName, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(tmplName, str(why))) return objName = self.__objectName() @@ -346,9 +336,7 @@ self.trUtf8("Code Generation"), self.trUtf8("""<p>Could not open the source file "{0}".</p>""" """<p>Reason: {1}</p>""")\ - .format(self.srcFile, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(self.srcFile, str(why))) return cls = self.__module.classes[self.classNameCombo.currentText()] @@ -407,9 +395,7 @@ self.trUtf8("Code Generation"), self.trUtf8("""<p>Could not write the source file "{0}".</p>""" """<p>Reason: {1}</p>""")\ - .format(self.filenameEdit.text(), str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(self.filenameEdit.text(), str(why))) return self.project.appendFile(self.filenameEdit.text())
--- a/Project/Project.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Project/Project.py Mon Aug 30 19:03:34 2010 +0200 @@ -1771,18 +1771,14 @@ self.trUtf8("Add file"), self.trUtf8("<p>The selected file <b>{0}</b> could not be" " added to <b>{1}</b>.</p><p>Reason: {2}</p>") - .format(fn, target, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + .format(fn, target, str(why))) return self.appendFile(targetfile, isSource or filter == 'source') else: QMessageBox.critical(None, self.trUtf8("Add file"), - self.trUtf8("The target directory must not be empty."), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + self.trUtf8("The target directory must not be empty.")) def __addSingleDirectory(self, filetype, source, target, quiet = False): """ @@ -1823,9 +1819,7 @@ self.trUtf8("Add directory"), self.trUtf8("<p>The target directory <b>{0}</b> could not be" " created.</p><p>Reason: {1}</p>") - .format(target, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + .format(target, str(why))) return for file in files: @@ -1891,9 +1885,7 @@ if target == '': QMessageBox.critical(None, self.trUtf8("Add directory"), - self.trUtf8("The target directory must not be empty."), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + self.trUtf8("The target directory must not be empty.")) return if filetype == 'OTHERS': @@ -1903,9 +1895,7 @@ if source == '': QMessageBox.critical(None, self.trUtf8("Add directory"), - self.trUtf8("The source directory must not be empty."), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + self.trUtf8("The source directory must not be empty.")) return if recursive: @@ -4518,9 +4508,7 @@ QMessageBox.critical(None, self.trUtf8("Create Package List"), self.trUtf8("""<p>The file <b>PKGLIST</b> could not be created.</p>""" - """<p>Reason: {0}</p>""").format(str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {0}</p>""").format(str(why))) return if not "PKGLIST" in self.pdata["OTHERS"]: @@ -4537,9 +4525,7 @@ QMessageBox.critical(None, self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The file <b>PKGLIST</b> does not exist. """ - """Aborting...</p>"""), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """Aborting...</p>""")) return if len(self.pdata["MAINSCRIPT"]) == 0 or \ @@ -4547,9 +4533,7 @@ QMessageBox.critical(None, self.trUtf8("Create Plugin Archive"), self.trUtf8("""The project does not have a main script defined. """ - """Aborting..."""), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """Aborting...""")) return try: @@ -4561,9 +4545,7 @@ QMessageBox.critical(None, self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The file <b>PKGLIST</b> could not be read.</p>""" - """<p>Reason: {0}</p>""").format(str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {0}</p>""").format(str(why))) return archive = \ @@ -4578,9 +4560,7 @@ self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> could """ """not be created.</p>""" - """<p>Reason: {1}</p>""").format(archive, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {1}</p>""").format(archive, str(why))) return for name in names: @@ -4601,9 +4581,7 @@ self.trUtf8("""<p>The file <b>{0}</b> could not be stored """ """in the archive. Ignoring it.</p>""" """<p>Reason: {1}</p>""")\ - .format(os.path.join(self.ppath, name), str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(os.path.join(self.ppath, name), str(why))) archiveFile.writestr("VERSION", version.encode("utf-8")) archiveFile.close() @@ -4613,9 +4591,7 @@ QMessageBox.information(None, self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> was """ - """created successfully.</p>""").format(archive), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """created successfully.</p>""").format(archive)) def __pluginCreateSnapshotArchive(self): """ @@ -4659,9 +4635,7 @@ self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The plugin file <b>{0}</b> could """ """not be read.</p>""" - """<p>Reason: {1}</p>""").format(archive, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {1}</p>""").format(archive, str(why))) return b"", "" lineno = 0 @@ -4698,9 +4672,7 @@ self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The plugin file <b>{0}</b> could """ """not be read.</p>""" - """<p>Reason: {1}</p>""").format(archive, str(why)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """<p>Reason: {1}</p>""").format(archive, str(why))) return "" for sourceline in sourcelines:
--- a/Project/ProjectSourcesBrowser.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Project/ProjectSourcesBrowser.py Mon Aug 30 19:03:34 2010 +0200 @@ -576,9 +576,7 @@ self.trUtf8("""<p>The package directory <b>{0}</b> could""" """ not be created. Aborting...</p>""" """<p>Reason: {1}</p>""")\ - .format(packagePath, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(packagePath, str(err))) return packageFile = os.path.join(packagePath, "__init__.py") if not os.path.exists(packageFile): @@ -591,9 +589,7 @@ self.trUtf8("""<p>The package file <b>{0}</b> could""" """ not be created. Aborting...</p>""" """<p>Reason: {1}</p>""")\ - .format(packageFile, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(packageFile, str(err))) return self.project.appendFile(packageFile) if packageFile:
--- a/Project/ProjectTranslationsBrowser.py Mon Aug 30 15:28:21 2010 +0200 +++ b/Project/ProjectTranslationsBrowser.py Mon Aug 30 19:03:34 2010 +0200 @@ -705,9 +705,7 @@ else: QMessageBox.warning(None, self.trUtf8("Write temporary project file"), - self.trUtf8("""No translation files (*.ts) selected."""), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + self.trUtf8("""No translation files (*.ts) selected.""")) return False try: @@ -735,9 +733,7 @@ QMessageBox.critical(None, self.trUtf8("Write temporary project file"), self.trUtf8("<p>The temporary project file <b>{0}</b> could not" - " be written.</p>").format(pfile), - QMessageBox.StandardButtons(\ - QMessageBox.Abort)) + " be written.</p>").format(pfile)) self.tmpProject = None return False
--- a/QScintilla/Editor.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Editor.py Mon Aug 30 19:03:34 2010 +0200 @@ -1082,15 +1082,11 @@ self.trUtf8("Export source"), self.trUtf8("""<p>No exporter available for the """ """export format <b>{0}</b>. Aborting...</p>""")\ - .format(exporterFormat), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(exporterFormat)) else: QMessageBox.critical(self, self.trUtf8("Export source"), - self.trUtf8("""No export format given. Aborting..."""), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + self.trUtf8("""No export format given. Aborting...""")) def __showContextMenuLanguages(self): """
--- a/QScintilla/Exporters/ExporterHTML.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Exporters/ExporterHTML.py Mon Aug 30 19:03:34 2010 +0200 @@ -396,8 +396,6 @@ self.trUtf8(\ """<p>The source could not be exported to <b>{0}</b>.</p>""" """<p>Reason: {1}</p>""")\ - .format(filename, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterODT.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Exporters/ExporterODT.py Mon Aug 30 19:03:34 2010 +0200 @@ -69,6 +69,4 @@ self.trUtf8("Export source"), self.trUtf8(\ """<p>The source could not be exported to <b>{0}</b>.</p>""")\ - .format(filename), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(filename))
--- a/QScintilla/Exporters/ExporterPDF.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Exporters/ExporterPDF.py Mon Aug 30 19:03:34 2010 +0200 @@ -583,8 +583,6 @@ self.trUtf8( """<p>The source could not be exported to <b>{0}</b>.</p>""" """<p>Reason: {1}</p>""")\ - .format(filename, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterRTF.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Exporters/ExporterRTF.py Mon Aug 30 19:03:34 2010 +0200 @@ -339,8 +339,6 @@ self.trUtf8( """<p>The source could not be exported to <b>{0}</b>.</p>""" """<p>Reason: {1}</p>""")\ - .format(filename, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/QScintilla/Exporters/ExporterTEX.py Mon Aug 30 15:28:21 2010 +0200 +++ b/QScintilla/Exporters/ExporterTEX.py Mon Aug 30 19:03:34 2010 +0200 @@ -258,8 +258,6 @@ self.trUtf8(\ """<p>The source could not be exported to <b>{0}</b>.</p>""" """<p>Reason: {1}</p>""")\ - .format(filename, str(err)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()
--- a/UI/UserInterface.py Mon Aug 30 15:28:21 2010 +0200 +++ b/UI/UserInterface.py Mon Aug 30 19:03:34 2010 +0200 @@ -603,9 +603,7 @@ self.trUtf8("Loading Style Sheet"), self.trUtf8("""<p>The Qt Style Sheet file <b>{0}</b> could""" """ not be read.<br>Reason: {1}</p>""") - .format(styleSheetFile, str(msg)), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + .format(styleSheetFile, str(msg))) return else: styleSheet = "" @@ -5645,9 +5643,7 @@ QMessageBox.information(None, self.trUtf8("First time usage"), self.trUtf8("""eric5 has not been configured yet. """ - """The configuration dialog will be started."""), - QMessageBox.StandardButtons(\ - QMessageBox.Ok)) + """The configuration dialog will be started.""")) self.showPreferences() def versionIsNewer(self, required, snapshot = None):