src/eric7/Documentation/Source/eric7.EricWidgets.EricMessageBox.html

Mon, 13 Feb 2023 17:51:03 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 13 Feb 2023 17:51:03 +0100
branch
eric7
changeset 9757
ab6e87f6f1c4
parent 9236
db53a9efe7ef
child 10423
299802979277
permissions
-rw-r--r--

Modified the EricMessageBox okToClearData() function for more flexibility.

<!DOCTYPE html>
<html><head>
<title>eric7.EricWidgets.EricMessageBox</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.EricWidgets.EricMessageBox</h1>

<p>
Module implementing QMessageBox replacements and more convenience function.
</p>
<h3>Global Attributes</h3>

<table>
<tr><td>Abort</td></tr><tr><td>AcceptRole</td></tr><tr><td>ActionRole</td></tr><tr><td>Apply</td></tr><tr><td>ApplyRole</td></tr><tr><td>Cancel</td></tr><tr><td>Close</td></tr><tr><td>Critical</td></tr><tr><td>DestructiveRole</td></tr><tr><td>Discard</td></tr><tr><td>Help</td></tr><tr><td>HelpRole</td></tr><tr><td>Ignore</td></tr><tr><td>Information</td></tr><tr><td>InvalidRole</td></tr><tr><td>No</td></tr><tr><td>NoButton</td></tr><tr><td>NoIcon</td></tr><tr><td>NoRole</td></tr><tr><td>NoToAll</td></tr><tr><td>Ok</td></tr><tr><td>Open</td></tr><tr><td>Question</td></tr><tr><td>RejectRole</td></tr><tr><td>Reset</td></tr><tr><td>ResetRole</td></tr><tr><td>RestoreDefaults</td></tr><tr><td>Retry</td></tr><tr><td>Save</td></tr><tr><td>SaveAll</td></tr><tr><td>Warning</td></tr><tr><td>Yes</td></tr><tr><td>YesRole</td></tr><tr><td>YesToAll</td></tr><tr><td>about</td></tr><tr><td>aboutQt</td></tr>
</table>
<h3>Classes</h3>

<table>

<tr>
<td><a href="#EricMessageBox">EricMessageBox</a></td>
<td>Class implementing a replacement for QMessageBox.</td>
</tr>
</table>
<h3>Functions</h3>

<table>

<tr>
<td><a href="#__messageBox">__messageBox</a></td>
<td>Private module function to show a modal message box.</td>
</tr>
<tr>
<td><a href="#critical">critical</a></td>
<td>Function to show a modal critical message box.</td>
</tr>
<tr>
<td><a href="#information">information</a></td>
<td>Function to show a modal information message box.</td>
</tr>
<tr>
<td><a href="#okToClearData">okToClearData</a></td>
<td>Function to show a modal message box to ask for clearing the data.</td>
</tr>
<tr>
<td><a href="#question">question</a></td>
<td>Function to show a modal question message box.</td>
</tr>
<tr>
<td><a href="#retryAbort">retryAbort</a></td>
<td>Function to show a model abort/retry message box.</td>
</tr>
<tr>
<td><a href="#warning">warning</a></td>
<td>Function to show a modal warning message box.</td>
</tr>
<tr>
<td><a href="#yesNo">yesNo</a></td>
<td>Function to show a model yes/no message box.</td>
</tr>
</table>
<hr />
<hr />
<a NAME="EricMessageBox" ID="EricMessageBox"></a>
<h2>EricMessageBox</h2>

<p>
    Class implementing a replacement for QMessageBox.
</p>
<h3>Derived from</h3>
QMessageBox
<h3>Class Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#EricMessageBox.__init__">EricMessageBox</a></td>
<td>Constructor</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="EricMessageBox.__init__" ID="EricMessageBox.__init__"></a>
<h4>EricMessageBox (Constructor)</h4>
<b>EricMessageBox</b>(<i>icon, title, text, modal=False, buttons=QMessageBox.StandardButton.NoButton, parent=None, </i>)

<p>
        Constructor
</p>
<dl>

<dt><i>icon</i></dt>
<dd>
type of icon to be shown (QMessageBox.Icon)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>modal</i></dt>
<dd>
flag indicating a modal dialog (boolean)
</dd>
<dt><i>buttons</i></dt>
<dd>
set of standard buttons to generate (StandardButtons)
</dd>
<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="__messageBox" ID="__messageBox"></a>
<h2>__messageBox</h2>
<b>__messageBox</b>(<i>parent, title, text, icon, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, textFormat=Qt.TextFormat.AutoText, </i>)

<p>
    Private module function to show a modal message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>icon</i></dt>
