Continued replacing QMessageBox methods with own methods.

Fri, 03 Sep 2010 20:04:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 03 Sep 2010 20:04:49 +0200
changeset 553
5af61623ae3c
parent 551
e1074b63ff08
child 554
64bf33147dc9

Continued replacing QMessageBox methods with own methods.

Cooperation/ChatWidget.py file | annotate | diff | comparison | revisions
Debugger/DebugServer.py file | annotate | diff | comparison | revisions
Debugger/DebugUI.py file | annotate | diff | comparison | revisions
E5Gui/E5MessageBox.py file | annotate | diff | comparison | revisions
Graphics/UMLGraphicsView.py file | annotate | diff | comparison | revisions
Helpviewer/DownloadDialog.py file | annotate | diff | comparison | revisions
Helpviewer/Network/NetworkAccessManager.py file | annotate | diff | comparison | revisions
Helpviewer/Passwords/PasswordManager.py file | annotate | diff | comparison | revisions
Helpviewer/QtHelpDocumentationDialog.py file | annotate | diff | comparison | revisions
IconEditor/IconEditorWindow.py file | annotate | diff | comparison | revisions
MultiProject/MultiProject.py file | annotate | diff | comparison | revisions
PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py file | annotate | diff | comparison | revisions
Preferences/ShortcutsDialog.py file | annotate | diff | comparison | revisions
Preferences/ToolGroupConfigurationDialog.py file | annotate | diff | comparison | revisions
Project/Project.py file | annotate | diff | comparison | revisions
Project/ProjectFormsBrowser.py file | annotate | diff | comparison | revisions
Project/ProjectResourcesBrowser.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/Exporters/ExporterBase.py file | annotate | diff | comparison | revisions
UI/DiffDialog.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
--- a/Cooperation/ChatWidget.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Cooperation/ChatWidget.py	Fri Sep 03 20:04:49 2010 +0200
@@ -547,7 +547,7 @@
                         self.trUtf8("Save Chat"),
                         self.trUtf8("<p>The file <b>{0}</b> already exists."
                                     " Overwrite it?</p>").format(fname),
-                        type_ = E5MessageBox.Warning)
+                        icon = E5MessageBox.Warning)
                     if not res:
                         return
                     fname = Utilities.toNativeSeparators(fname)
@@ -668,4 +668,4 @@
             QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":")
         self.chatEdit.append(self.trUtf8("* {0} has been banned and kicked.\n").format(
             itm.text().split(":")[0]))
-        self.chatEdit.setTextColor(color)
+        self.chatEdit.setTextColor(color)
\ No newline at end of file
--- a/Debugger/DebugServer.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Debugger/DebugServer.py	Fri Sep 03 20:04:49 2010 +0200
@@ -571,7 +571,7 @@
                 self.trUtf8("""<p>A connection was attempted by the"""
                     """ illegal host <b>{0}</b>. Accept this connection?</p>""")\
                     .format(peerAddress),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 sock.abort()
                 return
@@ -1273,4 +1273,4 @@
         
         @return flag indicating a connection (boolean)
         """
-        return self.debuggerInterface and self.debuggerInterface.isConnected()
+        return self.debuggerInterface and self.debuggerInterface.isConnected()
\ No newline at end of file
--- a/Debugger/DebugUI.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Debugger/DebugUI.py	Fri Sep 03 20:04:49 2010 +0200
@@ -999,18 +999,18 @@
             if stackTrace:
                 self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True)
             if Preferences.getDebugger("BreakAlways"):
-                res = QMessageBox.Yes
+                res = E5MessageBox.Yes
             else:
                 if stackTrace:
                     if exceptionType.startswith('unhandled'):
-                        buttons = QMessageBox.StandardButtons(\
-                            QMessageBox.No | \
-                            QMessageBox.Yes)
+                        buttons = E5MessageBox.StandardButtons(\
+                            E5MessageBox.No | \
+                            E5MessageBox.Yes)
                     else:
-                        buttons = QMessageBox.StandardButtons(\
-                            QMessageBox.No | \
-                            QMessageBox.Yes | \
-                            QMessageBox.Ignore)
+                        buttons = E5MessageBox.StandardButtons(\
+                            E5MessageBox.No | \
+                            E5MessageBox.Yes | \
+                            E5MessageBox.Ignore)
                     res = E5MessageBox.critical(self.ui, Program,
                         self.trUtf8('<p>The debugged program raised the exception'
                                     ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
@@ -1020,14 +1020,14 @@
                                     stackTrace[0][0], 
                                     stackTrace[0][1]),
                         buttons,
-                        QMessageBox.No)
+                        E5MessageBox.No)
                 else:
                     res = E5MessageBox.critical(self.ui, Program,
                         self.trUtf8('<p>The debugged program raised the exception'
                                     ' <b>{0}</b><br>"<b>{1}</b>"</p>')
                             .format(exceptionType, 
                                     Utilities.html_encode(exceptionMessage)))
-            if res == QMessageBox.Yes:
+            if res == E5MessageBox.Yes:
                 self.exceptionInterrupt.emit()
                 stack = []
                 for fn, ln in stackTrace:
@@ -1036,7 +1036,7 @@
                 self.__getClientVariables()
                 self.ui.setDebugProfile()
                 return
-            elif res == QMessageBox.Ignore:
+            elif res == E5MessageBox.Ignore:
                 if exceptionType not in self.excIgnoreList:
                     self.excIgnoreList.append(exceptionType)
         
@@ -1978,4 +1978,4 @@
         
         @return list of all actions (list of E5Action)
         """
-        return self.actions[:]
\ No newline at end of file
+        return self.actions[:]
--- a/E5Gui/E5MessageBox.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/E5Gui/E5MessageBox.py	Fri Sep 03 20:04:49 2010 +0200
@@ -10,6 +10,86 @@
 from PyQt4.QtCore import Qt
 from PyQt4.QtGui import QMessageBox, QApplication
 
+################################################################################
+##  Mappings to standard QMessageBox                                          ##
+################################################################################
+
+# QMessageBox.Icon
+Critical    = QMessageBox.Critical
+Information = QMessageBox.Information
+Question    = QMessageBox.Question
+Warning     = QMessageBox.Warning
+
+StandardButtons = QMessageBox.StandardButtons
+
+# QMessageBox.StandardButton
+Abort           = QMessageBox.Abort
+Apply           = QMessageBox.Apply
+Cancel          = QMessageBox.Cancel
+Close           = QMessageBox.Close
+Discard         = QMessageBox.Discard
+Help            = QMessageBox.Help
+Ignore          = QMessageBox.Ignore
+No              = QMessageBox.No
+NoToAll         = QMessageBox.NoToAll
+Ok              = QMessageBox.Ok
+Open            = QMessageBox.Open
+Reset           = QMessageBox.Reset
+RestoreDefaults = QMessageBox.RestoreDefaults
+Retry           = QMessageBox.Retry
+Save            = QMessageBox.Save
+SaveAll         = QMessageBox.SaveAll
+Yes             = QMessageBox.Yes
+YesToAll        = QMessageBox.YesToAll
+NoButton        = QMessageBox.NoButton
+
+# QMessageBox.ButtonRole
+AcceptRole      = QMessageBox.AcceptRole
+ActionRole      = QMessageBox.ActionRole
+ApplyRole       = QMessageBox.ApplyRole
+DestructiveRole = QMessageBox.DestructiveRole
+InvalidRole     = QMessageBox.InvalidRole
+HelpRole        = QMessageBox.HelpRole
+NoRole          = QMessageBox.NoRole
+RejectRole      = QMessageBox.RejectRole
+ResetRole       = QMessageBox.ResetRole
+YesRole         = QMessageBox.YesRole
+
+################################################################################
+##  Replacement for the QMessageBox class                                     ##
+################################################################################
+
+class E5MessageBox(QMessageBox):
+    """
+    Class implementing a replacement for QMessageBox.
+    """
+    def __init__(self, icon, title, text, modal = False, 
+                 buttons = QMessageBox.StandardButtons(QMessageBox.NoButton), 
+                 parent = None):
+        """
+        Constructor
+        
+        @param icon type of icon to be shown (QMessageBox.Icon)
+        @param title caption of the message box (string)
+        @param text text to be shown by the message box (string)
+        @keyparam modal flag indicating a modal dialog (boolean)
+        @keyparam buttons set of standard buttons to generate (StandardButtons)
+        @keyparam parent parent widget of the message box (QWidget)
+        """
+        QMessageBox.__init__(self, parent)
+        self.setIcon(icon)
+        if modal and parent is not None:
+            self.setWindowModality(Qt.WindowModal)
+        self.setWindowTitle("{0} - {1}".format(
+            QApplication.applicationName(), title))
+        self.setText(text)
+        if buttons != QMessageBox.NoButton:
+            self.setStandardButtons(buttons)
+
+################################################################################
+##  Replacements for QMessageBox static methods                               ##
+################################################################################
+
 def __messageBox(parent, title, text, icon, 
                  buttons = QMessageBox.Ok, defaultButton = QMessageBox.NoButton):
     """
@@ -118,59 +198,40 @@
     return __messageBox(parent, title, text, QMessageBox.Warning, 
                         buttons, defaultButton)
 
-Critical    = 0
-Information = 1
-Question    = 2
-Warning     = 3
+################################################################################
+##  Additional convenience functions                                          ##
+################################################################################
 
-def yesNo(parent, title, text, type_ = Question, yesDefault = False):
+def yesNo(parent, title, text, icon = 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 icon icon for 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
+    assert icon in [Critical, Information, Question, Warning]
     
     res = __messageBox(parent, title, text, icon, 
                        QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), 
                        yesDefault and QMessageBox.Yes or QMessageBox.No)
     return res == QMessageBox.Yes
 
-def retryAbort(parent, title, text, type_ = Question):
+def retryAbort(parent, title, text, icon = Question):
     """
     Function to show a model abort/retry 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 icon icon for the dialog (Critical, Information, Question or Warning)
     @return flag indicating the selection of the Retry 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
+    assert icon in [Critical, Information, Question, Warning]
     
     res = __messageBox(parent, title, text, icon, 
                     QMessageBox.StandardButtons(QMessageBox.Retry | QMessageBox.Abort), 
--- a/Graphics/UMLGraphicsView.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Graphics/UMLGraphicsView.py	Fri Sep 03 20:04:49 2010 +0200
@@ -341,7 +341,7 @@
                     self.trUtf8("Save Diagram"),
                     self.trUtf8("<p>The file <b>{0}</b> already exists."
                                 " Overwrite it?</p>").format(fname),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return
             
@@ -486,4 +486,4 @@
                           (itemrect.y() + itemrect.height() // 2)
             item.moveBy(xOffset, yOffset)
         
-        self.scene().update()
+        self.scene().update()
\ No newline at end of file
--- a/Helpviewer/DownloadDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Helpviewer/DownloadDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -127,16 +127,16 @@
                 self.trUtf8("Downloading"),
                 self.trUtf8("""<p>You are about to download the file <b>{0}</b>.</p>"""
                             """<p>What do you want to do?</p>""").format(fileName),
-                QMessageBox.StandardButtons(\
-                    QMessageBox.Open | \
-                    QMessageBox.Save | \
-                    QMessageBox.Cancel))
-            if res == QMessageBox.Cancel:
+                E5MessageBox.StandardButtons(\
+                    E5MessageBox.Open | \
+                    E5MessageBox.Save | \
+                    E5MessageBox.Cancel))
+            if res == E5MessageBox.Cancel:
                 self.__stop()
                 self.close()
                 return False
             
-            self.__autoOpen = res == QMessageBox.Open
+            self.__autoOpen = res == E5MessageBox.Open
             fileName = QDesktopServices.storageLocation(QDesktopServices.TempLocation) + \
                         '/' + QFileInfo(fileName).completeBaseName()
         
@@ -432,4 +432,4 @@
         self.__reply.close()
         self.__reply.deleteLater()
         
-        self.done.emit()
\ No newline at end of file
+        self.done.emit()
--- a/Helpviewer/Network/NetworkAccessManager.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Helpviewer/Network/NetworkAccessManager.py	Fri Sep 03 20:04:49 2010 +0200
@@ -209,7 +209,7 @@
                         """<ul><li>{1}</li></ul></p>"""
                         """<p>Do you want to ignore these errors?</p>""")\
                 .format(reply.url().toString(), errorString),
-            type_ = E5MessageBox.Warning)
+            icon = E5MessageBox.Warning)
         
         if ret:
             if len(caNew) > 0:
@@ -296,4 +296,4 @@
                 diskCache.setMaximumCacheSize(size)
             else:
                 diskCache = None
-            self.setCache(diskCache)
+            self.setCache(diskCache)
\ No newline at end of file
--- a/Helpviewer/Passwords/PasswordManager.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Helpviewer/Passwords/PasswordManager.py	Fri Sep 03 20:04:49 2010 +0200
@@ -10,7 +10,6 @@
 import os
 
 from PyQt4.QtCore import *
-from PyQt4.QtGui import QMessageBox
 from PyQt4.QtNetwork import QNetworkRequest
 from PyQt4.QtWebKit import *
 
@@ -374,16 +373,17 @@
         # prompt, if the form has never be seen
         key = self.__createKey(url, "")
         if key not in self.__loginForms:
-            mb = QMessageBox()
-            mb.setText(self.trUtf8(
-                """<b>Would you like to save this password?</b><br/>"""
-                """To review passwords you have saved and remove them, """
-                """use the password management dialog of the Settings menu."""
-            ))
+            mb = E5MessageBox.E5MessageBox(E5MessageBox.Question,
+                self.trUtf8("Save password"), 
+                self.trUtf8(
+                    """<b>Would you like to save this password?</b><br/>"""
+                    """To review passwords you have saved and remove them, """
+                    """use the password management dialog of the Settings menu."""), 
+                modal = True)
             neverButton = mb.addButton(
-                self.trUtf8("Never for this site"), QMessageBox.DestructiveRole)
-            noButton = mb.addButton(self.trUtf8("Not now"), QMessageBox.RejectRole)
-            mb.addButton(QMessageBox.Yes)
+                self.trUtf8("Never for this site"), E5MessageBox.DestructiveRole)
+            noButton = mb.addButton(self.trUtf8("Not now"), E5MessageBox.RejectRole)
+            mb.addButton(E5MessageBox.Yes)
             mb.exec_()
             if mb.clickedButton() == neverButton:
                 self.__never.append(url.toString())
@@ -564,4 +564,4 @@
             value = value.replace('"', '\\"')
             javascript = 'document.forms[{0}].elements["{1}"].{2}="{3}";'.format(
                          formName, name, setType, value)
-            page.mainFrame().evaluateJavaScript(javascript)
\ No newline at end of file
+            page.mainFrame().evaluateJavaScript(javascript)
--- a/Helpviewer/QtHelpDocumentationDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Helpviewer/QtHelpDocumentationDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -109,7 +109,7 @@
                                 """documentation you are attempting to remove. """
                                 """Removing the documentation will close those """
                                 """documents. Remove anyway?"""),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return
             self.__unregisteredDocs.append(ns)
@@ -139,4 +139,4 @@
         
         @return list of tab ids to be closed (list of integers)
         """
-        return self.__tabsToClose
+        return self.__tabsToClose
\ No newline at end of file
--- a/IconEditor/IconEditorWindow.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/IconEditor/IconEditorWindow.py	Fri Sep 03 20:04:49 2010 +0200
@@ -1005,7 +1005,7 @@
                 self.trUtf8("Save icon file"),
                 self.trUtf8("<p>The file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fileName),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return False
         
@@ -1213,4 +1213,4 @@
         """
         Private slot called in to enter Whats This mode.
         """
-        QWhatsThis.enterWhatsThisMode()
+        QWhatsThis.enterWhatsThisMode()
\ No newline at end of file
--- a/MultiProject/MultiProject.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/MultiProject/MultiProject.py	Fri Sep 03 20:04:49 2010 +0200
@@ -604,7 +604,7 @@
                     self.trUtf8("Save File"),
                     self.trUtf8("<p>The file <b>{0}</b> already exists."
                                 " Overwrite it?</p>").format(fileName),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return False
                 
@@ -976,4 +976,4 @@
         for project in self.projects:
             if not project['master']:
                 files.append(project['file'])
-        return files
+        return files
\ No newline at end of file
--- a/PluginManager/PluginRepositoryDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/PluginManager/PluginRepositoryDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -505,7 +505,7 @@
                         """<p>{0}</p>"""
                         """<p>Do you want to ignore these errors?</p>""")\
                 .format(errorString),
-            type_ = E5MessageBox.Warning)
+            icon = E5MessageBox.Warning)
         if ret:
             reply.ignoreSslErrors()
         else:
@@ -600,4 +600,4 @@
                 ).format(applPath),
                 self.trUtf8('OK'))
         
-        self.close()
+        self.close()
\ No newline at end of file
--- a/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -281,7 +281,7 @@
                 self.trUtf8("Save Diff"),
                 self.trUtf8("<p>The patch file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return
         fname = Utilities.toNativeSeparators(fname)
@@ -344,4 +344,4 @@
             self.intercept = False
             evt.accept()
             return
-        QWidget.keyPressEvent(self, evt)
+        QWidget.keyPressEvent(self, evt)
\ No newline at end of file
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Sep 03 20:04:49 2010 +0200
@@ -1676,7 +1676,7 @@
                 self.trUtf8("Create .hgignore file"),
                 self.trUtf8("""<p>The file <b>{0}</b> exists already."""
                             """ Overwrite it?</p>""").format(ignoreName),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
         else:
             res = True
         if res:
@@ -1738,7 +1738,7 @@
                     self.trUtf8("<p>The Mercurial changegroup file <b>{0}</b> "
                                 "already exists. Overwrite it?</p>")
                         .format(fname),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return
             fname = Utilities.toNativeSeparators(fname)
@@ -2038,4 +2038,4 @@
         @param interval check interval for the monitor thread in seconds (integer)
         @return reference to the monitor thread (QThread)
         """
-        return HgStatusMonitorThread(interval, project, self)
+        return HgStatusMonitorThread(interval, project, self)
\ No newline at end of file
--- a/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py	Fri Sep 03 20:04:49 2010 +0200
@@ -8,7 +8,6 @@
 the pysvn client.
 """
 
-from PyQt4.QtCore import Qt
 from PyQt4.QtGui import QApplication, QDialog, QWidget, QCursor
 
 class SvnDialogMixin(object):
@@ -86,13 +85,13 @@
             acceptedFailures should indicate the accepted certificate failures
             and save should be True, if subversion should save the certificate.
         """
-        from PyQt4.QtGui import QMessageBox
-        
+        from E5Gui import E5MessageBox
+
         cursor = QCursor(QApplication.overrideCursor())
         if cursor is not None:
             QApplication.restoreOverrideCursor()
         parent = isinstance(self, QWidget) and self or None
-        msgBox = QMessageBox.QMessageBox(QMessageBox.Question,
+        msgBox = E5MessageBox.E5MessageBox(E5MessageBox.Question,
             self.trUtf8("Subversion SSL Server Certificate"),
             self.trUtf8("""<p>Accept the following SSL certificate?</p>"""
                         """<table>"""
@@ -109,15 +108,12 @@
                         trust_dict["valid_from"], 
                         trust_dict["valid_until"], 
                         trust_dict["issuer_dname"]),
-            QMessageBox.StandardButtons(QMessageBox.NoButton),
-            parent)
-        if parent is not None:
-            msgBox.setWindowModality(Qt.WindowModal)
+            modal = True, parent = parent)
         permButton = msgBox.addButton(self.trUtf8("&Permanent accept"), 
-                                      QMessageBox.AcceptRole)
+                                      E5MessageBox.AcceptRole)
         tempButton = msgBox.addButton(self.trUtf8("&Temporary accept"), 
-                                      QMessageBox.AcceptRole)
-        msgBox.addButton(self.trUtf8("&Reject"), QMessageBox.RejectRole)
+                                      E5MessageBox.AcceptRole)
+        msgBox.addButton(self.trUtf8("&Reject"), E5MessageBox.RejectRole)
         msgBox.exec_()
         if cursor is not None:
             QApplication.setOverrideCursor(cursor)
