def launch_error_message(self, error_type, error=None):
        """Launch a message box with a predefined error message.

        Parameters
        ----------
        error_type : int [CLOSE_ERROR, RESET_ERROR, RESTART_ERROR]
            Possible error codes when restarting/reseting spyder.
        error : Exception
            Actual Python exception error caught.
        """
        messages = {CLOSE_ERROR: _("It was not possible to close the previous "
                                   "Spyder instance.\nRestart aborted."),
                    RESET_ERROR: _("Spyder could not reset to factory "
                                   "defaults.\nRestart aborted."),
                    RESTART_ERROR: _("It was not possible to restart Spyder.\n"
                                     "Operation aborted.")}
        titles = {CLOSE_ERROR: _("Spyder exit error"),
                  RESET_ERROR: _("Spyder reset error"),
                  RESTART_ERROR: _("Spyder restart error")}

        if error:
            e = error.__repr__()
            message = messages[error_type] + "\n\n{0}".format(e)
        else:
            message = messages[error_type]

        title = titles[error_type]
        self.splash.hide()
        QMessageBox.warning(self, title, message, QMessageBox.Ok)
        raise RuntimeError(message)
def launch_error_message ( self , error_type , error = None ) : messages = { CLOSE_ERROR : _ ( "It was not possible to close the previous " "Spyder instance.\nRestart aborted." ) , RESET_ERROR : _ ( "Spyder could not reset to factory " "defaults.\nRestart aborted." ) , RESTART_ERROR : _ ( "It was not possible to restart Spyder.\n" "Operation aborted." ) } titles = { CLOSE_ERROR : _ ( "Spyder exit error" ) , RESET_ERROR : _ ( "Spyder reset error" ) , RESTART_ERROR : _ ( "Spyder restart error" ) } if error : e = error . __repr__ ( ) message = messages [ error_type ] + "\n\n{0}" . format ( e ) else : message = messages [ error_type ] title = titles [ error_type ] self . splash . hide ( ) QMessageBox . warning ( self , title , message , QMessageBox . Ok ) raise RuntimeError ( message )
Launch a message box with a predefined error message.

        Parameters
        ----------
        error_type : int [CLOSE_ERROR, RESET_ERROR, RESTART_ERROR]
            Possible error codes when restarting/reseting spyder.
        error : Exception
            Actual Python exception error caught.