Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
<!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> </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="#about">about</a></td> <td>Function to show a modal dialog with some text about the application.</td> </tr> <tr> <td><a href="#aboutQt">aboutQt</a></td> <td>Function to show a modal dialog with text about Qt.</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> (QMessageBox.Icon)</dt> <dd> type of icon to be shown </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>modal</i> (bool)</dt> <dd> flag indicating a modal dialog </dd> <dt><i>buttons</i> (StandardButtons)</dt> <dd> set of standard buttons to generate </dd> <dt><i>parent</i> (QWidget)</dt> <dd> parent widget of the message box </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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>icon</i> (QMessageBox.Icon)</dt> <dd> type of icon to be shown </dd> <dt><i>buttons</i> (QMessageBox.StandardButtons)</dt> <dd> flags indicating which buttons to show </dd> <dt><i>defaultButton</i> (QMessageBox.StandardButton)</dt> <dd> flag indicating the default button </dd> <dt><i>textFormat</i> (Qt.TextFormat)</dt> <dd> format of the text </dd> </dl> <dl> <dt>Return:</dt> <dd> button pressed by the user </dd> </dl> <dl> <dt>Return Type:</dt> <dd> QMessageBox.StandardButton </dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> <a NAME="about" ID="about"></a> <h2>about</h2> <b>about</b>(<i>parent, title, text</i>) <p> Function to show a modal dialog with some text about the application. </p> <dl> <dt><i>parent</i> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> <a NAME="aboutQt" ID="aboutQt"></a> <h2>aboutQt</h2> <b>aboutQt</b>(<i>parent, title=""</i>) <p> Function to show a modal dialog with text about Qt. </p> <dl> <dt><i>parent</i> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str (optional))</dt> <dd> caption of the message box (defaults to "") </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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>buttons</i> (QMessageBox.StandardButtons)</dt> <dd> flags indicating which buttons to show </dd> <dt><i>defaultButton</i> (QMessageBox.StandardButton)</dt> <dd> flag indicating the default button </dd> </dl> <dl> <dt>Return:</dt> <dd> button pressed by the user </dd> </dl> <dl> <dt>Return Type:</dt> <dd> 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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>buttons</i> (QMessageBox.StandardButtons)</dt> <dd> flags indicating which buttons to show </dd> <dt><i>defaultButton</i> (QMessageBox.StandardButton)</dt> <dd> flag indicating the default button </dd> </dl> <dl> <dt>Return:</dt> <dd> button pressed by the user </dd> </dl> <dl> <dt>Return Type:</dt> <dd> 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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>saveFunc</i> (function)</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> (Qt.TextFormat)</dt> <dd> format of the text </dd> </dl> <dl> <dt>Return:</dt> <dd> flag indicating that it is ok to clear the data </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>buttons</i> (QMessageBox.StandardButtons)</dt> <dd> flags indicating which buttons to show </dd> <dt><i>defaultButton</i> (QMessageBox.StandardButton)</dt> <dd> flag indicating the default button </dd> </dl> <dl> <dt>Return:</dt> <dd> button pressed by the user </dd> </dl> <dl> <dt>Return Type:</dt> <dd> 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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>icon</i> (QMessageBox.Icon)</dt> <dd> icon for the dialog (Critical, Information, Question or Warning) </dd> <dt><i>textFormat</i> (Qt.TextFormat)</dt> <dd> format of the text </dd> </dl> <dl> <dt>Return:</dt> <dd> flag indicating the selection of the Retry button </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>buttons</i> (QMessageBox.StandardButtons)</dt> <dd> flags indicating which buttons to show </dd> <dt><i>defaultButton</i> (QMessageBox.StandardButton)</dt> <dd> flag indicating the default button </dd> </dl> <dl> <dt>Return:</dt> <dd> button pressed by the user </dd> </dl> <dl> <dt>Return Type:</dt> <dd> 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> (QWidget)</dt> <dd> parent widget of the message box </dd> <dt><i>title</i> (str)</dt> <dd> caption of the message box </dd> <dt><i>text</i> (str)</dt> <dd> text to be shown by the message box </dd> <dt><i>icon</i> (QMessageBox.Icon)</dt> <dd> icon for the dialog (Critical, Information, Question or Warning) </dd> <dt><i>yesDefault</i> (bool)</dt> <dd> flag indicating that the Yes button should be the default button </dd> <dt><i>textFormat</i> (Qt.TextFormat)</dt> <dd> format of the text </dd> </dl> <dl> <dt>Return:</dt> <dd> flag indicating the selection of the Yes button </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </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>