Tue, 31 Aug 2010 16:38:06 +0200
Continued replacing QMessageBox methods with own methods.
--- a/Cooperation/Connection.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Cooperation/Connection.py Tue Aug 31 16:38:06 2010 +0200 @@ -8,7 +8,6 @@ """ from PyQt4.QtCore import pyqtSignal, QTimer, QTime, QByteArray -from PyQt4.QtGui import QMessageBox from PyQt4.QtNetwork import QTcpSocket from E5Gui import E5MessageBox @@ -193,16 +192,13 @@ not Preferences.getCooperation("AutoAcceptConnections"): # don't ask for reverse connections or # if we shall accept automatically - res = E5MessageBox.question(None, + res = E5MessageBox.yesNo(None, self.trUtf8("New Connection"), self.trUtf8("""<p>Accept connection from """ """<strong>{0}@{1}</strong>?</p>""").format( user, self.peerAddress().toString()), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.No: + yesDefault = True) + if not res: self.abort() return @@ -417,4 +413,4 @@ self.__pingTimer.stop() if self.__state == Connection.WaitingForGreeting: self.rejected.emit(self.trUtf8("* Connection to {0}:{1} refused.").format( - self.peerName(), self.peerPort())) \ No newline at end of file + self.peerName(), self.peerPort()))
--- a/Debugger/DebugServer.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Debugger/DebugServer.py Tue Aug 31 16:38:06 2010 +0200 @@ -10,7 +10,6 @@ import os from PyQt4.QtCore import * -from PyQt4.QtGui import QMessageBox from PyQt4.QtNetwork import QTcpServer, QHostAddress, QHostInfo from E5Gui.E5Application import e5App @@ -567,16 +566,13 @@ peerAddress = sock.peerAddress().toString() if peerAddress not in Preferences.getDebugger("AllowedHosts"): # the peer is not allowed to connect - res = E5MessageBox.warning(None, + res = E5MessageBox.yesNo(None, self.trUtf8("Connection from illegal host"), self.trUtf8("""<p>A connection was attempted by the""" """ illegal host <b>{0}</b>. Accept this connection?</p>""")\ .format(peerAddress), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.No: + type_ = E5MessageBox.Warning) + if not res: sock.abort() return else: @@ -1277,4 +1273,4 @@ @return flag indicating a connection (boolean) """ - return self.debuggerInterface and self.debuggerInterface.isConnected() \ No newline at end of file + return self.debuggerInterface and self.debuggerInterface.isConnected()
--- a/E5Gui/E5MessageBox.py Tue Aug 31 13:39:24 2010 +0200 +++ b/E5Gui/E5MessageBox.py Tue Aug 31 16:38:06 2010 +0200 @@ -113,3 +113,36 @@ """ return __messageBox(parent, title, text, QMessageBox.Warning, buttons, defaultButton) + +Critical = 0 +Information = 1 +Question = 2 +Warning = 3 + +def yesNo(parent, title, text, type_ = Question, yesDefault = False): + """ + Function to show a model yes/no message box. + + @param parent parent widget of the message box (QWidget) + @param title caption of the message box (string) + @param text text to be shown by the message box (string) + @keyparam type_ type of the dialog (Critical, Information, Question or Warning) + @keyparam yesDefault flag indicating that the Yes button should be the default + button (boolean) + @return flag indicating the selection of the Yes button (boolean) + """ + assert type_ in [Critical, Information, Question, Warning] + + if type_ == Question: + icon = QMessageBox.Question + elif type_ == Warning: + icon = QMessageBox.Warning + elif type_ == Critical: + icon = QMessageBox.Critical + elif type_ == Information: + icon = QMessageBox.Information + + res = __messageBox(parent, title, text, icon, + QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), + yesDefault and QMessageBox.Yes or QMessageBox.No) + return res == QMessageBox.Yes
--- a/E5Gui/E5ToolBarDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/E5Gui/E5ToolBarDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -149,15 +149,11 @@ Private slot to remove a custom toolbar """ name = self.toolbarComboBox.currentText() - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Remove Toolbar"), self.trUtf8("""Should the toolbar <b>{0}</b> really be removed?""")\ - .format(name), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + .format(name)) + if res: index = self.toolbarComboBox.currentIndex() tbItemID = self.toolbarComboBox.itemData(index) tbItem = self.__toolbarItems[tbItemID] @@ -456,4 +452,4 @@ tbID = self.__currentToolBarItem.toolBarId actions = self.__manager.defaultToolBarActions(tbID) self.__restoreCurrentToolbar(actions) - self.__currentToolBarItem.isChanged = True \ No newline at end of file + self.__currentToolBarItem.isChanged = True
--- a/Helpviewer/AdBlock/AdBlockAccessHandler.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/AdBlock/AdBlockAccessHandler.py Tue Aug 31 16:38:06 2010 +0200 @@ -7,7 +7,6 @@ Module implementing a scheme access handler for AdBlock URLs. """ -from PyQt4.QtGui import QMessageBox from PyQt4.QtNetwork import QNetworkAccessManager from E5Gui import E5MessageBox @@ -40,14 +39,11 @@ subscription = AdBlockSubscription(request.url(), Helpviewer.HelpWindow.HelpWindow.adblockManager()) - res = E5MessageBox.question(None, + res = E5MessageBox.yesNo(None, self.trUtf8("Subscribe?"), self.trUtf8("""<p>Subscribe to this AdBlock subscription?</p><p>{0}</p>""")\ - .format(subscription.title()), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes)) - if res == QMessageBox.Yes: + .format(subscription.title())) + if res: Helpviewer.HelpWindow.HelpWindow.adblockManager()\ .addSubscription(subscription) dlg = Helpviewer.HelpWindow.HelpWindow.adblockManager().showDialog() @@ -55,4 +51,4 @@ dlg.setCurrentIndex(model.index(model.rowCount() - 1, 0)) dlg.setFocus() - return None \ No newline at end of file + return None
--- a/Helpviewer/HelpBrowserWV.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/HelpBrowserWV.py Tue Aug 31 16:38:06 2010 +0200 @@ -1192,17 +1192,14 @@ # accessed for the first time return - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Web Database Quota"), self.trUtf8("""<p>The database quota of <strong>{0}</strong> has""" """ been exceeded while accessing database <strong>{1}""" """</strong>.</p><p>Shall it be changed?</p>""")\ .format(self.__dataString(securityOrigin.databaseQuota()), databaseName), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + yesDefault = True) + if res: newQuota, ok = QInputDialog.getInteger(\ self, self.trUtf8("New Web Database Quota"), @@ -1249,4 +1246,4 @@ """ Public method to indicate a change of the settings. """ - self.reload() \ No newline at end of file + self.reload()
--- a/Helpviewer/HelpWindow.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/HelpWindow.py Tue Aug 31 16:38:06 2010 +0200 @@ -2052,12 +2052,8 @@ """ Until you close the window, you can still click""" """ the Back and Forward buttons to return to the""" """ web pages you have opened.</p>""") - res = E5MessageBox.question(self, "", txt, - QMessageBox.StandardButtons(\ - QMessageBox.Yes | \ - QMessageBox.No), - QMessageBox.No) - if res == QMessageBox.Yes: + res = E5MessageBox.yesNo(self, "", txt) + if res: settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) self.pathCombo.setInsertPolicy(QComboBox.NoInsert) self.privacyLabel.setPixmap( @@ -2973,4 +2969,4 @@ else: print(codecs[offset]) QWebSettings.globalSettings().setDefaultTextEncoding(codecs[offset]) - Preferences.setHelp("DefaultTextEncoding", codecs[offset]) \ No newline at end of file + Preferences.setHelp("DefaultTextEncoding", codecs[offset])
--- a/Helpviewer/History/HistoryMenu.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/History/HistoryMenu.py Tue Aug 31 16:38:06 2010 +0200 @@ -301,11 +301,7 @@ Private slot to clear the history. """ if self.__historyManager is not None and \ - E5MessageBox.question(self, + E5MessageBox.yesNo(self, self.trUtf8("Clear History"), - self.trUtf8("""Do you want to clear the history?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) == QMessageBox.Yes: - self.__historyManager.clear() \ No newline at end of file + self.trUtf8("""Do you want to clear the history?""")): + self.__historyManager.clear()
--- a/Helpviewer/Network/NetworkAccessManager.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/Network/NetworkAccessManager.py Tue Aug 31 16:38:06 2010 +0200 @@ -10,7 +10,7 @@ import os from PyQt4.QtCore import * -from PyQt4.QtGui import QDialog, QMessageBox +from PyQt4.QtGui import QDialog from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply try: from PyQt4.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslSocket @@ -203,32 +203,25 @@ return errorString = '.</li><li>'.join(errorStrings) - ret = E5MessageBox.warning(None, + ret = E5MessageBox.yesNo(None, self.trUtf8("SSL Errors"), self.trUtf8("""<p>SSL Errors for <br /><b>{0}</b>""" """<ul><li>{1}</li></ul></p>""" """<p>Do you want to ignore these errors?</p>""")\ .format(reply.url().toString(), errorString), - QMessageBox.StandardButtons( - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) + type_ = E5MessageBox.Warning) - if ret == QMessageBox.Yes: + if ret: if len(caNew) > 0: certinfos = [] for cert in caNew: certinfos.append(self.__certToString(cert)) - ret = E5MessageBox.question(None, + ret = E5MessageBox.yesNo(None, self.trUtf8("Certificates"), self.trUtf8("""<p>Certificates:<br/>{0}<br/>""" """Do you want to accept all these certificates?</p>""")\ - .format("".join(certinfos)), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if ret == QMessageBox.Yes: + .format("".join(certinfos))) + if ret: for cert in caNew: caMerge.append(cert) @@ -303,4 +296,4 @@ diskCache.setMaximumCacheSize(size) else: diskCache = None - self.setCache(diskCache) \ No newline at end of file + self.setCache(diskCache)
--- a/Helpviewer/OpenSearch/OpenSearchManager.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchManager.py Tue Aug 31 16:38:06 2010 +0200 @@ -10,7 +10,6 @@ import os from PyQt4.QtCore import * -from PyQt4.QtGui import QMessageBox from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply from .OpenSearchDefaultEngines import OpenSearchDefaultEngines @@ -385,17 +384,13 @@ host = QUrl(engine.searchUrlTemplate()).host() - res = E5MessageBox.question(None, + res = E5MessageBox.yesNo(None, "", self.trUtf8("""<p>Do you want to add the following engine to your list of""" """ search engines?<br/><br/>Name: {0}<br/>""" """Searches on: {1}</p>""")\ - .format(engine.name(), host), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - return res == QMessageBox.Yes + .format(engine.name(), host)) + return res def __engineFromUrlAvailable(self): """ @@ -518,4 +513,4 @@ """ Public slot to tell the search engine manager, that something has changed. """ - self.changed.emit() \ No newline at end of file + self.changed.emit()
--- a/Helpviewer/Passwords/PasswordsDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/Passwords/PasswordsDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -84,14 +84,10 @@ self.__passwordModel.setShowPasswords(False) self.passwordsButton.setText(self.__showPasswordsText) else: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Saved Passwords"), - self.trUtf8("""Do you really want to show passwords?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + self.trUtf8("""Do you really want to show passwords?""")) + if res: self.__passwordModel.setShowPasswords(True) self.passwordsButton.setText(self.__hidePasswordsText) - self.__calculateHeaderSizes() \ No newline at end of file + self.__calculateHeaderSizes()
--- a/Helpviewer/QtHelpDocumentationDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Helpviewer/QtHelpDocumentationDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -93,12 +93,8 @@ res = E5MessageBox.question(self, self.trUtf8("Remove Documentation"), self.trUtf8("""Do you really want to remove the selected documentation """ - """sets from the database?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.No: + """sets from the database?""")) + if not res: return openedDocs = self.__mw.getSourceFileList() @@ -107,17 +103,14 @@ for item in items: ns = item.text() if ns in list(openedDocs.values()): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Remove Documentation"), self.trUtf8("""Some documents currently opened reference the """ """documentation you are attempting to remove. """ """Removing the documentation will close those """ """documents. Remove anyway?"""), - QMessageBox.StandardButtons(\ - QMessageBox.Yes | \ - QMessageBox.No), - QMessageBox.No) - if res == QMessageBox.No: + type_ = E5MessageBox.Warning) + if not res: return self.__unregisteredDocs.append(ns) for id in openedDocs: @@ -146,4 +139,4 @@ @return list of tab ids to be closed (list of integers) """ - return self.__tabsToClose \ No newline at end of file + return self.__tabsToClose
--- a/IconEditor/IconEditorGrid.py Tue Aug 31 13:39:24 2010 +0200 +++ b/IconEditor/IconEditorGrid.py Tue Aug 31 16:38:06 2010 +0200 @@ -832,15 +832,11 @@ img, ok = self.__clipboardImage() if ok: if img.width() > self.__image.width() or img.height() > self.__image.height(): - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Paste"), self.trUtf8("""<p>The clipboard image is larger than the current """ - """image.<br/>Paste as new image?</p>"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + """image.<br/>Paste as new image?</p>""")) + if res: self.editPasteAsNew() return elif not pasting: @@ -1056,4 +1052,4 @@ @return flag indicating the availability of a selection (boolean) """ - return self.__selectionAvailable \ No newline at end of file + return self.__selectionAvailable
--- a/PluginManager/PluginRepositoryDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/PluginManager/PluginRepositoryDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -499,17 +499,14 @@ for err in errors: errorStrings.append(err.errorString()) errorString = '.<br />'.join(errorStrings) - ret = E5MessageBox.warning(self, + ret = E5MessageBox.yesNo(self, self.trUtf8("SSL Errors"), self.trUtf8("""<p>SSL Errors:</p>""" """<p>{0}</p>""" """<p>Do you want to ignore these errors?</p>""")\ .format(errorString), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if ret == QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if ret: reply.ignoreSslErrors() else: self.__downloadCancelled = True @@ -603,4 +600,4 @@ ).format(applPath), self.trUtf8('OK')) - self.close() \ No newline at end of file + self.close()
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Tue Aug 31 16:38:06 2010 +0200 @@ -1672,17 +1672,14 @@ ignoreName = os.path.join(name, ".hgignore") if os.path.exists(ignoreName): - res = E5MessageBox.warning(self.__ui, + res = E5MessageBox.yesNo(self.__ui, self.trUtf8("Create .hgignore file"), self.trUtf8("""<p>The file <b>{0}</b> exists already.""" """ Overwrite it?</p>""").format(ignoreName), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) + type_ = E5MessageBox.Warning) else: - res = QMessageBox.Yes - if res == QMessageBox.Yes: + res = True + if res: try: # create a .hgignore file ignore = open(ignoreName, "w") @@ -1849,13 +1846,10 @@ repodir, self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) if files: - update = E5MessageBox.question(self.__ui, + update = E5MessageBox.yesNo(self.__ui, self.trUtf8("Apply changegroups"), self.trUtf8("""Shall the working directory be updated?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) == QMessageBox.Yes + yesDefault = True) args = [] args.append('unbundle') @@ -2047,4 +2041,4 @@ @param interval check interval for the monitor thread in seconds (integer) @return reference to the monitor thread (QThread) """ - return HgStatusMonitorThread(interval, project, self) \ No newline at end of file + return HgStatusMonitorThread(interval, project, self)
--- a/Preferences/ShortcutsDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Preferences/ShortcutsDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -293,18 +293,15 @@ itmseq = itm.text(col) # step 1: check if shortcut is already allocated if keystr == itmseq: - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Edit shortcuts"), self.trUtf8(\ """<p><b>{0}</b> has already been allocated""" """ to the <b>{1}</b> action. """ """Remove this binding?</p>""") .format(keystr, itm.text(0)), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if res: itm.setText(col, "") return True else: @@ -315,17 +312,14 @@ # step 2: check if shortcut hides an already allocated if itmseq.startswith("{0}+".format(keystr)): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Edit shortcuts"), self.trUtf8(\ """<p><b>{0}</b> hides the <b>{1}</b> action. """ """Remove this binding?</p>""") .format(keystr, itm.text(0)), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if res: itm.setText(col, "") return True else: @@ -333,18 +327,15 @@ # step 3: check if shortcut is hidden by an already allocated if keystr.startswith("{0}+".format(itmseq)): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Edit shortcuts"), self.trUtf8(\ """<p><b>{0}</b> is hidden by the """ """<b>{1}</b> action. """ """Remove this binding?</p>""") .format(keystr, itm.text(0)), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if res: itm.setText(col, "") return True else: @@ -462,4 +453,4 @@ @param checked state of the shortcuts radio button (boolean) """ if checked: - self.on_searchEdit_textChanged(self.searchEdit.text()) \ No newline at end of file + self.on_searchEdit_textChanged(self.searchEdit.text())
--- a/Preferences/ToolGroupConfigurationDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Preferences/ToolGroupConfigurationDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -106,16 +106,13 @@ if row < 0: return - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Delete tool group entry"), self.trUtf8("""<p>Do you really want to delete the tool group""" """ <b>"{0}"</b>?</p>""")\ .format(self.groupsList.currentItem().text()), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: return if row == self.currentGroup: @@ -207,4 +204,4 @@ """ tmp = self.toolGroups[itm1] self.toolGroups[itm1] = self.toolGroups[itm2] - self.toolGroups[itm2] = tmp \ No newline at end of file + self.toolGroups[itm2] = tmp
--- a/Project/Project.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Project/Project.py Tue Aug 31 16:38:06 2010 +0200 @@ -1753,16 +1753,13 @@ os.makedirs(target) if os.path.exists(targetfile): - res = E5MessageBox.warning(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("Add file"), self.trUtf8("<p>The file <b>{0}</b> already" " exists.</p><p>Overwrite it?</p>") .format(targetfile), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: return # don't overwrite shutil.copy(fn, target) @@ -1831,16 +1828,13 @@ if not Utilities.samepath(target, source): try: if os.path.exists(targetfile): - res = E5MessageBox.warning(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("Add directory"), self.trUtf8("<p>The file <b>{0}</b> already exists.</p>" "<p>Overwrite it?</p>") .format(targetfile), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: continue # don't overwrite, carry on with next file shutil.copy(file, target) @@ -2024,16 +2018,13 @@ newfn = Utilities.toNativeSeparators(newfn) if os.path.exists(newfn): - canceled = E5MessageBox.warning(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("Rename File"), self.trUtf8("""<p>The file <b>{0}</b> already exists.""" """ Overwrite it?</p>""") .format(newfn), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if canceled != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: return False try: @@ -2355,14 +2346,11 @@ ms = "" # add existing files to the project - res = E5MessageBox.question(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("New Project"), self.trUtf8("""Add existing files to the project?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + yesDefault = True) + if res: self.newProjectAddFiles(ms) # create an empty __init__.py file to make it a Python package # if none exists (only for Python and Python3) @@ -2406,29 +2394,22 @@ self.setDirty(True) if self.vcs is not None: # edit VCS command options - vcores = E5MessageBox.question(self.ui, + vcores = E5MessageBox.yesNo(self.ui, self.trUtf8("New Project"), self.trUtf8("""Would you like to edit the VCS""" - """ command options?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if vcores == QMessageBox.Yes: + """ command options?""")) + if vcores: codlg = vcsCommandOptionsDialog(self.vcs) if codlg.exec_() == QDialog.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) # add project file to repository if res == 0: - apres = E5MessageBox.question(self.ui, + apres = E5MessageBox.yesNo(self.ui, self.trUtf8("New project"), self.trUtf8("Shall the project file be added" " to the repository?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if apres == QMessageBox.Yes: + yesDefault = True) + if apres: self.saveProject() self.vcs.vcsAdd(self.pfile) else: @@ -2470,15 +2451,11 @@ self.setDirty(True) if self.vcs is not None: # edit VCS command options - vcores = E5MessageBox.question(self.ui, + vcores = E5MessageBox.yesNo(self.ui, self.trUtf8("New Project"), self.trUtf8("""Would you like to edit the VCS command""" - """ options?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if vcores == QMessageBox.Yes: + """ options?""")) + if vcores: codlg = vcsCommandOptionsDialog(self.vcs) if codlg.exec_() == QDialog.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -4368,16 +4345,13 @@ """ Private method to handle the application diagram context menu action. """ - res = E5MessageBox.question(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("Application Diagram"), self.trUtf8("""Include module names?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) + yesDefault = True) self.applicationDiagram = ApplicationDiagram(self, self.parent(), - noModules = (res != QMessageBox.Yes)) + noModules = not res) self.applicationDiagram.show() ######################################################################### @@ -4475,15 +4449,12 @@ """ pkglist = os.path.join(self.ppath, "PKGLIST") if os.path.exists(pkglist): - res = E5MessageBox.warning(self.ui, + res = E5MessageBox.yesNo(self.ui, self.trUtf8("Create Package List"), self.trUtf8("<p>The file <b>PKGLIST</b> already" " exists.</p><p>Overwrite it?</p>"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: return # don't overwrite # build the list of entries @@ -4681,4 +4652,4 @@ .replace('"', "").replace("'", "") break - return version \ No newline at end of file + return version
--- a/Project/ProjectFormsBrowser.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Project/ProjectFormsBrowser.py Tue Aug 31 16:38:06 2010 +0200 @@ -511,14 +511,11 @@ fname += ex if os.path.exists(fname): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("New Form"), self.trUtf8("The file already exists! Overwrite it?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: # user selected to not overwrite return @@ -903,4 +900,4 @@ "compileSelectedForms" : None, "generateDialogCode" : None, "newForm" : None, - } \ No newline at end of file + }
--- a/Project/ProjectResourcesBrowser.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Project/ProjectResourcesBrowser.py Tue Aug 31 16:38:06 2010 +0200 @@ -405,14 +405,11 @@ fname += ex if os.path.exists(fname): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("New Resource"), self.trUtf8("The file already exists! Overwrite it?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + type_ = E5MessageBox.Warning) + if not res: # user selected to not overwrite return @@ -817,4 +814,4 @@ "compileChangedResources" : None, "compileSelectedResources" : None, "newResource" : None, - } \ No newline at end of file + }
--- a/Project/ProjectSourcesBrowser.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Project/ProjectSourcesBrowser.py Tue Aug 31 16:38:06 2010 +0200 @@ -803,15 +803,11 @@ fn = itm.fileName() except AttributeError: fn = itm.dirName() - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Class Diagram"), self.trUtf8("""Include class attributes?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - self.classDiagram = UMLClassDiagram(fn, self, - noAttrs = (res != QMessageBox.Yes)) + yesDefault = True) + self.classDiagram = UMLClassDiagram(fn, self, noAttrs = not res) self.classDiagram.show() def __showImportsDiagram(self): @@ -824,15 +820,11 @@ except AttributeError: fn = itm.dirName() package = os.path.isdir(fn) and fn or os.path.dirname(fn) - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Imports Diagram"), - self.trUtf8("""Include imports from external modules?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) + self.trUtf8("""Include imports from external modules?""")) self.importsDiagram = ImportsDiagram(package, self, - showExternalImports = (res == QMessageBox.Yes)) + showExternalImports = res) self.importsDiagram.show() def __showPackageDiagram(self): @@ -845,28 +837,21 @@ except AttributeError: fn = itm.dirName() package = os.path.isdir(fn) and fn or os.path.dirname(fn) - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Package Diagram"), self.trUtf8("""Include class attributes?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - self.packageDiagram = PackageDiagram(package, self, - noAttrs = (res != QMessageBox.Yes)) + yesDefault = True) + self.packageDiagram = PackageDiagram(package, self, noAttrs = not res) self.packageDiagram.show() def __showApplicationDiagram(self): """ Private method to handle the application diagram context menu action. """ - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Application Diagram"), self.trUtf8("""Include module names?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) + yesDefault = True) self.applicationDiagram = ApplicationDiagram(self.project, self, - noModules = (res != QMessageBox.Yes)) - self.applicationDiagram.show() \ No newline at end of file + noModules = not res) + self.applicationDiagram.show()
--- a/QScintilla/Editor.py Tue Aug 31 13:39:24 2010 +0200 +++ b/QScintilla/Editor.py Tue Aug 31 16:38:06 2010 +0200 @@ -280,18 +280,15 @@ if self.fileName is not None: if (QFileInfo(self.fileName).size() // 1024) > \ Preferences.getEditor("WarnFilesize"): - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Open File"), self.trUtf8("""<p>The size of the file <b>{0}</b>""" """ is <b>{1} KB</b>.""" """ Do you really want to load it?</p>""")\ .format(self.fileName, QFileInfo(self.fileName).size() // 1024), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.No or res == QMessageBox.Cancel: + type_ = E5MessageBox.Warning) + if not res: raise IOError() self.readFile(self.fileName, True) bindName = self.__bindName(self.text(0)) @@ -4675,14 +4672,12 @@ Public method to start macro recording. """ if self.recording: - res = E5MessageBox.warning(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Start Macro Recording"), self.trUtf8("Macro recording is already active. Start new?"), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res == QMessageBox.Yes: + type_ = E5MessageBox.Warning, + yesDefault = True) + if res: self.macroRecordingStop() else: return @@ -4818,19 +4813,17 @@ msg = self.trUtf8(\ """<p>The file <b>{0}</b> has been changed while it was opened in""" """ eric5. Reread it?</p>""").format(self.fileName) - default = QMessageBox.Yes + yesDefault = True if self.isModified(): msg += self.trUtf8(\ """<br><b>Warning:</b> You will loose""" """ your changes upon reopening it.""") - default = QMessageBox.No - res = E5MessageBox.warning(self, + yesDefault = False + res = E5MessageBox.yesNo(self, self.trUtf8("File changed"), msg, - QMessageBox.StandardButtons(\ - QMessageBox.Yes | \ - QMessageBox.No), - default) - if res == QMessageBox.Yes: + type_ = E5MessageBox.Warning, + yesDefault = yesDefault) + if res: self.refresh() else: # do not prompt for this change again... @@ -5173,15 +5166,11 @@ package = os.path.isdir(self.fileName) and self.fileName \ or os.path.dirname(self.fileName) - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Package Diagram"), self.trUtf8("""Include class attributes?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - self.packageDiagram = PackageDiagram(package, self, - noAttrs = (res == QMessageBox.No)) + yesDefault = True) + self.packageDiagram = PackageDiagram(package, self, noAttrs = not res) self.packageDiagram.show() def __showImportsDiagram(self): @@ -5194,15 +5183,11 @@ package = os.path.isdir(self.fileName) and self.fileName \ or os.path.dirname(self.fileName) - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Imports Diagram"), - self.trUtf8("""Include imports from external modules?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) + self.trUtf8("""Include imports from external modules?""")) self.importsDiagram = ImportsDiagram(package, self, - showExternalImports = (res == QMessageBox.Yes)) + showExternalImports = res) self.importsDiagram.show() def __showApplicationDiagram(self): @@ -5210,15 +5195,12 @@ Private method to handle the Imports Diagram context menu action. """ from Graphics.ApplicationDiagram import ApplicationDiagram - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Application Diagram"), self.trUtf8("""Include module names?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) + yesDefault = True) self.applicationDiagram = ApplicationDiagram(self.project, - self, noModules = (res == QMessageBox.No)) + self, noModules = not res) self.applicationDiagram.show() ####################################################################### @@ -5758,4 +5740,4 @@ command = self.__receivedWhileSyncing.pop(0) self.__dispatchCommand(command) - self.__isSyncing = False \ No newline at end of file + self.__isSyncing = False
--- a/Tasks/TaskViewer.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Tasks/TaskViewer.py Tue Aug 31 16:38:06 2010 +0200 @@ -712,15 +712,12 @@ @param on flag indicating the filter state (boolean) """ if on and not self.taskFilter.hasActiveFilter(): - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Activate task filter"), self.trUtf8("""The task filter doesn't have any active filters.""" """ Do you want to configure the filter settings?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.Yes) - if res != QMessageBox.Yes: + yesDefault = True) + if not res: on = False else: self.__configureFilter() @@ -808,4 +805,4 @@ """ Private method to open the configuration dialog. """ - e5App().getObject("UserInterface").showPreferences("tasksPage") \ No newline at end of file + e5App().getObject("UserInterface").showPreferences("tasksPage")
--- a/Templates/TemplatePropertiesDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Templates/TemplatePropertiesDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -92,14 +92,10 @@ @param ev key event (QKeyEvent) """ if ev.key() == Qt.Key_Escape: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Close dialog"), - self.trUtf8("""Do you really want to close the dialog?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + self.trUtf8("""Do you really want to close the dialog?""")) + if not res: self.reject() @pyqtSlot() @@ -198,4 +194,4 @@ self.descriptionEdit.text(), self.groupCombo.currentText(), self.templateEdit.toPlainText() - ) \ No newline at end of file + )
--- a/Templates/TemplateViewer.py Tue Aug 31 13:39:24 2010 +0200 +++ b/Templates/TemplateViewer.py Tue Aug 31 16:38:06 2010 +0200 @@ -502,15 +502,11 @@ Private slot to handle the Remove context menu action. """ itm = self.currentItem() - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Remove Template"), self.trUtf8("""<p>Do you really want to remove <b>{0}</b>?</p>""")\ - .format(itm.getName()), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res != QMessageBox.Yes: + .format(itm.getName())) + if not res: return if isinstance(itm, TemplateGroup): @@ -966,4 +962,4 @@ names = [] for group in list(self.groups.values()): names.extend(group.getEntryNames(start)) - return sorted(names) \ No newline at end of file + return sorted(names)
--- a/UI/EmailDialog.py Tue Aug 31 13:39:24 2010 +0200 +++ b/UI/EmailDialog.py Tue Aug 31 16:38:06 2010 +0200 @@ -106,14 +106,10 @@ @param ev key event (QKeyEvent) """ if ev.key() == Qt.Key_Escape: - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Close dialog"), - self.trUtf8("""Do you really want to close the dialog?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + self.trUtf8("""Do you really want to close the dialog?""")) + if res: self.reject() def on_buttonBox_clicked(self, button): @@ -129,14 +125,10 @@ """ Private slot to handle the rejected signal of the button box. """ - res = E5MessageBox.question(self, + res = E5MessageBox.yesNo(self, self.trUtf8("Close dialog"), - self.trUtf8("""Do you really want to close the dialog?"""), - QMessageBox.StandardButtons(\ - QMessageBox.No | \ - QMessageBox.Yes), - QMessageBox.No) - if res == QMessageBox.Yes: + self.trUtf8("""Do you really want to close the dialog?""")) + if res: self.reject() @pyqtSlot() @@ -382,4 +374,4 @@ """ self.sendButton.setEnabled(\ self.subject.text() != "" and \ - self.message.toPlainText() != "") \ No newline at end of file + self.message.toPlainText() != "")
--- a/UI/UserInterface.py Tue Aug 31 13:39:24 2010 +0200 +++ b/UI/UserInterface.py Tue Aug 31 16:38:06 2010 +0200 @@ -2781,9 +2781,12 @@ if Preferences.getUI("CheckErrorLog"): logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log") if os.path.exists(logFile): - dlg = QMessageBox(QMessageBox.Question, self.trUtf8("Error log found"), + dlg = QMessageBox(QMessageBox.Question, + self.trUtf8("Error log found"), self.trUtf8("An error log file was found. " "What should be done with it?")) + dlg.setParent(self) + dlg.setWindowModality(Qt.WindowModal) try: f = open(logFile, "r", encoding = "utf-8") txt = f.read() @@ -5698,4 +5701,4 @@ if self.__startup: if Preferences.getGeometry("MainMaximized"): self.setWindowState(Qt.WindowStates(Qt.WindowMaximized)) - self.__startup = False \ No newline at end of file + self.__startup = False