--- a/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -334,7 +334,7 @@
                 self.trUtf8("Save Diff"),
                 self.trUtf8("<p>The patch file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return
         fname = Utilities.toNativeSeparators(fname)
@@ -357,4 +357,4 @@
         """
         self.errorGroup.show()
         self.errors.insertPlainText(msg)
-        self.errors.ensureCursorVisible()
+        self.errors.ensureCursorVisible()
\ No newline at end of file
--- a/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -294,7 +294,7 @@
                 self.trUtf8("Save Diff"),
                 self.trUtf8("<p>The patch file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return
         fname = Utilities.toNativeSeparators(fname)
@@ -357,4 +357,4 @@
             self.intercept = False
             evt.accept()
             return
-        QWidget.keyPressEvent(self, evt)
+        QWidget.keyPressEvent(self, evt)
\ No newline at end of file
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -315,7 +315,7 @@
                     self.trUtf8("Save regular expression"),
                     self.trUtf8("<p>The file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return
             
@@ -677,4 +677,4 @@
         self.resize(size)
         
         self.cw.buttonBox.accepted[()].connect(self.close)
-        self.cw.buttonBox.rejected[()].connect(self.close)
+        self.cw.buttonBox.rejected[()].connect(self.close)
\ No newline at end of file
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -229,7 +229,7 @@
                     self.trUtf8("Save regular expression"),
                     self.trUtf8("<p>The file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return
             
@@ -525,4 +525,4 @@
         self.resize(size)
         
         self.cw.buttonBox.accepted[()].connect(self.close)
-        self.cw.buttonBox.rejected[()].connect(self.close)
+        self.cw.buttonBox.rejected[()].connect(self.close)
\ No newline at end of file
--- a/Preferences/ShortcutsDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Preferences/ShortcutsDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -300,7 +300,7 @@
                                     """ to the <b>{1}</b> action. """
                                     """Remove this binding?</p>""")
                                     .format(keystr, itm.text(0)),
-                                type_ = E5MessageBox.Warning)
+                                icon = E5MessageBox.Warning)
                             if res:
                                 itm.setText(col, "")
                                 return True
@@ -318,7 +318,7 @@
                                     """<p><b>{0}</b> hides the <b>{1}</b> action. """
                                     """Remove this binding?</p>""")
                                     .format(keystr, itm.text(0)),
-                                type_ = E5MessageBox.Warning)
+                                icon = E5MessageBox.Warning)
                             if res:
                                 itm.setText(col, "")
                                 return True
@@ -334,7 +334,7 @@
                                     """<b>{1}</b> action. """
                                     """Remove this binding?</p>""")
                                     .format(keystr, itm.text(0)),
-                                type_ = E5MessageBox.Warning)
+                                icon = E5MessageBox.Warning)
                             if res:
                                 itm.setText(col, "")
                                 return True
@@ -453,4 +453,4 @@
         @param checked state of the shortcuts radio button (boolean)
         """
         if checked:
-            self.on_searchEdit_textChanged(self.searchEdit.text())
+            self.on_searchEdit_textChanged(self.searchEdit.text())
\ No newline at end of file
--- a/Preferences/ToolGroupConfigurationDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Preferences/ToolGroupConfigurationDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -111,7 +111,7 @@
             self.trUtf8("""<p>Do you really want to delete the tool group"""
                         """ <b>"{0}"</b>?</p>""")\
                 .format(self.groupsList.currentItem().text()),
-            type_ = E5MessageBox.Warning)
+            icon = E5MessageBox.Warning)
         if not res:
             return
         
@@ -204,4 +204,4 @@
         """
         tmp = self.toolGroups[itm1]
         self.toolGroups[itm1] = self.toolGroups[itm2]
-        self.toolGroups[itm2] = tmp
+        self.toolGroups[itm2] = tmp
\ No newline at end of file
--- a/Project/Project.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Project/Project.py	Fri Sep 03 20:04:49 2010 +0200
@@ -1758,7 +1758,7 @@
                                     self.trUtf8("<p>The file <b>{0}</b> already"
                                         " exists.</p><p>Overwrite it?</p>")
                                         .format(targetfile),
-                                    type_ = E5MessageBox.Warning)
+                                    icon = E5MessageBox.Warning)
                                 if not res:
                                     return  # don't overwrite
                                     
@@ -1833,7 +1833,7 @@
                             self.trUtf8("<p>The file <b>{0}</b> already exists.</p>"
                                         "<p>Overwrite it?</p>")
                                 .format(targetfile),
-                            type_ = E5MessageBox.Warning)
+                            icon = E5MessageBox.Warning)
                         if not res:
                             continue  # don't overwrite, carry on with next file
                             
@@ -2023,7 +2023,7 @@
                 self.trUtf8("""<p>The file <b>{0}</b> already exists."""
                             """ Overwrite it?</p>""")
                     .format(newfn),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return False
         
@@ -2878,7 +2878,7 @@
                     self.trUtf8("Save File"),
                     self.trUtf8("""<p>The file <b>{0}</b> already exists."""
                                 """ Overwrite it?</p>""").format(fn),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return False
                 
@@ -4442,7 +4442,7 @@
                 self.trUtf8("Create Package List"),
                 self.trUtf8("<p>The file <b>PKGLIST</b> already"
                     " exists.</p><p>Overwrite it?</p>"),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return  # don't overwrite
         
@@ -4641,4 +4641,4 @@
                             .replace('"', "").replace("'", "")
                 break
         
-        return version
+        return version
\ No newline at end of file
--- a/Project/ProjectFormsBrowser.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Project/ProjectFormsBrowser.py	Fri Sep 03 20:04:49 2010 +0200
@@ -514,7 +514,7 @@
             res = E5MessageBox.yesNo(self,
                 self.trUtf8("New Form"),
                 self.trUtf8("The file already exists! Overwrite it?"),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 # user selected to not overwrite
                 return
@@ -900,4 +900,4 @@
             "compileSelectedForms"  : None, 
             "generateDialogCode"    : None, 
             "newForm"               : None, 
-        }
+        }
\ No newline at end of file
--- a/Project/ProjectResourcesBrowser.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/Project/ProjectResourcesBrowser.py	Fri Sep 03 20:04:49 2010 +0200
@@ -408,7 +408,7 @@
                 res = E5MessageBox.yesNo(self,
                     self.trUtf8("New Resource"),
                     self.trUtf8("The file already exists! Overwrite it?"),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     # user selected to not overwrite
                     return
@@ -814,4 +814,4 @@
             "compileChangedResources"   : None, 
             "compileSelectedResources"  : None, 
             "newResource"               : None, 
-        }
+        }
\ No newline at end of file
--- a/QScintilla/Editor.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/QScintilla/Editor.py	Fri Sep 03 20:04:49 2010 +0200
@@ -287,7 +287,7 @@
                                     """ Do you really want to load it?</p>""")\
                                     .format(self.fileName, 
                                             QFileInfo(self.fileName).size() // 1024),
-                        type_ = E5MessageBox.Warning)
+                        icon = E5MessageBox.Warning)
                     if not res:
                         raise IOError()
                 self.readFile(self.fileName, True)
@@ -2366,7 +2366,7 @@
                         self.trUtf8("Save File"),
                         self.trUtf8("<p>The file <b>{0}</b> already exists."
                                     " Overwrite it?</p>").format(fn),
-                        type_ = E5MessageBox.Warning)
+                        icon = E5MessageBox.Warning)
                     if not res:
                         return False
                 fn = Utilities.toNativeSeparators(fn)
@@ -4635,7 +4635,7 @@
                 self.trUtf8("Save macro"),
                 self.trUtf8("<p>The macro file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return
         fname = Utilities.toNativeSeparators(fname)
@@ -4660,7 +4660,7 @@
             res = E5MessageBox.yesNo(self, 
                 self.trUtf8("Start Macro Recording"),
                 self.trUtf8("Macro recording is already active. Start new?"),
-                type_ = E5MessageBox.Warning, 
+                icon = E5MessageBox.Warning, 
                 yesDefault = True)
             if res:
                 self.macroRecordingStop()
@@ -4806,7 +4806,7 @@
                     yesDefault = False
                 res = E5MessageBox.yesNo(self,
                     self.trUtf8("File changed"), msg,
-                    type_ = E5MessageBox.Warning, 
+                    icon = E5MessageBox.Warning, 
                     yesDefault = yesDefault)
                 if res:
                     self.refresh()
@@ -5728,4 +5728,4 @@
                command = self.__receivedWhileSyncing.pop(0) 
                self.__dispatchCommand(command)
             
-            self.__isSyncing = False
+            self.__isSyncing = False
\ No newline at end of file
--- a/QScintilla/Exporters/ExporterBase.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/QScintilla/Exporters/ExporterBase.py	Fri Sep 03 20:04:49 2010 +0200
@@ -57,7 +57,7 @@
                     self.trUtf8("Export source"),
                     self.trUtf8("<p>The file <b>{0}</b> already exists."
                                 " Overwrite it?</p>").format(fn),
-                    type_ = E5MessageBox.Warning)
+                    icon = E5MessageBox.Warning)
                 if not res:
                     return ""
             
@@ -71,4 +71,4 @@
         
         This method must be overridden by the real exporters.
         """
-        raise NotImplementedError
+        raise NotImplementedError
\ No newline at end of file
--- a/UI/DiffDialog.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/UI/DiffDialog.py	Fri Sep 03 20:04:49 2010 +0200
@@ -290,7 +290,7 @@
                 self.trUtf8("Save Diff"),
                 self.trUtf8("<p>The patch file <b>{0}</b> already exists."
                             " Overwrite it?</p>").format(fname),
-                type_ = E5MessageBox.Warning)
+                icon = E5MessageBox.Warning)
             if not res:
                 return
         fname = Utilities.toNativeSeparators(fname)
@@ -509,4 +509,4 @@
             QApplication.exit()
             return True
         
-        return False
+        return False
\ No newline at end of file
--- a/UI/UserInterface.py	Fri Sep 03 18:53:24 2010 +0200
+++ b/UI/UserInterface.py	Fri Sep 03 20:04:49 2010 +0200
@@ -2781,12 +2781,11 @@
         if Preferences.getUI("CheckErrorLog"):
             logFile = os.path.join(Utilities.getConfigDir(), "eric5_error.log")
             if os.path.exists(logFile):
-                dlg = QMessageBox(QMessageBox.Question, 
+                dlg = E5MessageBox.E5MessageBox(E5MessageBox.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)
+                                "What should be done with it?"), 
+                    modal = True, parent = self)
                 try:
                     f = open(logFile, "r", encoding = "utf-8")
                     txt = f.read()
@@ -2796,13 +2795,13 @@
                     pass
                 emailButton = \
                     dlg.addButton(self.trUtf8("Send Bug Email"), 
-                                  QMessageBox.AcceptRole)
+                                  E5MessageBox.AcceptRole)
                 deleteButton = \
                     dlg.addButton(self.trUtf8("Ignore and Delete"), 
-                                  QMessageBox.AcceptRole)
+                                  E5MessageBox.AcceptRole)
                 keepButton = \
                     dlg.addButton(self.trUtf8("Ignore but Keep"), 
-                                  QMessageBox.AcceptRole)
+                                  E5MessageBox.AcceptRole)
                 dlg.setDefaultButton(emailButton)
                 dlg.setEscapeButton(keepButton)
                 dlg.exec_()
@@ -5611,7 +5610,7 @@
                         """<p>{0}</p>"""
                         """<p>Do you want to ignore these errors?</p>""")\
                 .format(errorString),
-            type_ = E5MessageBox.Warning)
+            icon = E5MessageBox.Warning)
         if ret:
             reply.ignoreSslErrors()
         else:
@@ -5686,4 +5685,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

eric ide

mercurial