<dd>
type of icon to be shown (QMessageBox.Icon)
</dd>
<dt><i>buttons</i></dt>
<dd>
flags indicating which buttons to show
        (QMessageBox.StandardButtons)
</dd>
<dt><i>defaultButton</i></dt>
<dd>
flag indicating the default button
        (QMessageBox.StandardButton)
</dd>
<dt><i>textFormat</i></dt>
<dd>
format of the text (Qt.TextFormat)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
button pressed by the user (QMessageBox.StandardButton)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="critical" ID="critical"></a>
<h2>critical</h2>
<b>critical</b>(<i>parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, </i>)

<p>
    Function to show a modal critical message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>buttons</i></dt>
<dd>
flags indicating which buttons to show
        (QMessageBox.StandardButtons)
</dd>
<dt><i>defaultButton</i></dt>
<dd>
flag indicating the default button
        (QMessageBox.StandardButton)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
button pressed by the user (QMessageBox.StandardButton)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="information" ID="information"></a>
<h2>information</h2>
<b>information</b>(<i>parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, </i>)

<p>
    Function to show a modal information message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>buttons</i></dt>
<dd>
flags indicating which buttons to show
        (QMessageBox.StandardButtons)
</dd>
<dt><i>defaultButton</i></dt>
<dd>
flag indicating the default button
        (QMessageBox.StandardButton)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
button pressed by the user (QMessageBox.StandardButton)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="okToClearData" ID="okToClearData"></a>
<h2>okToClearData</h2>
<b>okToClearData</b>(<i>parent, title, text, saveFunc, textFormat=Qt.TextFormat.AutoText</i>)

<p>
    Function to show a modal message box to ask for clearing the data.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>saveFunc</i></dt>
<dd>
reference to a function performing the save action. It
        must be a parameterless function returning a flag indicating success.
</dd>
<dt><i>textFormat</i></dt>
<dd>
format of the text (Qt.TextFormat)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating that it is ok to clear the data (boolean)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="question" ID="question"></a>
<h2>question</h2>
<b>question</b>(<i>parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, </i>)

<p>
    Function to show a modal question message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>buttons</i></dt>
<dd>
flags indicating which buttons to show
        (QMessageBox.StandardButtons)
</dd>
<dt><i>defaultButton</i></dt>
<dd>
flag indicating the default button
        (QMessageBox.StandardButton)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
button pressed by the user (QMessageBox.StandardButton)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="retryAbort" ID="retryAbort"></a>
<h2>retryAbort</h2>
<b>retryAbort</b>(<i>parent, title, text, icon=Question, textFormat=Qt.TextFormat.AutoText</i>)

<p>
    Function to show a model abort/retry message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>icon</i></dt>
<dd>
icon for the dialog (Critical, Information, Question or
        Warning)
</dd>
<dt><i>textFormat</i></dt>
<dd>
format of the text (Qt.TextFormat)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the selection of the Retry button (boolean)
</dd>
</dl>
<dl>

<dt>Raises <b>ValueError</b>:</dt>
<dd>
raised to indicate a bad parameter value
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="warning" ID="warning"></a>
<h2>warning</h2>
<b>warning</b>(<i>parent, title, text, buttons=QMessageBox.StandardButton.Ok, defaultButton=QMessageBox.StandardButton.NoButton, </i>)

<p>
    Function to show a modal warning message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>buttons</i></dt>
<dd>
flags indicating which buttons to show
        (QMessageBox.StandardButtons)
</dd>
<dt><i>defaultButton</i></dt>
<dd>
flag indicating the default button
        (QMessageBox.StandardButton)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
button pressed by the user (QMessageBox.StandardButton)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="yesNo" ID="yesNo"></a>
<h2>yesNo</h2>
<b>yesNo</b>(<i>parent, title, text, icon=Question, yesDefault=False, textFormat=Qt.TextFormat.AutoText, </i>)

<p>
    Function to show a model yes/no message box.
</p>
<dl>

<dt><i>parent</i></dt>
<dd>
parent widget of the message box (QWidget)
</dd>
<dt><i>title</i></dt>
<dd>
caption of the message box (string)
</dd>
<dt><i>text</i></dt>
<dd>
text to be shown by the message box (string)
</dd>
<dt><i>icon</i></dt>
<dd>
icon for the dialog (Critical, Information, Question or
        Warning)
</dd>
<dt><i>yesDefault</i></dt>
<dd>
flag indicating that the Yes button should be the
        default button (boolean)
</dd>
<dt><i>textFormat</i></dt>
<dd>
format of the text (Qt.TextFormat)
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the selection of the Yes button (boolean)
</dd>
</dl>
<dl>

<dt>Raises <b>ValueError</b>:</dt>
<dd>
raised to indicate a bad parameter value
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial